Commit 41104fe5 authored by Sergey Luzyanin's avatar Sergey Luzyanin

fix Bug 34209

parent f5f6df06
...@@ -9758,7 +9758,9 @@ function ApplyMarker(aPreset, oObject, index, aBaseColors){ ...@@ -9758,7 +9758,9 @@ function ApplyMarker(aPreset, oObject, index, aBaseColors){
oObject.setMarker(null); oObject.setMarker(null);
return; return;
} }
oObject.setMarker(new AscFormat.CMarker()); if(!oObject.marker){
oObject.setMarker(new AscFormat.CMarker());
}
oObject.marker.setSize(aPreset[0]); oObject.marker.setSize(aPreset[0]);
ApplySpPr(aPreset[1], oObject.marker, index, aBaseColors); ApplySpPr(aPreset[1], oObject.marker, index, aBaseColors);
oObject.marker.setSymbol(aPreset[2]); oObject.marker.setSymbol(aPreset[2]);
...@@ -9928,7 +9930,9 @@ function ApplyTxPr(aTextPr, oObject, oDrawingDocument, i, baseFills, bAccent1Bac ...@@ -9928,7 +9930,9 @@ function ApplyTxPr(aTextPr, oObject, oDrawingDocument, i, baseFills, bAccent1Bac
if(!aTextPr){ if(!aTextPr){
return; return;
} }
oObject.setTxPr(AscFormat.CreateTextBodyFromString("", oDrawingDocument, oObject)); if(!oObject.txPr){
oObject.setTxPr(AscFormat.CreateTextBodyFromString("", oDrawingDocument, oObject));
}
var Pr = oObject.txPr.content.Content[0].Pr.Copy(); var Pr = oObject.txPr.content.Content[0].Pr.Copy();
if(!Pr.DefaultRunPr){ if(!Pr.DefaultRunPr){
Pr.DefaultRunPr = new CTextPr(); Pr.DefaultRunPr = new CTextPr();
...@@ -10055,7 +10059,9 @@ function ApplyDLblsProps(aPr, oObj, oDrawingDocument, i, baseFills, bCreate){ ...@@ -10055,7 +10059,9 @@ function ApplyDLblsProps(aPr, oObj, oDrawingDocument, i, baseFills, bCreate){
return; return;
} }
if(!bCreate) { if(!bCreate) {
oObj.setDLbls(new AscFormat.CDLbls()); if(!oObj.dLbls){
oObj.setDLbls(new AscFormat.CDLbls());
}
} }
if(oObj.dLbls){ if(oObj.dLbls){
var lbls = oObj.dLbls; var lbls = oObj.dLbls;
...@@ -10106,7 +10112,9 @@ function ApplyPresetToChartSpace(oChartSpace, aPreset, bCreate){ ...@@ -10106,7 +10112,9 @@ function ApplyPresetToChartSpace(oChartSpace, aPreset, bCreate){
} }
else{ else{
if(!bCreate && aPreset[5]){ if(!bCreate && aPreset[5]){
oChartSpace.chart.setLegend(new AscFormat.CLegend()); if(!oChartSpace.chart.legend){
oChartSpace.chart.setLegend(new AscFormat.CLegend());
}
oChartSpace.chart.legend.setOverlay(false); oChartSpace.chart.legend.setOverlay(false);
} }
} }
...@@ -10131,20 +10139,35 @@ function ApplyPresetToChartSpace(oChartSpace, aPreset, bCreate){ ...@@ -10131,20 +10139,35 @@ function ApplyPresetToChartSpace(oChartSpace, aPreset, bCreate){
for(i = 0; i < oChart.series.length; ++i){ for(i = 0; i < oChart.series.length; ++i){
var pts = AscFormat.getPtsFromSeries(oChart.series[i]); var pts = AscFormat.getPtsFromSeries(oChart.series[i]);
for(var j = oChart.series[i].dPt.length - 1; j > -1; --j){
oChart.series[i].removeDPt(j); var oDPt;
}
if(oChart.getObjectType() === AscDFH.historyitem_type_PieChart || oChart.getObjectType() === AscDFH.historyitem_type_DoughnutChart){ if(oChart.getObjectType() === AscDFH.historyitem_type_PieChart || oChart.getObjectType() === AscDFH.historyitem_type_DoughnutChart){
base_fills = AscFormat.getArrayFillsFromBase(style.fill2, AscFormat.getMaxIdx(pts)); base_fills = AscFormat.getArrayFillsFromBase(style.fill2, AscFormat.getMaxIdx(pts));
for(j = 0; j < pts.length; ++j){ for(j = 0; j < pts.length; ++j){
var oDPt = new AscFormat.CDPt(); oDPt = null;
oDPt.setBubble3D(false); if(oChart.series[i].getDptByIdx){
oDPt.setIdx(j); oDPt = oChart.series[i].getDptByIdx(j);
}
if(!oDPt){
oDPt = new AscFormat.CDPt();
oDPt.setIdx(j);
}
if(oDPt.bubble3D !== false){
oDPt.setBubble3D(false);
}
ApplySpPr(aPreset[11], oDPt, j, base_fills, bAccent1Background); ApplySpPr(aPreset[11], oDPt, j, base_fills, bAccent1Background);
oChart.series[i].addDPt(oDPt); oChart.series[i].addDPt(oDPt);
} }
for (j = 0; j < oChart.series[i].dPt.length; ++j ){
if(oChart.series[i].dPt[j].idx >= pts.length){
oChart.series[i].removeDPt(j);
}
}
} }
else{ else{
for(var j = oChart.series[i].dPt.length - 1; j > -1; --j){
oChart.series[i].removeDPt(j);
}
base_fills = AscFormat.getArrayFillsFromBase(style.fill2, oChart.series.length); base_fills = AscFormat.getArrayFillsFromBase(style.fill2, oChart.series.length);
ApplySpPr(aPreset[11], oChart.series[i], i, base_fills, bAccent1Background); ApplySpPr(aPreset[11], oChart.series[i], i, base_fills, bAccent1Background);
} }
...@@ -10200,7 +10223,9 @@ function ApplyPresetToChartSpace(oChartSpace, aPreset, bCreate){ ...@@ -10200,7 +10223,9 @@ function ApplyPresetToChartSpace(oChartSpace, aPreset, bCreate){
} }
if(aPreset[17]){ if(aPreset[17]){
oChartSpace.chart.setView3D(new AscFormat.CView3d()); if(!oChartSpace.chart.view3D){
oChartSpace.chart.setView3D(new AscFormat.CView3d());
}
oChartSpace.chart.view3D.setDepthPercent(aPreset[17][0]); oChartSpace.chart.view3D.setDepthPercent(aPreset[17][0]);
oChartSpace.chart.view3D.setHPercent(aPreset[17][1]); oChartSpace.chart.view3D.setHPercent(aPreset[17][1]);
oChartSpace.chart.view3D.setPerspective(aPreset[17][2]); oChartSpace.chart.view3D.setPerspective(aPreset[17][2]);
...@@ -10212,7 +10237,9 @@ function ApplyPresetToChartSpace(oChartSpace, aPreset, bCreate){ ...@@ -10212,7 +10237,9 @@ function ApplyPresetToChartSpace(oChartSpace, aPreset, bCreate){
oChartSpace.chart.setView3D(null); oChartSpace.chart.setView3D(null);
} }
if(aPreset[18]){ if(aPreset[18]){
oChartSpace.chart.setBackWall(new AscFormat.CChartWall()); if(!oChartSpace.chart.backWall){
oChartSpace.chart.setBackWall(new AscFormat.CChartWall());
}
ApplySpPr(aPreset[18][0], oChartSpace.chart.backWall); ApplySpPr(aPreset[18][0], oChartSpace.chart.backWall);
oChartSpace.chart.backWall.setThickness(aPreset[18][1]); oChartSpace.chart.backWall.setThickness(aPreset[18][1]);
} }
...@@ -10221,7 +10248,9 @@ function ApplyPresetToChartSpace(oChartSpace, aPreset, bCreate){ ...@@ -10221,7 +10248,9 @@ function ApplyPresetToChartSpace(oChartSpace, aPreset, bCreate){
} }
if(aPreset[19]){ if(aPreset[19]){
oChartSpace.chart.setFloor(new AscFormat.CChartWall()); if(!oChartSpace.chart.floor){
oChartSpace.chart.setFloor(new AscFormat.CChartWall());
}
ApplySpPr(aPreset[19][0], oChartSpace.chart.floor); ApplySpPr(aPreset[19][0], oChartSpace.chart.floor);
oChartSpace.chart.floor.setThickness(aPreset[19][1]); oChartSpace.chart.floor.setThickness(aPreset[19][1]);
} }
...@@ -10230,7 +10259,9 @@ function ApplyPresetToChartSpace(oChartSpace, aPreset, bCreate){ ...@@ -10230,7 +10259,9 @@ function ApplyPresetToChartSpace(oChartSpace, aPreset, bCreate){
} }
if(aPreset[20]){ if(aPreset[20]){
oChartSpace.chart.setSideWall(new AscFormat.CChartWall()); if(!oChartSpace.chart.sideWall){
oChartSpace.chart.setSideWall(new AscFormat.CChartWall());
}
ApplySpPr(aPreset[20][0], oChartSpace.chart.sideWall); ApplySpPr(aPreset[20][0], oChartSpace.chart.sideWall);
oChartSpace.chart.sideWall.setThickness(aPreset[20][1]); oChartSpace.chart.sideWall.setThickness(aPreset[20][1]);
} }
...@@ -10253,7 +10284,9 @@ function ApplyPresetToChartSpace(oChartSpace, aPreset, bCreate){ ...@@ -10253,7 +10284,9 @@ function ApplyPresetToChartSpace(oChartSpace, aPreset, bCreate){
oChart.setUpDownBars(null); oChart.setUpDownBars(null);
} }
else{ else{
oChart.setUpDownBars(new AscFormat.CUpDownBars()); if(!oChart.upDownBars){
oChart.setUpDownBars(new AscFormat.CUpDownBars());
}
oChartSpace.setSpPr(null); oChartSpace.setSpPr(null);
ApplySpPr(aPreset[24][0], oChartSpace); ApplySpPr(aPreset[24][0], oChartSpace);
oChart.upDownBars.setDownBars(oChartSpace.spPr); oChart.upDownBars.setDownBars(oChartSpace.spPr);
......
...@@ -9742,6 +9742,15 @@ CPieSeries.prototype = ...@@ -9742,6 +9742,15 @@ CPieSeries.prototype =
return null; return null;
}, },
getDptByIdx: function(idx){
for(var i = 0; i < this.dPt.length; ++i){
if(this.dPt[i].idx === idx){
return this.dPt[i];
}
}
return null;
},
Refresh_RecalcData: function() Refresh_RecalcData: function()
{}, {},
......
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