mirror of
https://github.com/ONLYOFFICE/sdkjs.git
synced 2025-04-18 14:24:11 +03:00
[all] Axes grid and labels are fixed for waterfall and histogram
This commit is contained in:
parent
2403d457fd
commit
b867f20503
@ -189,7 +189,9 @@ CChartsDrawer.prototype =
|
||||
//CHARTS
|
||||
if (!chartSpace.bEmptySeries) {
|
||||
for(var i in this.charts) {
|
||||
this.charts[i].recalculate();
|
||||
if (this.charts.hasOwnProperty(i) && this.charts[i]) {
|
||||
this.charts[i].recalculate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -318,7 +320,9 @@ CChartsDrawer.prototype =
|
||||
|
||||
if (chartSpace.chart.plotArea.isForChartEx) {
|
||||
for (i in t.charts) {
|
||||
t.charts[i].draw();
|
||||
if (t.charts.hasOwnProperty(i) && t.charts[i]) {
|
||||
t.charts[i].draw();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//для начала нужно отсортировать
|
||||
@ -616,6 +620,7 @@ CChartsDrawer.prototype =
|
||||
|
||||
if (!this.cChartSpace.bEmptySeries) {
|
||||
var type = obj.getObjectType();
|
||||
|
||||
switch (type) {
|
||||
case AscDFH.historyitem_type_DLbl: {
|
||||
pos = this._calculatePositionDlbl(obj);
|
||||
@ -625,7 +630,7 @@ CChartsDrawer.prototype =
|
||||
var parentType = obj.parent ? obj.parent.getObjectType() : null;
|
||||
if (parentType === AscDFH.historyitem_type_Chart) {
|
||||
pos = this._calculatePositionTitle(obj);
|
||||
} else if (parentType === AscDFH.historyitem_type_ValAx || parentType === AscDFH.historyitem_type_CatAx || parentType === AscDFH.historyitem_type_DateAx) {
|
||||
} else if (parentType === AscDFH.historyitem_type_ValAx || parentType === AscDFH.historyitem_type_CatAx || parentType === AscDFH.historyitem_type_DateAx || parentType === AscDFH.historyitem_type_Axis) {
|
||||
pos = this._calculatePositionAxisTitle(obj.parent);
|
||||
}
|
||||
break;
|
||||
@ -2491,13 +2496,6 @@ CChartsDrawer.prototype =
|
||||
valAxis.max = axisProperties.val.max;
|
||||
valAxis.scale = axisProperties.val.scale.length > 0 ? axisProperties.val.scale : this._roundValues(this._getAxisValues2(valAxis, this.cChartSpace, false, false));
|
||||
|
||||
// Exchange cross axes
|
||||
catAxis.crossAx = valAxis;
|
||||
valAxis.crossAx = catAxis;
|
||||
|
||||
// Differentiate between axes
|
||||
catAxis.axPos = window['AscFormat'].AX_POS_B;
|
||||
valAxis.axPos = window['AscFormat'].AX_POS_L;
|
||||
},
|
||||
|
||||
_chartExSetAxisMinAndMax: function (axis, num) {
|
||||
@ -2691,9 +2689,11 @@ CChartsDrawer.prototype =
|
||||
axisProperties.val.min = 0;
|
||||
axisProperties.val.max = 0;
|
||||
cachedData.accumulation = [];
|
||||
let sum = 0;
|
||||
for (let i = 0; i < numArr.length; i++) {
|
||||
cachedData.accumulation.push(numArr[i].val);
|
||||
axisProperties.val.max += numArr[i].val;
|
||||
sum += numArr[i].val;
|
||||
this._chartExSetAxisMinAndMax(axisProperties.val, sum);
|
||||
axisProperties.cat.scale.push(numArr[i].idx + 1);
|
||||
}
|
||||
},
|
||||
@ -4615,11 +4615,11 @@ CChartsDrawer.prototype =
|
||||
if (!this.cChartSpace || !this.calcProp) {
|
||||
return null;
|
||||
}
|
||||
var pathId = this.cChartSpace.AllocPath();
|
||||
var path = this.cChartSpace.GetPath(pathId);
|
||||
const pathId = this.cChartSpace.AllocPath();
|
||||
const path = this.cChartSpace.GetPath(pathId);
|
||||
|
||||
var pathH = this.calcProp.pathH;
|
||||
var pathW = this.calcProp.pathW;
|
||||
const pathH = this.calcProp.pathH;
|
||||
const pathW = this.calcProp.pathW;
|
||||
|
||||
if (!isPxToMmConverted) {
|
||||
const pxToMm = this.calcProp.pxToMM;
|
||||
@ -5049,9 +5049,10 @@ CChartsDrawer.prototype =
|
||||
|
||||
getVerticalGridLines: function (axis, isCatAxis) {
|
||||
var gridLines, minorGridLines;
|
||||
const isForChartEx = this.cChartSpace && this.cChartSpace.chart && this.cChartSpace.chart.plotArea && this.cChartSpace.chart.plotArea.isForChartEx ? true : false;
|
||||
|
||||
var crossBetween = this.cChartSpace.getValAxisCrossType();
|
||||
if(null === crossBetween && isCatAxis) {
|
||||
if(null === crossBetween && (isCatAxis || isForChartEx)) {
|
||||
crossBetween = axis.crossAx ? axis.crossAx.crossBetween : null;
|
||||
}
|
||||
|
||||
@ -5067,15 +5068,14 @@ CChartsDrawer.prototype =
|
||||
if(!axis.majorGridlines && !axis.minorGridlines) {
|
||||
return;
|
||||
}
|
||||
|
||||
var minorLinesCount = isCatAxis ? 2 : 5;
|
||||
var minorLinesCount = isCatAxis || isForChartEx ? 2 : 5;
|
||||
|
||||
var posAxis = this.calcProp.chartGutter._left / this.calcProp.pxToMM;
|
||||
var stepX = points[1] ? Math.abs((points[1].pos - points[0].pos)) : (Math.abs(points[0].pos - posAxis) * 2);
|
||||
var minorStep = (stepX * this.calcProp.pxToMM) / minorLinesCount;
|
||||
var posX, crossDiff;
|
||||
|
||||
if (crossBetween === AscFormat.CROSS_BETWEEN_BETWEEN && isCatAxis) {
|
||||
if (crossBetween === AscFormat.CROSS_BETWEEN_BETWEEN && (isCatAxis || isForChartEx)) {
|
||||
crossDiff = points[1] ? Math.abs((points[1].pos - points[0].pos) / 2) : Math.abs(points[0].pos - posAxis);
|
||||
}
|
||||
|
||||
@ -5083,7 +5083,7 @@ CChartsDrawer.prototype =
|
||||
var path = this.cChartSpace.GetPath(pathId);
|
||||
var i;
|
||||
for (i = 0; i < points.length; i++) {
|
||||
if(isCatAxis && points[i].val < 0) {
|
||||
if((isCatAxis && points[i].val < 0) && !isForChartEx) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -5114,7 +5114,7 @@ CChartsDrawer.prototype =
|
||||
var pathIdMinor = this.cChartSpace.AllocPath();
|
||||
var pathMinor = this.cChartSpace.GetPath(pathIdMinor);
|
||||
for (i = 0; i < points.length; i++) {
|
||||
if(isCatAxis && points[i].val < 0) {
|
||||
if((isCatAxis && points[i].val < 0) && !isForChartEx) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -7633,7 +7633,9 @@ drawHistogramChart.prototype = {
|
||||
// two different ways of storing information, object and array, therefore convert object into array
|
||||
const sections = isAggregation ? Object.values(cachedData.aggregation) : cachedData.results;
|
||||
if (sections) {
|
||||
const initialBarWidth = (this.chartProp.trueWidth)/ sections.length;
|
||||
// 1 px gap for each section length
|
||||
const gapWidth = 1;
|
||||
const initialBarWidth = (this.chartProp.trueWidth) / sections.length;
|
||||
const barWidth = (initialBarWidth / (1 + coeff));
|
||||
const margin = (initialBarWidth - barWidth) / 2;
|
||||
|
||||
@ -7642,11 +7644,12 @@ drawHistogramChart.prototype = {
|
||||
// aggregation object does not have field occurrence;
|
||||
const val = isAggregation ? sections[i] : sections[i].occurrence;
|
||||
const startY = this.cChartDrawer.getYPosition(val, valAxis, true);
|
||||
const bW = i === 0 ? barWidth : barWidth - gapWidth;
|
||||
if (this.chartProp && this.chartProp.pxToMM ) {
|
||||
const height = valStart - (startY * this.chartProp.pxToMM);
|
||||
this.paths[i] = this.cChartDrawer._calculateRect(start, valStart, barWidth, height);
|
||||
this.paths[i] = this.cChartDrawer._calculateRect(start, valStart, bW, height);
|
||||
}
|
||||
start += (barWidth + margin + margin);
|
||||
start += (bW + margin + margin + gapWidth);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7705,10 +7708,12 @@ drawHistogramChart.prototype = {
|
||||
let oSeries = series[0];
|
||||
if(oSeries) {
|
||||
for (let i in this.paths) {
|
||||
let nPtIdx = parseInt(i);
|
||||
let pen = oSeries.getPtPen(nPtIdx);
|
||||
let brush = oSeries.getPtBrush(nPtIdx);
|
||||
this.cChartDrawer.drawPath(this.paths[i], pen, brush);
|
||||
if (this.paths.hasOwnProperty(i) && this.paths[i]) {
|
||||
let nPtIdx = parseInt(i);
|
||||
let pen = oSeries.getPtPen(nPtIdx);
|
||||
let brush = oSeries.getPtBrush(nPtIdx);
|
||||
this.cChartDrawer.drawPath(this.paths[i], pen, brush);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7817,25 +7822,52 @@ drawWaterfallChart.prototype = {
|
||||
let valStart = this.cChartSpace.chart.plotArea.axId ? this.cChartSpace.chart.plotArea.axId[0].posY * this.chartProp.pxToMM : this.chartProp.trueHeight + this.chartProp.chartGutter._top;
|
||||
if (AscFormat.isRealNumber(valStart)) {
|
||||
const coeff = catAxis.scaling.gapWidth;
|
||||
const initialBarWidth = (this.chartProp.trueWidth)/ data.length;
|
||||
// 1 px gap for each section length
|
||||
const gapWidth = 1.5;
|
||||
const gapNumbers = data.length - 1;
|
||||
const initialBarWidth = (this.chartProp.trueWidth - (gapWidth * gapNumbers))/ data.length;
|
||||
const barWidth = (initialBarWidth / (1 + coeff));
|
||||
const margin = (initialBarWidth - barWidth) / 2;
|
||||
|
||||
let sum = 0;
|
||||
let start = (catStart + margin);
|
||||
let start = (catStart + margin);
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
sum += data[i].val;
|
||||
const startY = this.cChartDrawer.getYPosition(sum, valAxis, true) * this.chartProp.pxToMM;
|
||||
const valPos = this.cChartDrawer.getYPosition(sum, valAxis, true) * this.chartProp.pxToMM; // calc roof of the current bar
|
||||
const next = start + (barWidth + margin + gapWidth + margin); // calc end of the current barr
|
||||
if (this.chartProp && this.chartProp.pxToMM ) {
|
||||
const height = valStart - startY;
|
||||
this.paths[i] = this.cChartDrawer._calculateRect(start, valStart, barWidth, height);
|
||||
const height = valStart - valPos;
|
||||
this.paths[i] = [];
|
||||
this.paths[i].push(this.cChartDrawer._calculateRect(start, valStart, barWidth, height));
|
||||
//dont need last connectorLine
|
||||
if (i !== data.length - 1 && margin !== 0) {
|
||||
this.paths[i].push(this._calculateConnectorLine(valPos, start + barWidth, next))
|
||||
}
|
||||
}
|
||||
valStart = startY;
|
||||
start += (barWidth + margin + margin);
|
||||
valStart = valPos; // go up in y direction
|
||||
start = next; // go right in x direction
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_calculateConnectorLine: function (y, x1, x2) {
|
||||
if (!this.cChartSpace || !this.chartProp) {
|
||||
return null;
|
||||
}
|
||||
const pathId = this.cChartSpace.AllocPath();
|
||||
const path = this.cChartSpace.GetPath(pathId);
|
||||
|
||||
const pathH = this.chartProp.pathH;
|
||||
const pathW = this.chartProp.pathW;
|
||||
const pxToMm = this.chartProp.pxToMM;
|
||||
|
||||
path.moveTo((x1 / pxToMm) * pathW, (y / pxToMm) * pathH);
|
||||
path.lnTo((x2 / pxToMm) * pathW, (y / pxToMm) * pathH);
|
||||
|
||||
return pathId;
|
||||
},
|
||||
|
||||
draw: function () {
|
||||
if (!this.cChartDrawer || !this.cChartDrawer.calcProp || !this.cChartDrawer.cShapeDrawer || !this.cChartDrawer.cShapeDrawer.Graphics || !this.cChartDrawer.calcProp.chartGutter) {
|
||||
return;
|
||||
@ -7888,10 +7920,16 @@ drawWaterfallChart.prototype = {
|
||||
let oSeries = series[0];
|
||||
if(oSeries) {
|
||||
for (let i in this.paths) {
|
||||
let nPtIdx = parseInt(i);
|
||||
let pen = oSeries.getPtPen(nPtIdx);
|
||||
let brush = oSeries.getPtBrush(nPtIdx);
|
||||
this.cChartDrawer.drawPath(this.paths[i], pen, brush);
|
||||
if (this.paths.hasOwnProperty(i) && this.paths[i]) {
|
||||
for (let j in this.paths[i]) {
|
||||
if (this.paths[i].hasOwnProperty(j) && this.paths[i][j]) {
|
||||
let nPtIdx = parseInt(i);
|
||||
let pen = (j === 0 ) ? oSeries.getPtPen(nPtIdx) : this.cChartSpace.chart.plotArea.axId[1].compiledMajorGridLines;
|
||||
let brush = oSeries.getPtBrush(nPtIdx);
|
||||
this.cChartDrawer.drawPath(this.paths[i][j], pen, brush);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7902,7 +7940,7 @@ drawWaterfallChart.prototype = {
|
||||
if (!this.paths || !this.chartProp) {
|
||||
return;
|
||||
}
|
||||
const path = this.paths[compiledDlb.idx];
|
||||
const path = this.paths[compiledDlb.idx][0];
|
||||
|
||||
if (!AscFormat.isRealNumber(path)) {
|
||||
return;
|
||||
|
@ -268,6 +268,10 @@ function (window, undefined) {
|
||||
this.setParentToChild(pr);
|
||||
};
|
||||
|
||||
CAxis.prototype.setAxPos = function (pos) {
|
||||
this.axPos = pos ? window['AscFormat'].AX_POS_L : window['AscFormat'].AX_POS_B;
|
||||
}
|
||||
|
||||
// AxisUnits
|
||||
drawingsChangesMap[AscDFH.historyitem_AxisUnits_SetUnitsLabel] = function (oClass, value) {
|
||||
oClass.unitsLabel = value;
|
||||
@ -2946,6 +2950,10 @@ function (window, undefined) {
|
||||
}
|
||||
return null;
|
||||
};
|
||||
CSeries.prototype.getValPts = function () {
|
||||
const numLit = this.getValLit();
|
||||
return numLit ? numLit.pts : [];
|
||||
};
|
||||
CSeries.prototype.getCatLit = function (type) {
|
||||
let oSeriesData = this.getData();
|
||||
if(!oSeriesData) {
|
||||
|
@ -4149,7 +4149,7 @@ function(window, undefined) {
|
||||
const cachedData = this.chart.plotArea.plotAreaRegion.cachedData;
|
||||
const results = obtainResults(cachedData);
|
||||
//seria.dataLabels.visibility optional
|
||||
if (seria && seria.dataLabels) {
|
||||
if (cachedData && seria && seria.dataLabels) {
|
||||
const default_lbl = new AscFormat.CDLbl();
|
||||
const nDefaultPosition = seria.dataLabels.pos ? seria.dataLabels.pos : AscFormat.DATA_LABEL_POS_OUT_END;
|
||||
default_lbl.initDefault(nDefaultPosition);
|
||||
@ -4185,6 +4185,18 @@ function(window, undefined) {
|
||||
CChartSpace.prototype.calculateLabelsPositions = function (b_recalc_labels, b_recalc_legend) {
|
||||
let layout;
|
||||
let aDLbls = this.recalcInfo.dataLbls;
|
||||
|
||||
// TODO after new succefull implementation of new type remove option here
|
||||
const isForChartEx = this.chart && this.chart.plotArea && this.chart.plotArea.isForChartEx ? true : false;
|
||||
const type = this.chart && this.chart.plotArea && this.chart.plotArea.plotAreaRegion && this.chart.plotArea.plotAreaRegion.series && this.chart.plotArea.plotAreaRegion.series[0] ? this.chart.plotArea.plotAreaRegion.series[0].layoutId : null;
|
||||
if (isForChartEx && type !== AscFormat.SERIES_LAYOUT_BOX_WHISKER && !type) {
|
||||
return ;
|
||||
}
|
||||
if (isForChartEx && (type === AscFormat.SERIES_LAYOUT_BOX_WHISKER || type === AscFormat.SERIES_LAYOUT_FUNNEL || type === AscFormat.SERIES_LAYOUT_PARETO_LINE || type === AscFormat.SERIES_LAYOUT_REGION_MAP || type === AscFormat.SERIES_LAYOUT_SUNBURST || type === AscFormat.SERIES_LAYOUT_TREEMAP)) {
|
||||
return ;
|
||||
}
|
||||
//----------------------------------
|
||||
|
||||
if (!aDLbls || aDLbls.length === 0) {
|
||||
this.calculateChartExLabelsPositions();
|
||||
}
|
||||
@ -4367,7 +4379,7 @@ function(window, undefined) {
|
||||
if (!this.chart || !this.chart.plotArea) {
|
||||
return [];
|
||||
}
|
||||
if (oAxis.Id === this.chart.plotArea.axId[1].Id) {
|
||||
if (this.chart.plotArea.axId.length > 1 && oAxis.Id === this.chart.plotArea.axId[1].Id) {
|
||||
// for the val axis, regularly get labels
|
||||
aStrings = this.getLabelsForAxis(oAxis, true);
|
||||
} else {
|
||||
@ -4736,6 +4748,7 @@ function(window, undefined) {
|
||||
if(this.chart.plotArea.layout && this.chart.plotArea.layout.layoutTarget === AscFormat.LAYOUT_TARGET_INNER) {
|
||||
bWithoutLabels = true;
|
||||
}
|
||||
|
||||
let bCorrected = false;
|
||||
let fL = oRect.x, fT = oRect.y, fR = oRect.x + oRect.w, fB = oRect.y + oRect.h;
|
||||
const isChartEX = this.chart && this.chart.plotArea && this.chart.plotArea.isForChartEx ? true : false;
|
||||
@ -4754,6 +4767,9 @@ function(window, undefined) {
|
||||
this.calculateAxisGrid(oCrossAxis, oRect);
|
||||
oCalcMap[oCrossAxis.Id] = true;
|
||||
}
|
||||
if (!oCrossAxis) {
|
||||
return;
|
||||
}
|
||||
let fCrossValue;
|
||||
// posY seeks the zero position on the diagram
|
||||
let posY = null;
|
||||
@ -5143,6 +5159,16 @@ function(window, undefined) {
|
||||
this.cachedCanvas = null;
|
||||
this.plotAreaRect = null;
|
||||
this.bEmptySeries = this.checkEmptySeries();
|
||||
// TODO after new succefull implementation of new type remove option here
|
||||
const isForChartEx = this.chart && this.chart.plotArea && this.chart.plotArea.isForChartEx ? true : false;
|
||||
const type = this.chart && this.chart.plotArea && this.chart.plotArea.plotAreaRegion && this.chart.plotArea.plotAreaRegion.series && this.chart.plotArea.plotAreaRegion.series[0] ? this.chart.plotArea.plotAreaRegion.series[0].layoutId : null;
|
||||
if (isForChartEx && type !== AscFormat.SERIES_LAYOUT_BOX_WHISKER && !type) {
|
||||
return ;
|
||||
}
|
||||
if (isForChartEx && (type === AscFormat.SERIES_LAYOUT_BOX_WHISKER || type === AscFormat.SERIES_LAYOUT_FUNNEL || type === AscFormat.SERIES_LAYOUT_PARETO_LINE || type === AscFormat.SERIES_LAYOUT_REGION_MAP || type === AscFormat.SERIES_LAYOUT_SUNBURST || type === AscFormat.SERIES_LAYOUT_TREEMAP)) {
|
||||
return ;
|
||||
}
|
||||
//----------------------------------
|
||||
if (this.chart && this.chart.plotArea) {
|
||||
var oPlotArea = this.chart.plotArea;
|
||||
for (i = 0; i < oPlotArea.axId.length; ++i) {
|
||||
@ -5771,7 +5797,8 @@ function(window, undefined) {
|
||||
if (AscFormat.isRealNumber(legend.legendPos)) {
|
||||
legend_pos = legend.legendPos;
|
||||
}
|
||||
var aCharts = this.chart.plotArea.charts;
|
||||
const isChartEx = this.chart && this.chart.plotArea && this.chart.plotArea.isForChartEx ? true : false;
|
||||
var aCharts = isChartEx ? [this.chart.plotArea.plotAreaRegion] : this.chart.plotArea.charts;
|
||||
var oTypedChart;
|
||||
//Order series for the legend
|
||||
var aOrderedSeries = [];
|
||||
@ -5853,7 +5880,8 @@ function(window, undefined) {
|
||||
entry = legend.findLegendEntryByIndex(i);
|
||||
if(entry && entry.bDelete)
|
||||
continue;
|
||||
arr_str_labels.push(ser.getSeriesName());
|
||||
const label = ser.getSeriesName ? ser.getSeriesName() : '';
|
||||
arr_str_labels.push(label);
|
||||
}
|
||||
else {
|
||||
entry = legend.findLegendEntryByIndex(i);
|
||||
@ -5884,7 +5912,7 @@ function(window, undefined) {
|
||||
|
||||
calc_entry.calcMarkerUnion = new AscFormat.CUnionMarker();
|
||||
union_marker = calc_entry.calcMarkerUnion;
|
||||
var pts = ser.getNumPts();
|
||||
var pts = isChartEx ? ser.getValPts() : ser.getNumPts();
|
||||
var nSerType = ser.getObjectType();
|
||||
if(nSerType === AscDFH.historyitem_type_BarSeries ||
|
||||
nSerType === AscDFH.historyitem_type_BubbleSeries ||
|
||||
@ -6084,6 +6112,9 @@ function(window, undefined) {
|
||||
} else {
|
||||
marker_size = 0.2 * max_font_size;
|
||||
for (i = 0; i < calc_entryes.length; ++i) {
|
||||
if (!calc_entryes[i].calcMarkerUnion || !calc_entryes[i].calcMarkerUnion.marker || !calc_entryes[i].calcMarkerUnion.marker.spPr || !calc_entryes[i].calcMarkerUnion.marker.spPr.geometry) {
|
||||
continue;
|
||||
}
|
||||
calc_entryes[i].calcMarkerUnion.marker.spPr.geometry.Recalculate(marker_size, marker_size);
|
||||
}
|
||||
distance_to_text = marker_size * 0.7;
|
||||
@ -8458,6 +8489,16 @@ function(window, undefined) {
|
||||
if (this.chartObj) {
|
||||
this.chartObj.draw(this, graphics);
|
||||
}
|
||||
// TODO after new succefull implementation of new type remove option here
|
||||
const isForChartEx = this.chart && this.chart.plotArea && this.chart.plotArea.isForChartEx ? true : false;
|
||||
const type = this.chart && this.chart.plotArea && this.chart.plotArea.plotAreaRegion && this.chart.plotArea.plotAreaRegion.series && this.chart.plotArea.plotAreaRegion.series[0] ? this.chart.plotArea.plotAreaRegion.series[0].layoutId : null;
|
||||
if (isForChartEx && type !== AscFormat.SERIES_LAYOUT_BOX_WHISKER && !type) {
|
||||
return ;
|
||||
}
|
||||
if (isForChartEx && (type === AscFormat.SERIES_LAYOUT_BOX_WHISKER || type === AscFormat.SERIES_LAYOUT_FUNNEL || type === AscFormat.SERIES_LAYOUT_PARETO_LINE || type === AscFormat.SERIES_LAYOUT_REGION_MAP || type === AscFormat.SERIES_LAYOUT_SUNBURST || type === AscFormat.SERIES_LAYOUT_TREEMAP)) {
|
||||
return ;
|
||||
}
|
||||
//----------------------------------
|
||||
if (this.chart && !this.bEmptySeries) {
|
||||
if (this.chart.plotArea) {
|
||||
// var oChartSize = this.getChartSizes();
|
||||
|
@ -13507,6 +13507,17 @@ BinaryChartReader.prototype.ReadCT_ChartEx = function (type, length, val) {
|
||||
res = this.bcr.Read1(length, function (t, l) {
|
||||
return oThis.ReadCT_ChartExPlotArea(t, l, oNewVal);
|
||||
});
|
||||
if (oNewVal && oNewVal.axId && Array.isArray(oNewVal.axId)) {
|
||||
for (let i = 0; i < oNewVal.axId.length; i++) {
|
||||
const axis = oNewVal.axId[i];
|
||||
axis.setAxPos(i);
|
||||
}
|
||||
if (oNewVal.axId.length === 2) {
|
||||
oNewVal.axId[0].crossAx = oNewVal.axId[1];
|
||||
oNewVal.axId[1].crossAx = oNewVal.axId[0];
|
||||
oNewVal.axId[1].crossBetween = 0;
|
||||
}
|
||||
}
|
||||
val.setPlotArea(oNewVal);
|
||||
}
|
||||
else if (c_oserct_chartExChartTITLE === type)
|
||||
|
405
um
Normal file
405
um
Normal file
@ -0,0 +1,405 @@
|
||||
[1mdiff --git a/common/Charts/ChartsDrawer.js b/common/Charts/ChartsDrawer.js[m
|
||||
[1mindex a3b387aae1..74913c7411 100644[m
|
||||
[1m--- a/common/Charts/ChartsDrawer.js[m
|
||||
[1m+++ b/common/Charts/ChartsDrawer.js[m
|
||||
[36m@@ -189,7 +189,9 @@[m [mCChartsDrawer.prototype =[m
|
||||
//CHARTS[m
|
||||
if (!chartSpace.bEmptySeries) {[m
|
||||
for(var i in this.charts) {[m
|
||||
[31m- this.charts[i].recalculate();[m
|
||||
[32m+[m [32mif (this.charts.hasOwnProperty(i) && this.charts[i]) {[m
|
||||
[32m+[m [32mthis.charts[i].recalculate();[m
|
||||
[32m+[m [32m}[m
|
||||
}[m
|
||||
}[m
|
||||
[m
|
||||
[36m@@ -318,7 +320,9 @@[m [mCChartsDrawer.prototype =[m
|
||||
[m
|
||||
if (chartSpace.chart.plotArea.isForChartEx) {[m
|
||||
for (i in t.charts) {[m
|
||||
[31m- t.charts[i].draw();[m
|
||||
[32m+[m [32mif (t.charts.hasOwnProperty(i) && t.charts[i]) {[m
|
||||
[32m+[m [32mt.charts[i].draw();[m
|
||||
[32m+[m [32m}[m
|
||||
}[m
|
||||
} else {[m
|
||||
//для начала нужно отсортировать[m
|
||||
[36m@@ -616,6 +620,7 @@[m [mCChartsDrawer.prototype =[m
|
||||
[m
|
||||
if (!this.cChartSpace.bEmptySeries) {[m
|
||||
var type = obj.getObjectType();[m
|
||||
[32m+[m [32mconsole.log(type);[m
|
||||
switch (type) {[m
|
||||
case AscDFH.historyitem_type_DLbl: {[m
|
||||
pos = this._calculatePositionDlbl(obj);[m
|
||||
[36m@@ -625,7 +630,7 @@[m [mCChartsDrawer.prototype =[m
|
||||
var parentType = obj.parent ? obj.parent.getObjectType() : null;[m
|
||||
if (parentType === AscDFH.historyitem_type_Chart) {[m
|
||||
pos = this._calculatePositionTitle(obj);[m
|
||||
[31m- } else if (parentType === AscDFH.historyitem_type_ValAx || parentType === AscDFH.historyitem_type_CatAx || parentType === AscDFH.historyitem_type_DateAx) {[m
|
||||
[32m+[m [32m} else if (parentType === AscDFH.historyitem_type_ValAx || parentType === AscDFH.historyitem_type_CatAx || parentType === AscDFH.historyitem_type_DateAx || parentType === AscDFH.historyitem_type_Axis) {[m
|
||||
pos = this._calculatePositionAxisTitle(obj.parent);[m
|
||||
}[m
|
||||
break;[m
|
||||
[36m@@ -2491,13 +2496,6 @@[m [mCChartsDrawer.prototype =[m
|
||||
valAxis.max = axisProperties.val.max;[m
|
||||
valAxis.scale = axisProperties.val.scale.length > 0 ? axisProperties.val.scale : this._roundValues(this._getAxisValues2(valAxis, this.cChartSpace, false, false));[m
|
||||
[m
|
||||
[31m- // Exchange cross axes [m
|
||||
[31m- catAxis.crossAx = valAxis;[m
|
||||
[31m- valAxis.crossAx = catAxis;[m
|
||||
[31m-[m
|
||||
[31m- // Differentiate between axes [m
|
||||
[31m- catAxis.axPos = window['AscFormat'].AX_POS_B;[m
|
||||
[31m- valAxis.axPos = window['AscFormat'].AX_POS_L;[m
|
||||
},[m
|
||||
[m
|
||||
_chartExSetAxisMinAndMax: function (axis, num) {[m
|
||||
[36m@@ -4615,11 +4613,11 @@[m [mCChartsDrawer.prototype =[m
|
||||
if (!this.cChartSpace || !this.calcProp) {[m
|
||||
return null;[m
|
||||
}[m
|
||||
[31m- var pathId = this.cChartSpace.AllocPath();[m
|
||||
[31m- var path = this.cChartSpace.GetPath(pathId);[m
|
||||
[32m+[m [32mconst pathId = this.cChartSpace.AllocPath();[m
|
||||
[32m+[m [32mconst path = this.cChartSpace.GetPath(pathId);[m
|
||||
[m
|
||||
[31m- var pathH = this.calcProp.pathH;[m
|
||||
[31m- var pathW = this.calcProp.pathW;[m
|
||||
[32m+[m [32mconst pathH = this.calcProp.pathH;[m
|
||||
[32m+[m [32mconst pathW = this.calcProp.pathW;[m
|
||||
[m
|
||||
if (!isPxToMmConverted) {[m
|
||||
const pxToMm = this.calcProp.pxToMM;[m
|
||||
[36m@@ -5049,9 +5047,10 @@[m [mCChartsDrawer.prototype =[m
|
||||
[m
|
||||
getVerticalGridLines: function (axis, isCatAxis) {[m
|
||||
var gridLines, minorGridLines;[m
|
||||
[32m+[m [32mconst isForChartEx = this.cChartSpace && this.cChartSpace.chart && this.cChartSpace.chart.plotArea && this.cChartSpace.chart.plotArea.isForChartEx ? true : false;[m
|
||||
[m
|
||||
var crossBetween = this.cChartSpace.getValAxisCrossType();[m
|
||||
[31m- if(null === crossBetween && isCatAxis) {[m
|
||||
[32m+[m [32mif(null === crossBetween && (isCatAxis || isForChartEx)) {[m
|
||||
crossBetween = axis.crossAx ? axis.crossAx.crossBetween : null;[m
|
||||
}[m
|
||||
[m
|
||||
[36m@@ -5067,15 +5066,14 @@[m [mCChartsDrawer.prototype =[m
|
||||
if(!axis.majorGridlines && !axis.minorGridlines) {[m
|
||||
return;[m
|
||||
}[m
|
||||
[31m-[m
|
||||
[31m- var minorLinesCount = isCatAxis ? 2 : 5;[m
|
||||
[32m+[m [32mvar minorLinesCount = isCatAxis || isForChartEx ? 2 : 5;[m
|
||||
[m
|
||||
var posAxis = this.calcProp.chartGutter._left / this.calcProp.pxToMM;[m
|
||||
var stepX = points[1] ? Math.abs((points[1].pos - points[0].pos)) : (Math.abs(points[0].pos - posAxis) * 2);[m
|
||||
var minorStep = (stepX * this.calcProp.pxToMM) / minorLinesCount;[m
|
||||
var posX, crossDiff;[m
|
||||
[m
|
||||
[31m- if (crossBetween === AscFormat.CROSS_BETWEEN_BETWEEN && isCatAxis) {[m
|
||||
[32m+[m [32mif (crossBetween === AscFormat.CROSS_BETWEEN_BETWEEN && (isCatAxis || isForChartEx)) {[m
|
||||
crossDiff = points[1] ? Math.abs((points[1].pos - points[0].pos) / 2) : Math.abs(points[0].pos - posAxis);[m
|
||||
}[m
|
||||
[m
|
||||
[36m@@ -5083,7 +5081,7 @@[m [mCChartsDrawer.prototype =[m
|
||||
var path = this.cChartSpace.GetPath(pathId);[m
|
||||
var i;[m
|
||||
for (i = 0; i < points.length; i++) {[m
|
||||
[31m- if(isCatAxis && points[i].val < 0) {[m
|
||||
[32m+[m [32mif((isCatAxis && points[i].val < 0) && !isForChartEx) {[m
|
||||
continue;[m
|
||||
}[m
|
||||
[m
|
||||
[36m@@ -5114,7 +5112,7 @@[m [mCChartsDrawer.prototype =[m
|
||||
var pathIdMinor = this.cChartSpace.AllocPath();[m
|
||||
var pathMinor = this.cChartSpace.GetPath(pathIdMinor);[m
|
||||
for (i = 0; i < points.length; i++) {[m
|
||||
[31m- if(isCatAxis && points[i].val < 0) {[m
|
||||
[32m+[m [32mif((isCatAxis && points[i].val < 0) && !isForChartEx) {[m
|
||||
continue;[m
|
||||
}[m
|
||||
[m
|
||||
[36m@@ -7633,7 +7631,10 @@[m [mdrawHistogramChart.prototype = {[m
|
||||
// two different ways of storing information, object and array, therefore convert object into array[m
|
||||
const sections = isAggregation ? Object.values(cachedData.aggregation) : cachedData.results; [m
|
||||
if (sections) {[m
|
||||
[31m- const initialBarWidth = (this.chartProp.trueWidth)/ sections.length;[m
|
||||
[32m+[m [32m// 1 px gap for each section length[m
|
||||
[32m+[m [32mconst gapWidth = 1;[m
|
||||
[32m+[m [32m// const gapNumbers = sections.length - 1;[m
|
||||
[32m+[m [32mconst initialBarWidth = (this.chartProp.trueWidth) / sections.length;[m
|
||||
const barWidth = (initialBarWidth / (1 + coeff));[m
|
||||
const margin = (initialBarWidth - barWidth) / 2;[m
|
||||
[m
|
||||
[36m@@ -7642,11 +7643,12 @@[m [mdrawHistogramChart.prototype = {[m
|
||||
// aggregation object does not have field occurrence;[m
|
||||
const val = isAggregation ? sections[i] : sections[i].occurrence;[m
|
||||
const startY = this.cChartDrawer.getYPosition(val, valAxis, true);[m
|
||||
[32m+[m [32mconst bW = i === 0 ? barWidth : barWidth - gapWidth;[m
|
||||
if (this.chartProp && this.chartProp.pxToMM ) {[m
|
||||
const height = valStart - (startY * this.chartProp.pxToMM);[m
|
||||
[31m- this.paths[i] = this.cChartDrawer._calculateRect(start, valStart, barWidth, height);[m
|
||||
[32m+[m [32mthis.paths[i] = this.cChartDrawer._calculateRect(start, valStart, bW, height);[m
|
||||
} [m
|
||||
[31m- start += (barWidth + margin + margin);[m
|
||||
[32m+[m [32mstart += (bW + margin + margin + gapWidth);[m
|
||||
}[m
|
||||
}[m
|
||||
[m
|
||||
[36m@@ -7817,25 +7819,52 @@[m [mdrawWaterfallChart.prototype = {[m
|
||||
let valStart = this.cChartSpace.chart.plotArea.axId ? this.cChartSpace.chart.plotArea.axId[0].posY * this.chartProp.pxToMM : this.chartProp.trueHeight + this.chartProp.chartGutter._top;[m
|
||||
if (AscFormat.isRealNumber(valStart)) {[m
|
||||
const coeff = catAxis.scaling.gapWidth;[m
|
||||
[31m- const initialBarWidth = (this.chartProp.trueWidth)/ data.length;[m
|
||||
[32m+[m [32m// 1 px gap for each section length[m
|
||||
[32m+[m [32mconst gapWidth = 1;[m
|
||||
[32m+[m [32mconst gapNumbers = data.length - 1;[m
|
||||
[32m+[m [32mconst initialBarWidth = (this.chartProp.trueWidth - (gapWidth * gapNumbers))/ data.length;[m
|
||||
const barWidth = (initialBarWidth / (1 + coeff));[m
|
||||
const margin = (initialBarWidth - barWidth) / 2;[m
|
||||
[32m+[m
|
||||
let sum = 0;[m
|
||||
[31m- let start = (catStart + margin);[m
|
||||
[32m+[m [32mlet start = (catStart + margin);[m[41m [m
|
||||
for (let i = 0; i < data.length; i++) {[m
|
||||
sum += data[i].val;[m
|
||||
[31m- const startY = this.cChartDrawer.getYPosition(sum, valAxis, true) * this.chartProp.pxToMM;[m
|
||||
[32m+[m [32mconst valPos = this.cChartDrawer.getYPosition(sum, valAxis, true) * this.chartProp.pxToMM; // calc roof of the current bar[m
|
||||
[32m+[m [32mconst next = start + (barWidth + margin + gapWidth + margin); // calc end of the current barr[m
|
||||
if (this.chartProp && this.chartProp.pxToMM ) {[m
|
||||
[31m- const height = valStart - startY;[m
|
||||
[31m- this.paths[i] = this.cChartDrawer._calculateRect(start, valStart, barWidth, height);[m
|
||||
[32m+[m [32mconst height = valStart - valPos;[m
|
||||
[32m+[m [32mthis.paths[i] = [];[m
|
||||
[32m+[m [32mthis.paths[i].push(this.cChartDrawer._calculateRect(start, valStart, barWidth, height));[m
|
||||
[32m+[m [32m//dont need last connectorLine[m
|
||||
[32m+[m [32mif (i !== data.length - 1 && margin !== 0) {[m
|
||||
[32m+[m [32mthis.paths[i].push(this._calculateConnectorLine(valPos, start + barWidth, next))[m
|
||||
[32m+[m [32m}[m
|
||||
}[m
|
||||
[31m- valStart = startY; [m
|
||||
[31m- start += (barWidth + margin + margin);[m
|
||||
[32m+[m [32mvalStart = valPos; // go up in y direction[m
|
||||
[32m+[m [32mstart = next; // go right in x direction[m
|
||||
}[m
|
||||
}[m
|
||||
}[m
|
||||
},[m
|
||||
[m
|
||||
[32m+[m [32m_calculateConnectorLine: function (y, x1, x2) {[m
|
||||
[32m+[m [32mif (!this.cChartSpace || !this.chartProp) {[m
|
||||
[32m+[m [32mreturn null;[m
|
||||
[32m+[m [32m}[m
|
||||
[32m+[m [32mconst pathId = this.cChartSpace.AllocPath();[m
|
||||
[32m+[m [32mconst path = this.cChartSpace.GetPath(pathId);[m
|
||||
[32m+[m
|
||||
[32m+[m [32mconst pathH = this.chartProp.pathH;[m
|
||||
[32m+[m [32mconst pathW = this.chartProp.pathW;[m
|
||||
[32m+[m [32mconst pxToMm = this.chartProp.pxToMM;[m
|
||||
[32m+[m
|
||||
[32m+[m [32mpath.moveTo((x1 / pxToMm) * pathW, (y / pxToMm) * pathH);[m
|
||||
[32m+[m [32mpath.lnTo((x2 / pxToMm) * pathW, (y / pxToMm) * pathH);[m
|
||||
[32m+[m
|
||||
[32m+[m [32mreturn pathId;[m
|
||||
[32m+[m [32m},[m
|
||||
[32m+[m
|
||||
draw: function () {[m
|
||||
if (!this.cChartDrawer || !this.cChartDrawer.calcProp || !this.cChartDrawer.cShapeDrawer || !this.cChartDrawer.cShapeDrawer.Graphics || !this.cChartDrawer.calcProp.chartGutter) {[m
|
||||
return;[m
|
||||
[36m@@ -7888,10 +7917,12 @@[m [mdrawWaterfallChart.prototype = {[m
|
||||
let oSeries = series[0];[m
|
||||
if(oSeries) {[m
|
||||
for (let i in this.paths) {[m
|
||||
[31m- let nPtIdx = parseInt(i);[m
|
||||
[31m- let pen = oSeries.getPtPen(nPtIdx);[m
|
||||
[31m- let brush = oSeries.getPtBrush(nPtIdx);[m
|
||||
[31m- this.cChartDrawer.drawPath(this.paths[i], pen, brush);[m
|
||||
[32m+[m [32mfor (let j in this.paths[i]) {[m
|
||||
[32m+[m [32mlet nPtIdx = parseInt(i);[m
|
||||
[32m+[m [32mlet pen = (j === 0 ) ? oSeries.getPtPen(nPtIdx) : this.cChartSpace.chart.plotArea.axId[1].compiledMajorGridLines;[m
|
||||
[32m+[m [32mlet brush = oSeries.getPtBrush(nPtIdx);[m
|
||||
[32m+[m [32mthis.cChartDrawer.drawPath(this.paths[i][j], pen, brush);[m
|
||||
[32m+[m [32m}[m
|
||||
}[m
|
||||
}[m
|
||||
[m
|
||||
[1mdiff --git a/common/Drawings/Format/ChartEx.js b/common/Drawings/Format/ChartEx.js[m
|
||||
[1mindex d89caa5d80..905898aaee 100644[m
|
||||
[1m--- a/common/Drawings/Format/ChartEx.js[m
|
||||
[1m+++ b/common/Drawings/Format/ChartEx.js[m
|
||||
[36m@@ -268,6 +268,10 @@[m [mfunction (window, undefined) {[m
|
||||
this.setParentToChild(pr);[m
|
||||
};[m
|
||||
[m
|
||||
[32m+[m [32mCAxis.prototype.setAxPos = function (pos) {[m
|
||||
[32m+[m [32mthis.axPos = pos ? window['AscFormat'].AX_POS_L : window['AscFormat'].AX_POS_B;[m
|
||||
[32m+[m [32m}[m
|
||||
[32m+[m
|
||||
// AxisUnits[m
|
||||
drawingsChangesMap[AscDFH.historyitem_AxisUnits_SetUnitsLabel] = function (oClass, value) {[m
|
||||
oClass.unitsLabel = value;[m
|
||||
[36m@@ -2946,6 +2950,10 @@[m [mfunction (window, undefined) {[m
|
||||
}[m
|
||||
return null;[m
|
||||
};[m
|
||||
[32m+[m [32mCSeries.prototype.getValPts = function () {[m
|
||||
[32m+[m [32mconst numLit = this.getValLit();[m
|
||||
[32m+[m [32mreturn numLit ? numLit.pts : [];[m
|
||||
[32m+[m [32m};[m
|
||||
CSeries.prototype.getCatLit = function (type) {[m
|
||||
let oSeriesData = this.getData();[m
|
||||
if(!oSeriesData) {[m
|
||||
[1mdiff --git a/common/Drawings/Format/ChartSpace.js b/common/Drawings/Format/ChartSpace.js[m
|
||||
[1mindex 76db98a8ac..0add210264 100644[m
|
||||
[1m--- a/common/Drawings/Format/ChartSpace.js[m
|
||||
[1m+++ b/common/Drawings/Format/ChartSpace.js[m
|
||||
[36m@@ -4149,7 +4149,7 @@[m [mfunction(window, undefined) {[m
|
||||
const cachedData = this.chart.plotArea.plotAreaRegion.cachedData;[m
|
||||
const results = obtainResults(cachedData);[m
|
||||
//seria.dataLabels.visibility optional[m
|
||||
[31m- if (seria && seria.dataLabels) {[m
|
||||
[32m+[m [32mif (cachedData && seria && seria.dataLabels) {[m
|
||||
const default_lbl = new AscFormat.CDLbl();[m
|
||||
const nDefaultPosition = seria.dataLabels.pos ? seria.dataLabels.pos : AscFormat.DATA_LABEL_POS_OUT_END;[m
|
||||
default_lbl.initDefault(nDefaultPosition);[m
|
||||
[36m@@ -4185,6 +4185,18 @@[m [mfunction(window, undefined) {[m
|
||||
CChartSpace.prototype.calculateLabelsPositions = function (b_recalc_labels, b_recalc_legend) {[m
|
||||
let layout;[m
|
||||
let aDLbls = this.recalcInfo.dataLbls;[m
|
||||
[32m+[m
|
||||
[32m+[m [32m// TODO after new succefull implementation of new type remove option here[m
|
||||
[32m+[m [32mconst isForChartEx = this.chart && this.chart.plotArea && this.chart.plotArea.isForChartEx ? true : false;[m
|
||||
[32m+[m [32mconst type = this.chart && this.chart.plotArea && this.chart.plotArea.plotAreaRegion && this.chart.plotArea.plotAreaRegion.series && this.chart.plotArea.plotAreaRegion.series[0] ? this.chart.plotArea.plotAreaRegion.series[0].layoutId : null;[m
|
||||
[32m+[m [32mif (isForChartEx && type !== AscFormat.SERIES_LAYOUT_BOX_WHISKER && !type) {[m
|
||||
[32m+[m [32mreturn ;[m
|
||||
[32m+[m [32m}[m
|
||||
[32m+[m [32mif (isForChartEx && (type === AscFormat.SERIES_LAYOUT_BOX_WHISKER || type === AscFormat.SERIES_LAYOUT_FUNNEL || type === AscFormat.SERIES_LAYOUT_PARETO_LINE || type === AscFormat.SERIES_LAYOUT_REGION_MAP || type === AscFormat.SERIES_LAYOUT_SUNBURST || type === AscFormat.SERIES_LAYOUT_TREEMAP)) {[m
|
||||
[32m+[m [32mreturn ;[m
|
||||
[32m+[m [32m}[m
|
||||
[32m+[m [32m//----------------------------------[m
|
||||
[32m+[m[41m [m
|
||||
if (!aDLbls || aDLbls.length === 0) {[m
|
||||
this.calculateChartExLabelsPositions();[m
|
||||
}[m
|
||||
[36m@@ -4367,7 +4379,7 @@[m [mfunction(window, undefined) {[m
|
||||
if (!this.chart || !this.chart.plotArea) {[m
|
||||
return [];[m
|
||||
}[m
|
||||
[31m- if (oAxis.Id === this.chart.plotArea.axId[1].Id) {[m
|
||||
[32m+[m [32mif (this.chart.plotArea.axId.length > 1 && oAxis.Id === this.chart.plotArea.axId[1].Id) {[m
|
||||
// for the val axis, regularly get labels[m
|
||||
aStrings = this.getLabelsForAxis(oAxis, true);[m
|
||||
} else {[m
|
||||
[36m@@ -4736,6 +4748,7 @@[m [mfunction(window, undefined) {[m
|
||||
if(this.chart.plotArea.layout && this.chart.plotArea.layout.layoutTarget === AscFormat.LAYOUT_TARGET_INNER) {[m
|
||||
bWithoutLabels = true;[m
|
||||
}[m
|
||||
[32m+[m[41m [m
|
||||
let bCorrected = false;[m
|
||||
let fL = oRect.x, fT = oRect.y, fR = oRect.x + oRect.w, fB = oRect.y + oRect.h;[m
|
||||
const isChartEX = this.chart && this.chart.plotArea && this.chart.plotArea.isForChartEx ? true : false;[m
|
||||
[36m@@ -4754,6 +4767,9 @@[m [mfunction(window, undefined) {[m
|
||||
this.calculateAxisGrid(oCrossAxis, oRect);[m
|
||||
oCalcMap[oCrossAxis.Id] = true;[m
|
||||
}[m
|
||||
[32m+[m [32mif (!oCrossAxis) {[m
|
||||
[32m+[m [32mreturn;[m
|
||||
[32m+[m [32m}[m
|
||||
let fCrossValue;[m
|
||||
// posY seeks the zero position on the diagram[m
|
||||
let posY = null;[m
|
||||
[36m@@ -5143,6 +5159,16 @@[m [mfunction(window, undefined) {[m
|
||||
this.cachedCanvas = null;[m
|
||||
this.plotAreaRect = null;[m
|
||||
this.bEmptySeries = this.checkEmptySeries();[m
|
||||
[32m+[m [32m// TODO after new succefull implementation of new type remove option here[m
|
||||
[32m+[m [32mconst isForChartEx = this.chart && this.chart.plotArea && this.chart.plotArea.isForChartEx ? true : false;[m
|
||||
[32m+[m [32mconst type = this.chart && this.chart.plotArea && this.chart.plotArea.plotAreaRegion && this.chart.plotArea.plotAreaRegion.series && this.chart.plotArea.plotAreaRegion.series[0] ? this.chart.plotArea.plotAreaRegion.series[0].layoutId : null;[m
|
||||
[32m+[m [32mif (isForChartEx && type !== AscFormat.SERIES_LAYOUT_BOX_WHISKER && !type) {[m
|
||||
[32m+[m [32mreturn ;[m
|
||||
[32m+[m [32m}[m
|
||||
[32m+[m [32mif (isForChartEx && (type === AscFormat.SERIES_LAYOUT_BOX_WHISKER || type === AscFormat.SERIES_LAYOUT_FUNNEL || type === AscFormat.SERIES_LAYOUT_PARETO_LINE || type === AscFormat.SERIES_LAYOUT_REGION_MAP || type === AscFormat.SERIES_LAYOUT_SUNBURST || type === AscFormat.SERIES_LAYOUT_TREEMAP)) {[m
|
||||
[32m+[m [32mreturn ;[m
|
||||
[32m+[m [32m}[m
|
||||
[32m+[m [32m//----------------------------------[m
|
||||
if (this.chart && this.chart.plotArea) {[m
|
||||
var oPlotArea = this.chart.plotArea;[m
|
||||
for (i = 0; i < oPlotArea.axId.length; ++i) {[m
|
||||
[36m@@ -5771,7 +5797,8 @@[m [mfunction(window, undefined) {[m
|
||||
if (AscFormat.isRealNumber(legend.legendPos)) {[m
|
||||
legend_pos = legend.legendPos;[m
|
||||
}[m
|
||||
[31m- var aCharts = this.chart.plotArea.charts;[m
|
||||
[32m+[m [32mconst isChartEx = this.chart && this.chart.plotArea && this.chart.plotArea.isForChartEx ? true : false;[m
|
||||
[32m+[m [32mvar aCharts = isChartEx ? [this.chart.plotArea.plotAreaRegion] : this.chart.plotArea.charts;[m
|
||||
var oTypedChart;[m
|
||||
//Order series for the legend[m
|
||||
var aOrderedSeries = [];[m
|
||||
[36m@@ -5853,7 +5880,8 @@[m [mfunction(window, undefined) {[m
|
||||
entry = legend.findLegendEntryByIndex(i);[m
|
||||
if(entry && entry.bDelete)[m
|
||||
continue;[m
|
||||
[31m- arr_str_labels.push(ser.getSeriesName());[m
|
||||
[32m+[m [32mconst label = ser.getSeriesName ? ser.getSeriesName() : '';[m
|
||||
[32m+[m [32marr_str_labels.push(label);[m
|
||||
}[m
|
||||
else {[m
|
||||
entry = legend.findLegendEntryByIndex(i);[m
|
||||
[36m@@ -5884,7 +5912,7 @@[m [mfunction(window, undefined) {[m
|
||||
[m
|
||||
calc_entry.calcMarkerUnion = new AscFormat.CUnionMarker();[m
|
||||
union_marker = calc_entry.calcMarkerUnion;[m
|
||||
[31m- var pts = ser.getNumPts();[m
|
||||
[32m+[m [32mvar pts = isChartEx ? ser.getValPts() : ser.getNumPts();[m
|
||||
var nSerType = ser.getObjectType();[m
|
||||
if(nSerType === AscDFH.historyitem_type_BarSeries ||[m
|
||||
nSerType === AscDFH.historyitem_type_BubbleSeries ||[m
|
||||
[36m@@ -6084,6 +6112,9 @@[m [mfunction(window, undefined) {[m
|
||||
} else {[m
|
||||
marker_size = 0.2 * max_font_size;[m
|
||||
for (i = 0; i < calc_entryes.length; ++i) {[m
|
||||
[32m+[m [32mif (!calc_entryes[i].calcMarkerUnion || !calc_entryes[i].calcMarkerUnion.marker || !calc_entryes[i].calcMarkerUnion.marker.spPr || !calc_entryes[i].calcMarkerUnion.marker.spPr.geometry) {[m
|
||||
[32m+[m [32mcontinue;[m
|
||||
[32m+[m [32m}[m
|
||||
calc_entryes[i].calcMarkerUnion.marker.spPr.geometry.Recalculate(marker_size, marker_size);[m
|
||||
}[m
|
||||
distance_to_text = marker_size * 0.7;[m
|
||||
[36m@@ -8458,6 +8489,16 @@[m [mfunction(window, undefined) {[m
|
||||
if (this.chartObj) {[m
|
||||
this.chartObj.draw(this, graphics);[m
|
||||
}[m
|
||||
[32m+[m [32m// TODO after new succefull implementation of new type remove option here[m
|
||||
[32m+[m [32mconst isForChartEx = this.chart && this.chart.plotArea && this.chart.plotArea.isForChartEx ? true : false;[m
|
||||
[32m+[m [32mconst type = this.chart && this.chart.plotArea && this.chart.plotArea.plotAreaRegion && this.chart.plotArea.plotAreaRegion.series && this.chart.plotArea.plotAreaRegion.series[0] ? this.chart.plotArea.plotAreaRegion.series[0].layoutId : null;[m
|
||||
[32m+[m [32mif (isForChartEx && type !== AscFormat.SERIES_LAYOUT_BOX_WHISKER && !type) {[m
|
||||
[32m+[m [32mreturn ;[m
|
||||
[32m+[m [32m}[m
|
||||
[32m+[m [32mif (isForChartEx && (type === AscFormat.SERIES_LAYOUT_BOX_WHISKER || type === AscFormat.SERIES_LAYOUT_FUNNEL || type === AscFormat.SERIES_LAYOUT_PARETO_LINE || type === AscFormat.SERIES_LAYOUT_REGION_MAP || type === AscFormat.SERIES_LAYOUT_SUNBURST || type === AscFormat.SERIES_LAYOUT_TREEMAP)) {[m
|
||||
[32m+[m [32mreturn ;[m
|
||||
[32m+[m [32m}[m
|
||||
[32m+[m [32m//----------------------------------[m
|
||||
if (this.chart && !this.bEmptySeries) {[m
|
||||
if (this.chart.plotArea) {[m
|
||||
// var oChartSize = this.getChartSizes();[m
|
||||
[1mdiff --git a/common/SerializeChart.js b/common/SerializeChart.js[m
|
||||
[1mindex 56ddebb127..c757e73eb6 100644[m
|
||||
[1m--- a/common/SerializeChart.js[m
|
||||
[1m+++ b/common/SerializeChart.js[m
|
||||
[36m@@ -13507,6 +13507,17 @@[m [mBinaryChartReader.prototype.ReadCT_ChartEx = function (type, length, val) {[m
|
||||
res = this.bcr.Read1(length, function (t, l) {[m
|
||||
return oThis.ReadCT_ChartExPlotArea(t, l, oNewVal);[m
|
||||
});[m
|
||||
[32m+[m[32m if (oNewVal && oNewVal.axId && Array.isArray(oNewVal.axId)) {[m
|
||||
[32m+[m[32m for (let i = 0; i < oNewVal.axId.length; i++) {[m
|
||||
[32m+[m[32m const axis = oNewVal.axId[i];[m
|
||||
[32m+[m[32m axis.setAxPos(i);[m
|
||||
[32m+[m[32m }[m
|
||||
[32m+[m[32m if (oNewVal.axId.length === 2) {[m
|
||||
[32m+[m[32m oNewVal.axId[0].crossAx = oNewVal.axId[1];[m
|
||||
[32m+[m[32m oNewVal.axId[1].crossAx = oNewVal.axId[0];[m
|
||||
[32m+[m[32m oNewVal.axId[1].crossBetween = 0;[m
|
||||
[32m+[m[32m }[m
|
||||
[32m+[m[32m }[m
|
||||
val.setPlotArea(oNewVal);[m
|
||||
}[m
|
||||
else if (c_oserct_chartExChartTITLE === type)[m
|
Loading…
x
Reference in New Issue
Block a user