Commit 0b222015 authored by Sergey Luzyanin's avatar Sergey Luzyanin

Для 3-d bar диаграмм crossBetween всегда CROSS_BETWEEN_MID_CAT

parent 1cdb477b
...@@ -630,6 +630,7 @@ CChartsDrawer.prototype = ...@@ -630,6 +630,7 @@ CChartsDrawer.prototype =
//catAx //catAx
var crossBetween = chartSpace.getValAxisCrossType();
if(chartSpace.chart.plotArea.catAx /*&& chartSpace.chart.plotArea.catAx.labels*/) if(chartSpace.chart.plotArea.catAx /*&& chartSpace.chart.plotArea.catAx.labels*/)
{ {
var catAx = chartSpace.chart.plotArea.catAx; var catAx = chartSpace.chart.plotArea.catAx;
...@@ -654,7 +655,7 @@ CChartsDrawer.prototype = ...@@ -654,7 +655,7 @@ CChartsDrawer.prototype =
if(catAx.scaling.orientation == ORIENTATION_MIN_MAX) if(catAx.scaling.orientation == ORIENTATION_MIN_MAX)
{ {
if(valAx.crossBetween == AscFormat.CROSS_BETWEEN_BETWEEN) if(crossBetween == AscFormat.CROSS_BETWEEN_BETWEEN)
curBetween = diffPoints / 2; curBetween = diffPoints / 2;
calculateTop = catAx.yPoints[catAx.yPoints.length - 1].pos - curBetween; calculateTop = catAx.yPoints[catAx.yPoints.length - 1].pos - curBetween;
...@@ -662,7 +663,7 @@ CChartsDrawer.prototype = ...@@ -662,7 +663,7 @@ CChartsDrawer.prototype =
} }
else else
{ {
if(valAx.crossBetween == AscFormat.CROSS_BETWEEN_BETWEEN) if(crossBetween == AscFormat.CROSS_BETWEEN_BETWEEN)
curBetween = diffPoints / 2; curBetween = diffPoints / 2;
calculateTop = catAx.yPoints[0].pos - curBetween; calculateTop = catAx.yPoints[0].pos - curBetween;
...@@ -675,7 +676,7 @@ CChartsDrawer.prototype = ...@@ -675,7 +676,7 @@ CChartsDrawer.prototype =
if(catAx.scaling.orientation == ORIENTATION_MIN_MAX) if(catAx.scaling.orientation == ORIENTATION_MIN_MAX)
{ {
if(valAx.crossBetween == AscFormat.CROSS_BETWEEN_BETWEEN) if(crossBetween == AscFormat.CROSS_BETWEEN_BETWEEN)
curBetween = diffPoints / 2; curBetween = diffPoints / 2;
calculateLeft = catAx.xPoints[0].pos - curBetween; calculateLeft = catAx.xPoints[0].pos - curBetween;
...@@ -683,7 +684,7 @@ CChartsDrawer.prototype = ...@@ -683,7 +684,7 @@ CChartsDrawer.prototype =
} }
else else
{ {
if(valAx.crossBetween == AscFormat.CROSS_BETWEEN_BETWEEN) if(crossBetween == AscFormat.CROSS_BETWEEN_BETWEEN)
curBetween = diffPoints / 2; curBetween = diffPoints / 2;
calculateLeft = catAx.xPoints[catAx.xPoints.length - 1].pos - curBetween; calculateLeft = catAx.xPoints[catAx.xPoints.length - 1].pos - curBetween;
...@@ -742,19 +743,20 @@ CChartsDrawer.prototype = ...@@ -742,19 +743,20 @@ CChartsDrawer.prototype =
var orientationValAx = valAx && valAx.scaling.orientation === ORIENTATION_MIN_MAX ? true : false; var orientationValAx = valAx && valAx.scaling.orientation === ORIENTATION_MIN_MAX ? true : false;
var orientationCatAx = catAx && catAx.scaling.orientation === ORIENTATION_MIN_MAX ? true : false; var orientationCatAx = catAx && catAx.scaling.orientation === ORIENTATION_MIN_MAX ? true : false;
var crossBetween = chartSpace.getValAxisCrossType();
if(isHBar === 'HBar' && catAx && valAx && catAx.yPoints && valAx.xPoints) if(isHBar === 'HBar' && catAx && valAx && catAx.yPoints && valAx.xPoints)
{ {
if(orientationCatAx) if(orientationCatAx)
{ {
if(valAx.crossBetween == AscFormat.CROSS_BETWEEN_BETWEEN) if(crossBetween == AscFormat.CROSS_BETWEEN_BETWEEN)
leftDownPointY = catAx.yPoints[0].pos + Math.abs((catAx.interval) / 2); leftDownPointY = catAx.yPoints[0].pos + Math.abs((catAx.interval) / 2);
else else
leftDownPointY = catAx.yPoints[0].pos; leftDownPointY = catAx.yPoints[0].pos;
} }
else else
{ {
if(valAx.crossBetween == AscFormat.CROSS_BETWEEN_BETWEEN) if(crossBetween == AscFormat.CROSS_BETWEEN_BETWEEN)
leftDownPointY = catAx.yPoints[catAx.yPoints.length - 1].pos + Math.abs((catAx.interval) / 2); leftDownPointY = catAx.yPoints[catAx.yPoints.length - 1].pos + Math.abs((catAx.interval) / 2);
else else
leftDownPointY = catAx.yPoints[catAx.yPoints.length - 1].pos; leftDownPointY = catAx.yPoints[catAx.yPoints.length - 1].pos;
...@@ -770,14 +772,14 @@ CChartsDrawer.prototype = ...@@ -770,14 +772,14 @@ CChartsDrawer.prototype =
if(orientationCatAx) if(orientationCatAx)
{ {
if(valAx.crossBetween == AscFormat.CROSS_BETWEEN_BETWEEN) if(crossBetween == AscFormat.CROSS_BETWEEN_BETWEEN)
rightUpPointY = catAx.yPoints[catAx.yPoints.length - 1].pos - Math.abs((catAx.interval) / 2); rightUpPointY = catAx.yPoints[catAx.yPoints.length - 1].pos - Math.abs((catAx.interval) / 2);
else else
rightUpPointY = catAx.yPoints[catAx.yPoints.length - 1].pos; rightUpPointY = catAx.yPoints[catAx.yPoints.length - 1].pos;
} }
else else
{ {
if(valAx.crossBetween == AscFormat.CROSS_BETWEEN_BETWEEN) if(crossBetween == AscFormat.CROSS_BETWEEN_BETWEEN)
rightUpPointY = catAx.yPoints[0].pos - Math.abs((catAx.interval) / 2); rightUpPointY = catAx.yPoints[0].pos - Math.abs((catAx.interval) / 2);
else else
rightUpPointY = catAx.yPoints[0].pos; rightUpPointY = catAx.yPoints[0].pos;
...@@ -860,7 +862,7 @@ CChartsDrawer.prototype = ...@@ -860,7 +862,7 @@ CChartsDrawer.prototype =
} }
else else
{ {
if(valAx.crossBetween == AscFormat.CROSS_BETWEEN_BETWEEN) if(crossBetween == AscFormat.CROSS_BETWEEN_BETWEEN)
leftDownPointX = catAx.xPoints[0].pos - (catAx.interval) / 2; leftDownPointX = catAx.xPoints[0].pos - (catAx.interval) / 2;
else else
leftDownPointX = catAx.xPoints[0].pos; leftDownPointX = catAx.xPoints[0].pos;
...@@ -878,7 +880,7 @@ CChartsDrawer.prototype = ...@@ -878,7 +880,7 @@ CChartsDrawer.prototype =
} }
else else
{ {
if(valAx.crossBetween == AscFormat.CROSS_BETWEEN_BETWEEN) if(crossBetween == AscFormat.CROSS_BETWEEN_BETWEEN)
rightUpPointX = catAx.xPoints[catAx.xPoints.length - 1].pos + (catAx.interval) / 2; rightUpPointX = catAx.xPoints[catAx.xPoints.length - 1].pos + (catAx.interval) / 2;
else else
rightUpPointX = catAx.xPoints[catAx.xPoints.length - 1].pos; rightUpPointX = catAx.xPoints[catAx.xPoints.length - 1].pos;
...@@ -2712,7 +2714,7 @@ drawBarChart.prototype = ...@@ -2712,7 +2714,7 @@ drawBarChart.prototype =
var overlap = this.cChartSpace.chart.plotArea.chart.overlap ? this.cChartSpace.chart.plotArea.chart.overlap : defaultOverlap; var overlap = this.cChartSpace.chart.plotArea.chart.overlap ? this.cChartSpace.chart.plotArea.chart.overlap : defaultOverlap;
var numCache = this.chartProp.series[0].val.numRef ? this.chartProp.series[0].val.numRef.numCache : this.chartProp.series[0].val.numLit; var numCache = this.chartProp.series[0].val.numRef ? this.chartProp.series[0].val.numRef.numCache : this.chartProp.series[0].val.numLit;
var width = widthGraph / this.chartProp.ptCount; var width = widthGraph / this.chartProp.ptCount;
if(this.cChartSpace.chart.plotArea.catAx.crossAx.crossBetween) if(this.cChartSpace.getValAxisCrossType())
width = widthGraph / (numCache.ptCount - 1); width = widthGraph / (numCache.ptCount - 1);
var gapWidth = this.cChartSpace.chart.plotArea.chart.gapWidth ? this.cChartSpace.chart.plotArea.chart.gapWidth : 150; var gapWidth = this.cChartSpace.chart.plotArea.chart.gapWidth ? this.cChartSpace.chart.plotArea.chart.gapWidth : 150;
...@@ -9193,7 +9195,7 @@ gridChart.prototype = ...@@ -9193,7 +9195,7 @@ gridChart.prototype =
var yCenter = (this.chartProp.chartGutter._top + trueHeight/2) / this.chartProp.pxToMM; var yCenter = (this.chartProp.chartGutter._top + trueHeight/2) / this.chartProp.pxToMM;
var yPoints = this.cChartSpace.chart.plotArea.valAx.yPoints ? this.cChartSpace.chart.plotArea.valAx.yPoints : this.cChartSpace.chart.plotArea.catAx.yPoints; var yPoints = this.cChartSpace.chart.plotArea.valAx.yPoints ? this.cChartSpace.chart.plotArea.valAx.yPoints : this.cChartSpace.chart.plotArea.catAx.yPoints;
var crossBetween = this.cChartSpace.chart.plotArea.valAx.crossBetween; var crossBetween = this.cChartSpace.getValAxisCrossType();
var crossDiff; var crossDiff;
if(crossBetween == AscFormat.CROSS_BETWEEN_BETWEEN && this.cChartSpace.chart.plotArea.valAx.posY) if(crossBetween == AscFormat.CROSS_BETWEEN_BETWEEN && this.cChartSpace.chart.plotArea.valAx.posY)
crossDiff = yPoints[1] ? Math.abs((yPoints[1].pos - yPoints[0].pos) / 2) : Math.abs(yPoints[0].pos - this.cChartSpace.chart.plotArea.valAx.posY); crossDiff = yPoints[1] ? Math.abs((yPoints[1].pos - yPoints[0].pos) / 2) : Math.abs(yPoints[0].pos - this.cChartSpace.chart.plotArea.valAx.posY);
...@@ -9329,7 +9331,7 @@ gridChart.prototype = ...@@ -9329,7 +9331,7 @@ gridChart.prototype =
if(!xPoints) if(!xPoints)
return; return;
var crossBetween = this.cChartSpace.chart.plotArea.valAx.crossBetween; var crossBetween = this.cChartSpace.getValAxisCrossType();
var crossDiff; var crossDiff;
if(crossBetween == AscFormat.CROSS_BETWEEN_BETWEEN && this.cChartSpace.chart.plotArea.valAx.posX && this.chartProp.type != "HBar") if(crossBetween == AscFormat.CROSS_BETWEEN_BETWEEN && this.cChartSpace.chart.plotArea.valAx.posX && this.chartProp.type != "HBar")
crossDiff = xPoints[1] ? Math.abs((xPoints[1].pos - xPoints[0].pos) / 2) : Math.abs(xPoints[0].pos - this.cChartSpace.chart.plotArea.valAx.posX); crossDiff = xPoints[1] ? Math.abs((xPoints[1].pos - xPoints[0].pos) / 2) : Math.abs(xPoints[0].pos - this.cChartSpace.chart.plotArea.valAx.posX);
...@@ -9788,7 +9790,7 @@ catAxisChart.prototype = ...@@ -9788,7 +9790,7 @@ catAxisChart.prototype =
//сдвиг, если положение оси - между делениями //сдвиг, если положение оси - между делениями
var firstDiff = 0, posYtemp; var firstDiff = 0, posYtemp;
if(this.cChartSpace.chart.plotArea.valAx.crossBetween == AscFormat.CROSS_BETWEEN_BETWEEN) if(this.cChartSpace.getValAxisCrossType() == AscFormat.CROSS_BETWEEN_BETWEEN)
firstDiff = yPoints[1] ? Math.abs(yPoints[1].pos - yPoints[0].pos) : Math.abs(yPoints[0].pos - this.cChartSpace.chart.plotArea.valAx.posY) * 2; firstDiff = yPoints[1] ? Math.abs(yPoints[1].pos - yPoints[0].pos) : Math.abs(yPoints[0].pos - this.cChartSpace.chart.plotArea.valAx.posY) * 2;
var tickMarkSkip = this.cChartSpace.chart.plotArea.catAx.tickMarkSkip ? this.cChartSpace.chart.plotArea.catAx.tickMarkSkip : 1; var tickMarkSkip = this.cChartSpace.chart.plotArea.catAx.tickMarkSkip ? this.cChartSpace.chart.plotArea.catAx.tickMarkSkip : 1;
...@@ -9852,7 +9854,7 @@ catAxisChart.prototype = ...@@ -9852,7 +9854,7 @@ catAxisChart.prototype =
var posX, posMinorX, k; var posX, posMinorX, k;
var firstDiff = 0, posXtemp; var firstDiff = 0, posXtemp;
if(this.cChartSpace.chart.plotArea.valAx.crossBetween == AscFormat.CROSS_BETWEEN_BETWEEN && this.chartProp.type != "Scatter") if(this.cChartSpace.getValAxisCrossType() == AscFormat.CROSS_BETWEEN_BETWEEN && this.chartProp.type != "Scatter")
{ {
if(xPoints[1]) if(xPoints[1])
firstDiff = Math.abs(xPoints[1].pos - xPoints[0].pos); firstDiff = Math.abs(xPoints[1].pos - xPoints[0].pos);
......
...@@ -3104,6 +3104,40 @@ CChartSpace.prototype.getNeedReflect = function() ...@@ -3104,6 +3104,40 @@ CChartSpace.prototype.getNeedReflect = function()
return this.chartObj.calculatePositionLabelsCatAxFromAngle(this); return this.chartObj.calculatePositionLabelsCatAxFromAngle(this);
}; };
CChartSpace.prototype.getValAxisCrossType = function()
{
if(this.chart && this.chart.plotArea && this.chart.plotArea.chart){
var chartType = this.chart.plotArea.chart.getObjectType();
var valAx = this.chart.plotArea.valAx;
if(chartType === AscDFH.historyitem_type_ScatterChart){
return null;
}
else if(chartType !== AscDFH.historyitem_type_BarChart && (chartType !== AscDFH.historyitem_type_PieChart && chartType !== AscDFH.historyitem_type_DoughnutChart)
|| (chartType === AscDFH.historyitem_type_BarChart && this.chart.plotArea.chart.barDir !== AscFormat.BAR_DIR_BAR)){
if(valAx){
if(AscFormat.CChartsDrawer.prototype._isSwitchCurrent3DChart(this)){
if(chartType === AscDFH.historyitem_type_AreaChart ){
return AscFormat.isRealNumber(valAx.crossBetween) ? valAx.crossBetween : AscFormat.CROSS_BETWEEN_MID_CAT;
}
else if(chartType === AscDFH.historyitem_type_LineChart){
return AscFormat.isRealNumber(valAx.crossBetween) ? valAx.crossBetween : AscFormat.CROSS_BETWEEN_BETWEEN;
}
else{
return AscFormat.CROSS_BETWEEN_BETWEEN;
}
}
else{
return AscFormat.isRealNumber(valAx.crossBetween) ? valAx.crossBetween : (chartType === AscDFH.historyitem_type_AreaChart ? AscFormat.CROSS_BETWEEN_MID_CAT : AscFormat.CROSS_BETWEEN_BETWEEN);
}
}
}
else if(chartType === AscDFH.historyitem_type_BarChart && this.chart.plotArea.chart.barDir === AscFormat.BAR_DIR_BAR){
return AscFormat.isRealNumber(valAx.crossBetween) && !AscFormat.CChartsDrawer.prototype._isSwitchCurrent3DChart(this) ? valAx.crossBetween : AscFormat.CROSS_BETWEEN_BETWEEN;
}
}
return null;
};
CChartSpace.prototype.recalculateAxis = function() CChartSpace.prototype.recalculateAxis = function()
{ {
if(this.chart && this.chart.plotArea && this.chart.plotArea.chart) if(this.chart && this.chart.plotArea && this.chart.plotArea.chart)
...@@ -4134,8 +4168,10 @@ CChartSpace.prototype.recalculateAxis = function() ...@@ -4134,8 +4168,10 @@ CChartSpace.prototype.recalculateAxis = function()
{ {
labels_pos = c_oAscTickLabelsPos.TICK_LABEL_POSITION_NONE; labels_pos = c_oAscTickLabelsPos.TICK_LABEL_POSITION_NONE;
} }
var cross_between = AscFormat.isRealNumber(val_ax.crossBetween) ? val_ax.crossBetween : (chart_type === AscDFH.historyitem_type_AreaChart ? AscFormat.CROSS_BETWEEN_MID_CAT : AscFormat.CROSS_BETWEEN_BETWEEN) ; var cross_between = this.getValAxisCrossType();
if(cross_between === null){
cross_between = AscFormat.CROSS_BETWEEN_BETWEEN;
}
var left_val_ax_labels_align = true;//приленгание подписей оси значений к левому краю. var left_val_ax_labels_align = true;//приленгание подписей оси значений к левому краю.
var intervals_count = cross_between === AscFormat.CROSS_BETWEEN_MID_CAT ? string_pts.length - 1 : string_pts.length; var intervals_count = cross_between === AscFormat.CROSS_BETWEEN_MID_CAT ? string_pts.length - 1 : string_pts.length;
...@@ -5314,7 +5350,11 @@ CChartSpace.prototype.recalculateAxis = function() ...@@ -5314,7 +5350,11 @@ CChartSpace.prototype.recalculateAxis = function()
var cat_ax_orientation = cat_ax.scaling && AscFormat.isRealNumber(cat_ax.scaling.orientation) ? cat_ax.scaling.orientation : AscFormat.ORIENTATION_MIN_MAX; var cat_ax_orientation = cat_ax.scaling && AscFormat.isRealNumber(cat_ax.scaling.orientation) ? cat_ax.scaling.orientation : AscFormat.ORIENTATION_MIN_MAX;
var labels_pos = val_ax.tickLblPos; var labels_pos = val_ax.tickLblPos;
var cross_between = AscFormat.isRealNumber(val_ax.crossBetween) ? val_ax.crossBetween : AscFormat.CROSS_BETWEEN_BETWEEN; var cross_between = this.getValAxisCrossType();
if(cross_between === null){
cross_between = AscFormat.CROSS_BETWEEN_BETWEEN;
}
var bottom_val_ax_labels_align = true;//приленгание подписей оси значений к левому краю. var bottom_val_ax_labels_align = true;//приленгание подписей оси значений к левому краю.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment