Commit 3328c59d authored by Sergey Luzyanin's avatar Sergey Luzyanin

added param bShowPercent to SetShowDataLabels

parent c38bcbc4
...@@ -872,10 +872,11 @@ ...@@ -872,10 +872,11 @@
* @param {boolean} bShowSerName * @param {boolean} bShowSerName
* @param {boolean} bShowCatName * @param {boolean} bShowCatName
* @param {boolean} bShowVal * @param {boolean} bShowVal
* @param {boolean} bShowPercent
* */ * */
ApiChart.prototype.SetShowDataLabels = function(bShowSerName, bShowCatName, bShowVal) ApiChart.prototype.SetShowDataLabels = function(bShowSerName, bShowCatName, bShowVal, bShowPercent)
{ {
AscFormat.builder_SetShowDataLabels(this.Chart, bShowSerName, bShowCatName, bShowVal); AscFormat.builder_SetShowDataLabels(this.Chart, bShowSerName, bShowCatName, bShowVal, bShowPercent);
}; };
......
...@@ -12530,10 +12530,11 @@ function CorrectUniColor(asc_color, unicolor, flag) ...@@ -12530,10 +12530,11 @@ function CorrectUniColor(asc_color, unicolor, flag)
} }
} }
function builder_SetShowDataLabels(oChartSpace, bShowSerName, bShowCatName, bShowVal){ function builder_SetShowDataLabels(oChartSpace, bShowSerName, bShowCatName, bShowVal, bShowPerecent){
if(oChartSpace && oChartSpace.chart && oChartSpace.chart.plotArea && oChartSpace.chart.plotArea.charts[0]){ if(oChartSpace && oChartSpace.chart && oChartSpace.chart.plotArea && oChartSpace.chart.plotArea.charts[0]){
var oChart = oChartSpace.chart.plotArea.charts[0]; var oChart = oChartSpace.chart.plotArea.charts[0];
if(false == bShowSerName && false == bShowCatName && false == bShowVal) var bPieChart = oChart.getObjectType() === AscDFH.historyitem_type_PieChart || oChart.getObjectType() === AscDFH.historyitem_type_DoughnutChart;
if(false == bShowSerName && false == bShowCatName && false == bShowVal && (bPieChart && bShowPerecent === false))
{ {
if(oChart.dLbls) if(oChart.dLbls)
{ {
...@@ -12549,7 +12550,10 @@ function CorrectUniColor(asc_color, unicolor, flag) ...@@ -12549,7 +12550,10 @@ function CorrectUniColor(asc_color, unicolor, flag)
oChart.dLbls.setShowCatName(true == bShowCatName); oChart.dLbls.setShowCatName(true == bShowCatName);
oChart.dLbls.setShowVal(true == bShowVal); oChart.dLbls.setShowVal(true == bShowVal);
oChart.dLbls.setShowLegendKey(false); oChart.dLbls.setShowLegendKey(false);
//oChart.dLbls.setShowPercent(false); if(bPieChart){
oChart.dLbls.setShowPercent(true === bShowPerecent);
}
oChart.dLbls.setShowBubbleSize(false); oChart.dLbls.setShowBubbleSize(false);
} }
} }
......
...@@ -678,10 +678,11 @@ ...@@ -678,10 +678,11 @@
* @param {boolean} bShowSerName * @param {boolean} bShowSerName
* @param {boolean} bShowCatName * @param {boolean} bShowCatName
* @param {boolean} bShowVal * @param {boolean} bShowVal
* @param {boolean} bShowPercent
* */ * */
ApiChart.prototype.SetShowDataLabels = function(bShowSerName, bShowCatName, bShowVal) ApiChart.prototype.SetShowDataLabels = function(bShowSerName, bShowCatName, bShowVal, bShowPercent)
{ {
AscFormat.builder_SetShowDataLabels(this.Chart, bShowSerName, bShowCatName, bShowVal); AscFormat.builder_SetShowDataLabels(this.Chart, bShowSerName, bShowCatName, bShowVal, bShowPercent);
}; };
......
...@@ -4078,31 +4078,11 @@ ...@@ -4078,31 +4078,11 @@
* @param {boolean} bShowSerName * @param {boolean} bShowSerName
* @param {boolean} bShowCatName * @param {boolean} bShowCatName
* @param {boolean} bShowVal * @param {boolean} bShowVal
* @param {boolean} bShowPercent
* */ * */
ApiChart.prototype.SetShowDataLabels = function(bShowSerName, bShowCatName, bShowVal) ApiChart.prototype.SetShowDataLabels = function(bShowSerName, bShowCatName, bShowVal, bShowPercent)
{ {
if(this.Chart && this.Chart.chart && this.Chart.chart.plotArea && this.Chart.chart.plotArea.charts[0]) AscFormat.builder_SetShowDataLabels(this.Chart, bShowSerName, bShowCatName, bShowVal, bShowPercent);
{
var oChart = this.Chart.chart.plotArea.charts[0];
if(false == bShowSerName && false == bShowCatName && false == bShowVal)
{
if(oChart.dLbls)
{
oChart.setDLbls(null);
}
}
if(!oChart.dLbls)
{
oChart.setDLbls(new AscFormat.CDLbls());
}
oChart.dLbls.setSeparator(",");
oChart.dLbls.setShowSerName(true == bShowSerName);
oChart.dLbls.setShowCatName(true == bShowCatName);
oChart.dLbls.setShowVal(true == bShowVal);
oChart.dLbls.setShowLegendKey(false);
//oChart.dLbls.setShowPercent(false);
oChart.dLbls.setShowBubbleSize(false);
}
}; };
//------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------
......
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