Commit 73f3215f authored by Sergey.Luzyanin's avatar Sergey.Luzyanin Committed by Alexander.Trofimov

настройки для подписей данных и легенда для Pie и Doughnut

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@54852 954022d7-b5bf-4e40-9824-e11837661b57
parent 2ba532bb
...@@ -1475,7 +1475,39 @@ DrawingObjectsController.prototype = ...@@ -1475,7 +1475,39 @@ DrawingObjectsController.prototype =
var need_groupping, need_num_fmt, need_bar_dir; var need_groupping, need_num_fmt, need_bar_dir;
var val_axis, new_chart_type, object_type, axis_obj ; var val_axis, new_chart_type, object_type, axis_obj ;
var axis_by_types; var axis_by_types;
var val_ax, cat_ax;
object_type = chart_type.getObjectType(); object_type = chart_type.getObjectType();
var checkSwapAxis = function(plotArea, chartType, newChartType)
{
if(chartType.getAxisByTypes )
{
var axis_by_types = chartType.getAxisByTypes(), cat_ax, val_ax;
if(axis_by_types.catAx.length > 0 && axis_by_types.valAx.length > 0)
{
cat_ax = axis_by_types.catAx[0];
val_ax = axis_by_types.valAx[0];
}
}
if(!val_ax || !cat_ax)
{
var axis_obj = CreateDefaultAxises(need_num_fmt);
cat_ax = axis_obj.catAx;
val_ax = axis_obj.valAx;
}
newChartType.addAxId(cat_ax);
newChartType.addAxId(val_ax);
plotArea.addAxis(cat_ax);
plotArea.addAxis(val_ax);
};
var replaceChart = function(plotArea, chartType, newChartType)
{
plotArea.addChart(newChartType, 0);
plotArea.removeCharts(1, plotArea.charts.length - 1);
newChartType.setFromOtherChart(chartType);
};
switch(type) switch(type)
{ {
case c_oAscChartTypeSettings.barNormal : case c_oAscChartTypeSettings.barNormal :
...@@ -1535,35 +1567,12 @@ DrawingObjectsController.prototype = ...@@ -1535,35 +1567,12 @@ DrawingObjectsController.prototype =
else else
{ {
new_chart_type = new CBarChart(); new_chart_type = new CBarChart();
new_chart_type.setGapWidth(150); replaceChart(plot_area, chart_type, new_chart_type);
plot_area.addChart(new_chart_type, 0); checkSwapAxis(plot_area, chart_type, new_chart_type);
plot_area.removeCharts(1, plot_area.charts.length - 1);
var series = chart_type.series;
var new_ser, ser;
switch (object_type)
{
case historyitem_type_PieChart:
case historyitem_type_AreaChart:
case historyitem_type_LineChart:
{
new_chart_type.setFromOtherChart(chart_type);
if(object_type === historyitem_type_PieChart)
{
axis_obj = CreateDefaultAxises(need_num_fmt);
plot_area.addAxis(axis_obj.valAx);
plot_area.addAxis(axis_obj.catAx);
new_chart_type.addAxId(axis_obj.valAx);
new_chart_type.addAxId(axis_obj.catAx);
}
break;
}
case historyitem_type_ScatterChart:
{
break;
}
}
new_chart_type.setGrouping(need_groupping); new_chart_type.setGrouping(need_groupping);
new_chart_type.setBarDir(need_bar_dir); new_chart_type.setBarDir(need_bar_dir);
new_chart_type.setGapWidth(150);
axis_by_types = new_chart_type.getAxisByTypes(); axis_by_types = new_chart_type.getAxisByTypes();
val_axis = axis_by_types.valAx; val_axis = axis_by_types.valAx;
for(i = 0; i < val_axis.length; ++i) for(i = 0; i < val_axis.length; ++i)
...@@ -1573,7 +1582,6 @@ DrawingObjectsController.prototype = ...@@ -1573,7 +1582,6 @@ DrawingObjectsController.prototype =
if(need_bar_dir = BAR_DIR_BAR) if(need_bar_dir = BAR_DIR_BAR)
val_axis[i].setAxPos(AX_POS_B); val_axis[i].setAxPos(AX_POS_B);
} }
if(need_bar_dir = BAR_DIR_BAR) if(need_bar_dir = BAR_DIR_BAR)
{ {
for(i = 0; i < axis_by_types.catAx.length; ++i) for(i = 0; i < axis_by_types.catAx.length; ++i)
...@@ -1589,7 +1597,6 @@ DrawingObjectsController.prototype = ...@@ -1589,7 +1597,6 @@ DrawingObjectsController.prototype =
case c_oAscChartTypeSettings.lineStackedMarker : case c_oAscChartTypeSettings.lineStackedMarker :
case c_oAscChartTypeSettings.lineStackedPerMarker: case c_oAscChartTypeSettings.lineStackedPerMarker:
{ {
if(type === c_oAscChartTypeSettings.lineNormal || type === c_oAscChartTypeSettings.lineNormalMarker) if(type === c_oAscChartTypeSettings.lineNormal || type === c_oAscChartTypeSettings.lineNormalMarker)
need_groupping = GROUPING_STANDARD; need_groupping = GROUPING_STANDARD;
else if(type === c_oAscChartTypeSettings.lineStacked || type === c_oAscChartTypeSettings.lineStackedMarker) else if(type === c_oAscChartTypeSettings.lineStacked || type === c_oAscChartTypeSettings.lineStackedMarker)
...@@ -1605,7 +1612,6 @@ DrawingObjectsController.prototype = ...@@ -1605,7 +1612,6 @@ DrawingObjectsController.prototype =
var b_marker = type === c_oAscChartTypeSettings.lineNormalMarker|| type === c_oAscChartTypeSettings.lineStackedMarker || type === c_oAscChartTypeSettings.lineStackedPerMarker; var b_marker = type === c_oAscChartTypeSettings.lineNormalMarker|| type === c_oAscChartTypeSettings.lineStackedMarker || type === c_oAscChartTypeSettings.lineStackedPerMarker;
if(chart_type.getObjectType() === historyitem_type_LineChart) if(chart_type.getObjectType() === historyitem_type_LineChart)
{ {
if(chart_type.grouping !== need_groupping) if(chart_type.grouping !== need_groupping)
...@@ -1623,40 +1629,14 @@ DrawingObjectsController.prototype = ...@@ -1623,40 +1629,14 @@ DrawingObjectsController.prototype =
else else
{ {
new_chart_type = new CLineChart(); new_chart_type = new CLineChart();
plot_area.addChart(new_chart_type, 0); replaceChart(plot_area, chart_type, new_chart_type);
plot_area.removeCharts(1, plot_area.charts.length - 1); checkSwapAxis(plot_area, chart_type, new_chart_type);
switch (object_type)
{
case historyitem_type_PieChart:
case historyitem_type_AreaChart:
case historyitem_type_BarChart:
{
new_chart_type.setFromOtherChart(chart_type);
if(object_type === historyitem_type_PieChart)
{
axis_obj = CreateDefaultAxises(need_num_fmt);
new_chart_type.addAxId(axis_obj.valAx);
new_chart_type.addAxId(axis_obj.catAx);
}
break;
}
/*case historyitem_type_AreaChart:
case historyitem_type_LineChart:
case historyitem_type_OfPieChart:
case historyitem_type_RadarChart:
case historyitem_type_StockChart:
case historyitem_type_BubbleChart:
case historyitem_type_ScatterChart:
case historyitem_type_SurfaceChart:
case historyitem_type_DoughnutChart:*/
}
val_axis = new_chart_type.getAxisByTypes().valAx; val_axis = new_chart_type.getAxisByTypes().valAx;
for(i = 0; i < val_axis.length; ++i) for(i = 0; i < val_axis.length; ++i)
{ {
if(val_axis[i].numFmt.formatCode !== need_num_fmt) if(val_axis[i].numFmt.formatCode !== need_num_fmt)
val_axis[i].numFmt.setFormatCode(need_num_fmt); val_axis[i].numFmt.setFormatCode(need_num_fmt);
} }
new_chart_type.setMarker(b_marker); new_chart_type.setMarker(b_marker);
new_chart_type.setGrouping(need_groupping); new_chart_type.setGrouping(need_groupping);
} }
...@@ -1667,29 +1647,19 @@ DrawingObjectsController.prototype = ...@@ -1667,29 +1647,19 @@ DrawingObjectsController.prototype =
if(chart_type.getObjectType() !== historyitem_type_PieChart) if(chart_type.getObjectType() !== historyitem_type_PieChart)
{ {
new_chart_type = new CPieChart(); new_chart_type = new CPieChart();
plot_area.addChart(new_chart_type, 0); replaceChart(plot_area, chart_type, new_chart_type)
plot_area.removeCharts(1, plot_area.charts.length - 1); new_chart_type.setVaryColors(true);
switch (object_type) }
{ break;
case historyitem_type_BarChart: }
case historyitem_type_AreaChart: case c_oAscChartTypeSettings.doughnut:
case historyitem_type_LineChart: {
case historyitem_type_BarChart: if(chart_type.getObjectType() !== historyitem_type_DoughnutChart)
{ {
new_chart_type.setFromOtherChart(chart_type); new_chart_type = new CDoughnutChart();
break; replaceChart(plot_area, chart_type, new_chart_type)
}
/*case historyitem_type_AreaChart:
case historyitem_type_LineChart:
case historyitem_type_OfPieChart:
case historyitem_type_RadarChart:
case historyitem_type_StockChart:
case historyitem_type_BubbleChart:
case historyitem_type_ScatterChart:
case historyitem_type_SurfaceChart:
case historyitem_type_DoughnutChart:*/
}
new_chart_type.setVaryColors(true); new_chart_type.setVaryColors(true);
new_chart_type.setHoleSize(50);
} }
break; break;
} }
...@@ -1724,24 +1694,9 @@ DrawingObjectsController.prototype = ...@@ -1724,24 +1694,9 @@ DrawingObjectsController.prototype =
else else
{ {
new_chart_type = new CAreaChart(); new_chart_type = new CAreaChart();
plot_area.addChart(new_chart_type, 0); replaceChart(plot_area, chart_type, new_chart_type);
plot_area.removeCharts(1, plot_area.charts.length - 1); checkSwapAxis(plot_area, chart_type, new_chart_type);
switch (object_type)
{
case historyitem_type_PieChart:
case historyitem_type_LineChart:
case historyitem_type_BarChart:
{
new_chart_type.setFromOtherChart(chart_type);
if(object_type === historyitem_type_PieChart)
{
axis_obj = CreateDefaultAxises(need_num_fmt);
new_chart_type.addAxId(axis_obj.valAx);
new_chart_type.addAxId(axis_obj.catAx);
}
break;
}
}
val_axis = new_chart_type.getAxisByTypes().valAx; val_axis = new_chart_type.getAxisByTypes().valAx;
for(i = 0; i < val_axis.length; ++i) for(i = 0; i < val_axis.length; ++i)
{ {
...@@ -1757,7 +1712,8 @@ DrawingObjectsController.prototype = ...@@ -1757,7 +1712,8 @@ DrawingObjectsController.prototype =
case c_oAscChartTypeSettings.scatterSmooth: case c_oAscChartTypeSettings.scatterSmooth:
{ {
if(chart_type.getObjectType() === historyitem_type_ScatterChart) if(chart_type.getObjectType() === historyitem_type_ScatterChart)
{} {
}
else else
{ {
new_chart_type = new CScatterChart(); new_chart_type = new CScatterChart();
...@@ -1767,17 +1723,35 @@ DrawingObjectsController.prototype = ...@@ -1767,17 +1723,35 @@ DrawingObjectsController.prototype =
axis_obj = CreateScatterAxis(); //cat - 0, val - 1 axis_obj = CreateScatterAxis(); //cat - 0, val - 1
new_chart_type.addAxId(axis_obj.catAx); new_chart_type.addAxId(axis_obj.catAx);
new_chart_type.addAxId(axis_obj.valAx); new_chart_type.addAxId(axis_obj.valAx);
/*val_axis = new_chart_type.getAxisByTypes().valAx;
for(i = 0; i < val_axis.length; ++i)
{
if(val_axis[i].numFmt.formatCode !== need_num_fmt)
val_axis[i].numFmt.setFormatCode(need_num_fmt);
}
new_chart_type.setGrouping(need_groupping); */
} }
break; break;
} }
} }
chart_type = plot_area.charts[0];
//подписи данных
if(typeof chart_type.setDLbls === "function")
{
var data_lbls;
var checkDataLabels = function(chartType)
{
chartType.removeDataLabels();
if(!chartType.dLbls)
chartType.setDLbls(new CDLbls());
return chartType.dLbls;
}
if(isRealBool(chartSettings.showCatName))
checkDataLabels(chart_type).setShowCatName(chartSettings.showCatName);
if(isRealBool(chartSettings.showSerName))
checkDataLabels(chart_type).setShowSerName(chartSettings.showSerName);
if(isRealBool(chartSettings.showVal))
checkDataLabels(chart_type).setShowVal(chartSettings.showVal);
if(typeof chartSettings.separator === "string" && chartSettings.separator.length > 0)
checkDataLabels(chart_type).setSeparator(chartSettings.separator);
}
chart_space.addToRecalculate(); //TODO chart_space.addToRecalculate(); //TODO
chart_space.setRecalculateInfo();//TODO: обязательно переделать chart_space.setRecalculateInfo();//TODO: обязательно переделать
this.startRecalculate(); this.startRecalculate();
......
...@@ -51,6 +51,14 @@ CPlotArea.prototype = ...@@ -51,6 +51,14 @@ CPlotArea.prototype =
addAxis: function(axis) addAxis: function(axis)
{ {
//сначала проверим не лежит ли ось уже в plotArea
var i;
for(i = 0; i < this.axId.length; ++i)
{
if(this.axId[i] === axis)
return;
}
//если такой оси нет, можно добавлять.
History.Add(this, {Type: historyitem_PlotArea_AddAxis, newPr:axis}); History.Add(this, {Type: historyitem_PlotArea_AddAxis, newPr:axis});
this.axId.push(axis); this.axId.push(axis);
...@@ -81,26 +89,29 @@ CPlotArea.prototype = ...@@ -81,26 +89,29 @@ CPlotArea.prototype =
var chart = this.charts.splice(pos, 1)[0]; var chart = this.charts.splice(pos, 1)[0];
//удалим все оси этой диаграммы, проверив прежде нет ли ссылок на данные оси в других диаграммах //удалим все оси этой диаграммы, проверив прежде нет ли ссылок на данные оси в других диаграммах
var chart_axis = chart.axId; if(Array.isArray(chart.axId))
for(var i = 0; i < chart_axis.length; ++i)
{ {
var axis = chart_axis[i]; var chart_axis = chart.axId;
for(var j = 0; j < this.charts.length; ++j) for(var i = 0; i < chart_axis.length; ++i)
{ {
var other_chart = this.charts[j]; var axis = chart_axis[i];
if(Array.isArray(other_chart.axId)) for(var j = 0; j < this.charts.length; ++j)
{ {
for(var k = 0; k < other_chart.axId.length; ++k) var other_chart = this.charts[j];
if(Array.isArray(other_chart.axId))
{ {
if(other_chart.axId[k] === axis) for(var k = 0; k < other_chart.axId.length; ++k)
{
if(other_chart.axId[k] === axis)
break;
}
if(k < other_chart.axId.length)
break; break;
} }
if(k < other_chart.axId.length)
break;
} }
if(j === this.charts.length)
this.removeAxis(axis);
} }
if(j === this.charts.length)
this.removeAxis(axis);
} }
} }
}, },
...@@ -471,18 +482,20 @@ CAreaChart.prototype = ...@@ -471,18 +482,20 @@ CAreaChart.prototype =
return historyitem_type_AreaChart; return historyitem_type_AreaChart;
}, },
removeDataLabels: CBarChart.prototype.removeDataLabels,
getAxisByTypes: CPlotArea.prototype.getAxisByTypes, getAxisByTypes: CPlotArea.prototype.getAxisByTypes,
setFromOtherChart: function(c) setFromOtherChart: function(c)
{ {
var i; var i;
if(Array.isArray(c.axId)) //if(Array.isArray(c.axId))
{ //{
for(i = 0; i < c.axId.length; ++i) // for(i = 0; i < c.axId.length; ++i)
{ // {
this.addAxId(c.axId[i]); // this.addAxId(c.axId[i]);
} // }
} //}
if(c.dLbls) if(c.dLbls)
this.setDLbls(c.dLbls); this.setDLbls(c.dLbls);
if(c.dropLines) if(c.dropLines)
...@@ -742,6 +755,17 @@ CAreaSeries.prototype = ...@@ -742,6 +755,17 @@ CAreaSeries.prototype =
this.setTx(o.tx); this.setTx(o.tx);
if(o.val) if(o.val)
this.setVal(o.val); this.setVal(o.val);
if(o.xVal)
{
this.setCat(new CCat());
this.cat.setFromOtherObject(o.xVal);
}
if(o.yVal)
{
this.setVal(new CYVal());
this.val.setFromOtherObject(o.yVal);
}
}, },
getSeriesName: function() getSeriesName: function()
...@@ -2625,6 +2649,16 @@ CBarChart.prototype = ...@@ -2625,6 +2649,16 @@ CBarChart.prototype =
return this.Id; return this.Id;
}, },
removeDataLabels: function()
{
var i;
for(i = 0; i < this.series.length; ++i)
{
if(typeof this.series[i].setDLbls === "function")
this.series[i].setDLbls(null);
}
},
getObjectType: function() getObjectType: function()
{ {
return historyitem_type_BarChart; return historyitem_type_BarChart;
...@@ -2647,13 +2681,13 @@ CBarChart.prototype = ...@@ -2647,13 +2681,13 @@ CBarChart.prototype =
setFromOtherChart: function(c) setFromOtherChart: function(c)
{ {
var i; var i;
if(Array.isArray(c.axId)) //if(Array.isArray(c.axId))
{ //{
for(i = 0; i < c.axId.length; ++i) // for(i = 0; i < c.axId.length; ++i)
{ // {
this.addAxId(c.axId[i]); // this.addAxId(c.axId[i]);
} // }
} //}
if(isRealNumber(c.barDir)) if(isRealNumber(c.barDir))
this.setBarDir(c.barDir); this.setBarDir(c.barDir);
...@@ -3013,7 +3047,7 @@ CBarSeries.prototype = ...@@ -3013,7 +3047,7 @@ CBarSeries.prototype =
if(o.yVal) if(o.yVal)
{ {
this.setVal(new CYVal()); this.setVal(new CYVal());
this.val.setFromOtherObject(o.val); this.val.setFromOtherObject(o.yVal);
} }
}, },
...@@ -4926,7 +4960,7 @@ CDLbl.prototype = ...@@ -4926,7 +4960,7 @@ CDLbl.prototype =
getDefaultTextForTxBody: function() getDefaultTextForTxBody: function()
{ {
var compiled_string = ""; var compiled_string = "";
var separator = typeof this.separator === "string" ? this.separator : ", "; var separator = typeof this.separator === "string" ? this.separator +" " : ", ";
if(this.showSerName) if(this.showSerName)
{ {
compiled_string += this.series.getSeriesName(); compiled_string += this.series.getSeriesName();
...@@ -5130,6 +5164,9 @@ CDLbl.prototype = ...@@ -5130,6 +5164,9 @@ CDLbl.prototype =
if(dLbl.numFmt != null) if(dLbl.numFmt != null)
this.setNumFmt(dLbl.numFmt); this.setNumFmt(dLbl.numFmt);
if(dLbl.separator != null)
this.setSeparator(dLbl.separator);
if(dLbl.showBubbleSize != null) if(dLbl.showBubbleSize != null)
this.setShowBubbleSize(dLbl.showBubbleSize); this.setShowBubbleSize(dLbl.showBubbleSize);
...@@ -6936,21 +6973,19 @@ CDoughnutChart.prototype = ...@@ -6936,21 +6973,19 @@ CDoughnutChart.prototype =
return historyitem_type_DoughnutChart; return historyitem_type_DoughnutChart;
}, },
removeDataLabels: CBarChart.prototype.removeDataLabels,
setFromOtherChart: function(c) setFromOtherChart: function(c)
{ {
var i;
if(c.dLbls) if(c.dLbls)
this.setDLbls(c.dLbls); this.setDLbls(c.dLbls);
if(isRealNumber(c.firstSliceAng)) if(isRealNumber(c.firstSliceAng))
this.setFirstSliceAng(c.firstSliceAng); this.setFirstSliceAng(c.firstSliceAng);
if(isRealNumber(c.holeSize)) if(isRealNumber(c.holeSize))
this.setHoleSize(c.holeSize); this.setHoleSize(c.holeSize);
if(Array.isArray(c.series)) if(Array.isArray(c.series))
{ {
var i;
for(i = 0; i < c.series.length; ++i) for(i = 0; i < c.series.length; ++i)
{ {
var ser = new CPieSeries(); var ser = new CPieSeries();
...@@ -8476,6 +8511,8 @@ CLineChart.prototype = ...@@ -8476,6 +8511,8 @@ CLineChart.prototype =
return historyitem_type_LineChart; return historyitem_type_LineChart;
}, },
removeDataLabels: CBarChart.prototype.removeDataLabels,
getAxisByTypes: CPlotArea.prototype.getAxisByTypes, getAxisByTypes: CPlotArea.prototype.getAxisByTypes,
Write_ToBinary2: function(w) Write_ToBinary2: function(w)
...@@ -8493,13 +8530,13 @@ CLineChart.prototype = ...@@ -8493,13 +8530,13 @@ CLineChart.prototype =
setFromOtherChart: function(c) setFromOtherChart: function(c)
{ {
var i; var i;
if(Array.isArray(c.axId)) //if(Array.isArray(c.axId))
{ //{
for(i = 0; i < c.axId.length; ++i) // for(i = 0; i < c.axId.length; ++i)
{ // {
this.addAxId(c.axId[i]); // this.addAxId(c.axId[i]);
} // }
} //}
if(c.dLbls) if(c.dLbls)
this.setDLbls(c.dLbls); this.setDLbls(c.dLbls);
...@@ -8884,7 +8921,7 @@ CLineSeries.prototype = ...@@ -8884,7 +8921,7 @@ CLineSeries.prototype =
if(other.spPr) if(other.spPr)
this.setSpPr(other.spPr); this.setSpPr(other.spPr);
if(other.trendline) if(other.trendline)
this.setTrendline(ther.trendline); this.setTrendline(other.trendline);
if(other.tx) if(other.tx)
this.setTx(other.tx); this.setTx(other.tx);
if(other.val) if(other.val)
...@@ -8893,12 +8930,12 @@ CLineSeries.prototype = ...@@ -8893,12 +8930,12 @@ CLineSeries.prototype =
if(other.xVal) if(other.xVal)
{ {
this.setCat(new CCat()); this.setCat(new CCat());
this.cat.setFromOtherObject(o.xVal); this.cat.setFromOtherObject(other.xVal);
} }
if(other.yVal) if(other.yVal)
{ {
this.setVal(new CYVal()) this.setVal(new CYVal());
this.val.setFromOtherObject(o.val); this.val.setFromOtherObject(other.yVal);
} }
}, },
...@@ -10414,7 +10451,8 @@ COfPieChart.prototype = ...@@ -10414,7 +10451,8 @@ COfPieChart.prototype =
}, },
getAxisByTypes: CPlotArea.prototype.getAxisByTypes, removeDataLabels: CBarChart.prototype.removeDataLabels,
addCustSplit: function(pr) addCustSplit: function(pr)
{ {
...@@ -11010,6 +11048,8 @@ CPieChart.prototype = ...@@ -11010,6 +11048,8 @@ CPieChart.prototype =
this.Id = r.GetString2(); this.Id = r.GetString2();
}, },
removeDataLabels: CBarChart.prototype.removeDataLabels,
setFromOtherChart: function(c) setFromOtherChart: function(c)
{ {
var i; var i;
...@@ -11268,8 +11308,8 @@ CPieSeries.prototype = ...@@ -11268,8 +11308,8 @@ CPieSeries.prototype =
} }
if(o.yVal) if(o.yVal)
{ {
this.setVal(new CYVal()) this.setVal(new CYVal());
this.val.setFromOtherObject(o.val); this.val.setFromOtherObject(o.yVal);
} }
}, },
...@@ -11757,6 +11797,9 @@ CRadarChart.prototype = ...@@ -11757,6 +11797,9 @@ CRadarChart.prototype =
return historyitem_type_RadarChart; return historyitem_type_RadarChart;
}, },
removeDataLabels: CBarChart.prototype.removeDataLabels,
getAxisByTypes: CPlotArea.prototype.getAxisByTypes, getAxisByTypes: CPlotArea.prototype.getAxisByTypes,
setAxId: function(pr) setAxId: function(pr)
...@@ -12046,8 +12089,8 @@ CRadarSeries.prototype = ...@@ -12046,8 +12089,8 @@ CRadarSeries.prototype =
} }
if(o.yVal) if(o.yVal)
{ {
this.setVal(new CYVal()) this.setVal(new CYVal());
this.val.setFromOtherObject(o.val); this.val.setFromOtherObject(o.yVal);
} }
}, },
...@@ -12473,6 +12516,8 @@ CScatterChart.prototype = ...@@ -12473,6 +12516,8 @@ CScatterChart.prototype =
}, },
removeDataLabels: CBarChart.prototype.removeDataLabels,
setFromOtherChart: function(o) setFromOtherChart: function(o)
{ {
if(o.dLbls) if(o.dLbls)
...@@ -13327,6 +13372,7 @@ CStockChart.prototype = ...@@ -13327,6 +13372,7 @@ CStockChart.prototype =
return historyitem_type_StockChart; return historyitem_type_StockChart;
}, },
removeDataLabels: CBarChart.prototype.removeDataLabels,
getAxisByTypes: CPlotArea.prototype.getAxisByTypes, getAxisByTypes: CPlotArea.prototype.getAxisByTypes,
...@@ -14023,6 +14069,7 @@ CSurfaceChart.prototype = ...@@ -14023,6 +14069,7 @@ CSurfaceChart.prototype =
return historyitem_type_SurfaceChart; return historyitem_type_SurfaceChart;
}, },
removeDataLabels: CBarChart.prototype.removeDataLabels,
getAxisByTypes: CPlotArea.prototype.getAxisByTypes, getAxisByTypes: CPlotArea.prototype.getAxisByTypes,
...@@ -14264,6 +14311,16 @@ CSurfaceSeries.prototype = ...@@ -14264,6 +14311,16 @@ CSurfaceSeries.prototype =
this.setTx(o.tx); this.setTx(o.tx);
if(o.val) if(o.val)
this.setVal(o.val); this.setVal(o.val);
if(o.xVal)
{
this.setCat(new CCat());
this.cat.setFromOtherObject(o.xVal);
}
if(o.yVal)
{
this.setVal(new CYVal());
this.val.setFromOtherObject(o.yVal);
}
}, },
getSeriesName: CAreaSeries.prototype.getSeriesName, getSeriesName: CAreaSeries.prototype.getSeriesName,
......
...@@ -203,6 +203,10 @@ ...@@ -203,6 +203,10 @@
this.horGridLines = null; this.horGridLines = null;
this.vertGridLines = null; this.vertGridLines = null;
this.type = null; this.type = null;
this.showSerName = null;
this.showCatName = null;
this.showVal = null;
this.separator = null;
} }
asc_ChartSettings.prototype = asc_ChartSettings.prototype =
{ {
...@@ -314,7 +318,45 @@ ...@@ -314,7 +318,45 @@
putType: function(v) putType: function(v)
{ {
return this.type = v; return this.type = v;
},
putShowSerName: function(v)
{
return this.showSerName = v;
},
putShowCatName: function(v)
{
return this.showCatName = v;
},
putShowVal: function(v)
{
return this.showVal = v;
},
getShowSerName: function()
{
return this.showSerName;
},
getShowCatName: function()
{
return this.showCatName;
},
getShowVal: function()
{
return this.showVal;
},
putSeparator: function(v)
{
this.separator = v;
},
getSeparator: function()
{
return this.separator;
} }
}; };
prot = asc_ChartSettings.prototype; prot = asc_ChartSettings.prototype;
...@@ -336,12 +378,21 @@ ...@@ -336,12 +378,21 @@
prot["getDataLabelsPos"] = prot.getDataLabelsPos; prot["getDataLabelsPos"] = prot.getDataLabelsPos;
prot["getHorAx"] = prot.getHorAx; prot["getHorAx"] = prot.getHorAx;
prot["getVertAx"] = prot.getVertAx; prot["getVertAx"] = prot.getVertAx;
prot["getHorGridLines"] = prot.getHorGridLines; prot["getHorGridLines"] = prot.getHorGridLines;
prot["putHorGridLines"] = prot.putHorGridLines; prot["putHorGridLines"] = prot.putHorGridLines;
prot["getVertGridLines"] = prot.getVertGridLines; prot["getVertGridLines"] = prot.getVertGridLines;
prot["putVertGridLines"] = prot.putVertGridLines; prot["putVertGridLines"] = prot.putVertGridLines;
prot["getType"] = prot.getType; prot["getType"] = prot.getType;
prot["putType"] = prot.putType; prot["putType"] = prot.putType;
prot["putShowSerName"] = prot.putShowSerName;
prot["getShowSerName"] = prot.getShowSerName;
prot["putShowCatName"] = prot.putShowCatName;
prot["getShowCatName"] = prot.getShowCatName;
prot["putShowVal"] = prot.putShowVal;
prot["getShowVal"] = prot.getShowVal;
prot["putSeparator"] = prot.putSeparator;
prot["getSeparator"] = prot.getSeparator;
window["asc_ChartSettings"] = asc_ChartSettings; window["asc_ChartSettings"] = asc_ChartSettings;
function asc_AxisSettings() function asc_AxisSettings()
......
...@@ -188,5 +188,6 @@ var c_oAscChartTypeSettings = ...@@ -188,5 +188,6 @@ var c_oAscChartTypeSettings =
areaStackedPer : 15, areaStackedPer : 15,
scatter : 16, scatter : 16,
scatterLine : 17, scatterLine : 17,
scatterSmooth : 18 scatterSmooth : 18,
doughnut : 19
}; };
\ No newline at end of file
...@@ -2313,6 +2313,7 @@ Format ...@@ -2313,6 +2313,7 @@ Format
<option value="lineStackedPerMarker">Line Stacked Per Marker</option> <option value="lineStackedPerMarker">Line Stacked Per Marker</option>
<option value="pie" style="background: #7F9DB9">Pie</option> <option value="pie" style="background: #7F9DB9">Pie</option>
<option value="doughnut" style="background: #7F9DB9">Doughnut</option>
<option value="hBarNormal" style="background: #7F9DB9">HBar Normal</option> <option value="hBarNormal" style="background: #7F9DB9">HBar Normal</option>
<option value="hBarStacked">HBar Stacked</option> <option value="hBarStacked">HBar Stacked</option>
...@@ -2365,15 +2366,23 @@ Format ...@@ -2365,15 +2366,23 @@ Format
</select> </select>
<br> <br>
<label style="font-size: 11pt">Data Labels</label> <label style="font-size: 11pt">Data Labels</label>
<select id="chartDataLabels"> <br>
<option value="none">None</option> <select id="chartDataLabels">
<option value="center">Center</option> <option value="none">None</option>
<option value="inner_top">Inner Top</option> <option value="center">Center</option>
<option value="in_base">In Base</option> <option value="inner_top">Inner Top</option>
<option value="out_end">Out End</option> <option value="in_base">In Base</option>
<option value="right_overlay">Right Overlay</option> <option value="out_end">Out End</option>
<option value="left_overlay">Left Overlay</option> <option value="right_overlay">Right Overlay</option>
</select> <option value="left_overlay">Left Overlay</option>
</select>
<div id="labelsOptionsDiv">
<input type="checkbox" class="dataLabelsCheckBox" value="serName"><label style="font-size: 10pt">Series Name</label>
<br><input type="checkbox" class="dataLabelsCheckBox" value="catName"><label style="font-size: 10pt">Cat Name</label>
<br><input type="checkbox" class="dataLabelsCheckBox" value="val"><label style="font-size: 10pt">Value</label>
</div>
<label style="font-size: 10pt">Data Labels Separator</label><input type="text" id="dataLabelsSeparatorInput">
<br><button id="dataLblsPrApplyButton">Apply</button>
<br> <br>
<label style="font-size: 11pt">Hor Axis</label> <label style="font-size: 11pt">Hor Axis</label>
<select id="chartHorAxis"> <select id="chartHorAxis">
......
...@@ -2854,17 +2854,7 @@ ...@@ -2854,17 +2854,7 @@
$("#chartDataLabels").change( $("#chartDataLabels").change(
function() function()
{ {
var val = $("#chartDataLabels").attr("value");
var map = {
"none" : c_oAscChartDataLabelsPos.none,
"center" : c_oAscChartDataLabelsPos.ctr,
"inner_top" : c_oAscChartDataLabelsPos.inEnd,
"in_base" : c_oAscChartDataLabelsPos.inBase,
"out_end" : c_oAscChartDataLabelsPos.outEnd
};
var settings = new asc_ChartSettings();
settings.putDataLabelsPos(map[val]);
api.asc_editChartDrawingObject(settings);
} }
); );
...@@ -2921,7 +2911,8 @@ ...@@ -2921,7 +2911,8 @@
"areaNormal" : c_oAscChartTypeSettings.areaNormal , "areaNormal" : c_oAscChartTypeSettings.areaNormal ,
"areaStacked" : c_oAscChartTypeSettings.areaStacked , "areaStacked" : c_oAscChartTypeSettings.areaStacked ,
"areaStackedPer" : c_oAscChartTypeSettings.areaStackedPer , "areaStackedPer" : c_oAscChartTypeSettings.areaStackedPer ,
"scatter" : c_oAscChartTypeSettings.scatter "scatter" : c_oAscChartTypeSettings.scatter,
"doughnut" : c_oAscChartTypeSettings.doughnut
}; };
var settings = new asc_ChartSettings(); var settings = new asc_ChartSettings();
...@@ -2929,6 +2920,49 @@ ...@@ -2929,6 +2920,49 @@
api.asc_editChartDrawingObject(settings); api.asc_editChartDrawingObject(settings);
}); });
$(".dataLabelsCheckBox").change(function()
{
// var value = $(this).attr("value");
// var settings = new asc_ChartSettings();
// if(value === "catName")
// settings.putShowCatName(this.checked);
// else if(value === "serName")
// settings.putShowSerName(this.checked);
// else
// settings.putShowVal(this.checked);
//
// api.asc_editChartDrawingObject(settings);
});
$("#dataLblsPrApplyButton").click(
function()
{
var val = $("#chartDataLabels").attr("value");
var map = {
"none" : c_oAscChartDataLabelsPos.none,
"center" : c_oAscChartDataLabelsPos.ctr,
"inner_top" : c_oAscChartDataLabelsPos.inEnd,
"in_base" : c_oAscChartDataLabelsPos.inBase,
"out_end" : c_oAscChartDataLabelsPos.outEnd
};
var settings = new asc_ChartSettings();
settings.putDataLabelsPos(map[val]);
var check_boxes = $(".dataLabelsCheckBox");
var i;
for(i = 0; i < check_boxes.length; ++i)
{
var value = check_boxes[i].value;
if(value === "catName")
settings.putShowCatName(check_boxes[i].checked);
else if(value === "serName")
settings.putShowSerName(check_boxes[i].checked);
else
settings.putShowVal(check_boxes[i].checked);
}
var separator = $("#dataLabelsSeparatorInput").attr("value");
if(separator.length > 0)
settings.putSeparator(separator);
api.asc_editChartDrawingObject(settings);
}
);
}); });
...@@ -658,7 +658,7 @@ CChartSpace.prototype.recalculateMarkers = function() ...@@ -658,7 +658,7 @@ CChartSpace.prototype.recalculateMarkers = function()
default_marker.spPr.ln.merge(parent_objects.theme.themeElements.fmtScheme.lnStyleLst[0]); default_marker.spPr.ln.merge(parent_objects.theme.themeElements.fmtScheme.lnStyleLst[0]);
} }
var RGBA = {R:0, G:0, B:0, A: 255}; var RGBA = {R:0, G:0, B:0, A: 255};
if(this.chart.plotArea.chart.varyColors && this.chart.plotArea.chart.series.length === 1) if(this.chart.plotArea.chart.varyColors && (this.chart.plotArea.chart.series.length === 1 || this.chart.plotArea.chart.getObjectType() === historyitem_type_PieChart || this.chart.plotArea.chart.getObjectType() === historyitem_type_DoughnutChart))
{ {
var ser = this.chart.plotArea.chart.series[0], pts; var ser = this.chart.plotArea.chart.series[0], pts;
if(ser.val) if(ser.val)
...@@ -2574,7 +2574,7 @@ CChartSpace.prototype.recalculateLegend = function() ...@@ -2574,7 +2574,7 @@ CChartSpace.prototype.recalculateLegend = function()
var max_width = 0, cur_width, max_font_size = 0, cur_font_size, ser, b_line_series; var max_width = 0, cur_width, max_font_size = 0, cur_font_size, ser, b_line_series;
var max_word_width = 0; var max_word_width = 0;
this.chart.legend.chart = this; this.chart.legend.chart = this;
if( !this.chart.plotArea.chart.varyColors || (this.chart.plotArea.chart.getObjectType() !== historyitem_type_PieChart || this.chart.plotArea.chart.getObjectType() !== historyitem_type_DoughnutChart) && series.length !== 1) if( !this.chart.plotArea.chart.varyColors || (this.chart.plotArea.chart.getObjectType() !== historyitem_type_PieChart && this.chart.plotArea.chart.getObjectType() !== historyitem_type_DoughnutChart) && series.length !== 1)
{ {
for(i = 0; i < series.length; ++i) for(i = 0; i < series.length; ++i)
{ {
......
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