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

добавил в экспорт asc_getFromChart и asc_setFromChart у asc_CShapeProperty....

добавил в экспорт asc_getFromChart и asc_setFromChart у asc_CShapeProperty. поправлены некоторые баги при построениии preview диаграмм.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56492 954022d7-b5bf-4e40-9824-e11837661b57
parent 75195fef
...@@ -1929,6 +1929,8 @@ prot["asc_getCanFill"] = prot.asc_getCanFill; ...@@ -1929,6 +1929,8 @@ prot["asc_getCanFill"] = prot.asc_getCanFill;
prot["asc_putCanFill"] = prot.asc_putCanFill; prot["asc_putCanFill"] = prot.asc_putCanFill;
prot["asc_getCanChangeArrows"] = prot.asc_getCanChangeArrows; prot["asc_getCanChangeArrows"] = prot.asc_getCanChangeArrows;
prot["asc_setCanChangeArrows"] = prot.asc_setCanChangeArrows; prot["asc_setCanChangeArrows"] = prot.asc_setCanChangeArrows;
prot["asc_getFromChart"] = prot.asc_getFromChart;
prot["asc_setFromChart"] = prot.asc_setFromChart;
//} //}
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
......
...@@ -722,6 +722,8 @@ function ChartPreviewManager() { ...@@ -722,6 +722,8 @@ function ChartPreviewManager() {
DrawingObjectsController.prototype.applyPropsToChartSpace(settings, chart_space); DrawingObjectsController.prototype.applyPropsToChartSpace(settings, chart_space);
chart_space.setBDeleted(false); chart_space.setBDeleted(false);
chart_space.updateLinks(); chart_space.updateLinks();
if(!(asc_chart.type.toLowerCase() === "scatter" || asc_chart.type.toLowerCase() === "stock"))
{
if(chart_space.chart.plotArea.valAx) if(chart_space.chart.plotArea.valAx)
{ {
chart_space.chart.plotArea.valAx.setDelete(true); chart_space.chart.plotArea.valAx.setDelete(true);
...@@ -730,6 +732,22 @@ function ChartPreviewManager() { ...@@ -730,6 +732,22 @@ function ChartPreviewManager() {
{ {
chart_space.chart.plotArea.catAx.setDelete(true); chart_space.chart.plotArea.catAx.setDelete(true);
} }
}
else
{
if(chart_space.chart.plotArea.valAx)
{
chart_space.chart.plotArea.valAx.setTickLblPos(TICK_LABEL_POSITION_NONE);
chart_space.chart.plotArea.valAx.setMajorTickMark(TICK_MARK_NONE);
chart_space.chart.plotArea.valAx.setMinorTickMark(TICK_MARK_NONE);
}
if(chart_space.chart.plotArea.catAx)
{
chart_space.chart.plotArea.catAx.setTickLblPos(TICK_LABEL_POSITION_NONE);
chart_space.chart.plotArea.catAx.setMajorTickMark(TICK_MARK_NONE);
chart_space.chart.plotArea.catAx.setMinorTickMark(TICK_MARK_NONE);
}
}
if(!chart_space.spPr) if(!chart_space.spPr)
{ {
chart_space.setSpPr(new CSpPr()); chart_space.setSpPr(new CSpPr());
......
...@@ -2216,7 +2216,7 @@ DrawingObjectsController.prototype = ...@@ -2216,7 +2216,7 @@ DrawingObjectsController.prototype =
} }
else if(chart_type_object_type === historyitem_type_LineChart) else if(chart_type_object_type === historyitem_type_LineChart)
{ {
if(!chart_type.marker) // if(!chart_type.marker)
{ {
switch(chart_type.grouping) switch(chart_type.grouping)
{ {
...@@ -2237,7 +2237,7 @@ DrawingObjectsController.prototype = ...@@ -2237,7 +2237,7 @@ DrawingObjectsController.prototype =
} }
} }
} }
else /* else
{ {
switch(chart_type.grouping) switch(chart_type.grouping)
{ {
...@@ -2257,7 +2257,7 @@ DrawingObjectsController.prototype = ...@@ -2257,7 +2257,7 @@ DrawingObjectsController.prototype =
break; break;
} }
} }
} } */
} }
else if(chart_type_object_type === historyitem_type_AreaChart) else if(chart_type_object_type === historyitem_type_AreaChart)
{ {
...@@ -2282,7 +2282,9 @@ DrawingObjectsController.prototype = ...@@ -2282,7 +2282,9 @@ DrawingObjectsController.prototype =
} }
else if(chart_type_object_type === historyitem_type_ScatterChart) else if(chart_type_object_type === historyitem_type_ScatterChart)
{ {
switch (chart_type.scatterStyle)
calc_chart_type = c_oAscChartTypeSettings.scatter;
/*switch (chart_type.scatterStyle)
{ {
case SCATTER_STYLE_LINE: case SCATTER_STYLE_LINE:
{ {
...@@ -2319,7 +2321,7 @@ DrawingObjectsController.prototype = ...@@ -2319,7 +2321,7 @@ DrawingObjectsController.prototype =
calc_chart_type = c_oAscChartTypeSettings.scatterMarker; calc_chart_type = c_oAscChartTypeSettings.scatterMarker;
break; break;
} }
} } */
} }
else else
{ {
......
...@@ -16024,6 +16024,18 @@ CScatterChart.prototype = ...@@ -16024,6 +16024,18 @@ CScatterChart.prototype =
Refresh_RecalcData: function() Refresh_RecalcData: function()
{}, {},
Write_ToBinary2: function(w)
{
w.WriteLong(this.getObjectType());
w.WriteString2(this.Get_Id());
},
Read_FromBinary2: function(r)
{
this.Id = r.GetString2();
},
removeSeries: function(idx) removeSeries: function(idx)
{ {
if(this.series[idx]) if(this.series[idx])
......
...@@ -1809,6 +1809,14 @@ CChartSpace.prototype = ...@@ -1809,6 +1809,14 @@ CChartSpace.prototype =
var arr_labels; var arr_labels;
var text_transform; var text_transform;
var local_text_transform; var local_text_transform;
if(x_ax.bDelete)
{
x_ax.labels = null;
}
if(y_ax.bDelete)
{
y_ax.labels = null;
}
if(x_ax.labels) if(x_ax.labels)
{ {
arr_labels = x_ax.labels.arrLabels; arr_labels = x_ax.labels.arrLabels;
...@@ -5327,11 +5335,11 @@ CChartSpace.prototype = ...@@ -5327,11 +5335,11 @@ CChartSpace.prototype =
var series = this.chart.plotArea.chart.series; var series = this.chart.plotArea.chart.series;
var parents = this.getParentObjects(); var parents = this.getParentObjects();
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 && series.length === 1 || ((this.chart.plotArea.chart instanceof CPieChart || this.chart.plotArea.chart instanceof CDoughnutChart) && this.chart.plotArea.chart.varyColors)) if(this.chart.plotArea.chart.varyColors && (series.length === 1 || this.chart.plotArea.chart.getObjectType() === historyitem_type_PieChart || this.chart.plotArea.chart.getObjectType() === historyitem_type_DoughnutChart))
{ {
var ser = series[0]; var ser = series[0];
var pts = getPtsFromSeries(ser); var pts = getPtsFromSeries(ser);
if(!(this.chart.plotArea.chart instanceof CLineChart)) if(!(this.chart.plotArea.chart.getObjectType() === historyitem_type_LineChart || this.chart.plotArea.chart.getObjectType() === historyitem_type_ScatterChart))
{ {
var base_fills = getArrayFillsFromBase(style.fill2, getMaxIdx(pts)); var base_fills = getArrayFillsFromBase(style.fill2, getMaxIdx(pts));
for(var i = 0; i < pts.length; ++i) for(var i = 0; i < pts.length; ++i)
...@@ -5415,12 +5423,23 @@ CChartSpace.prototype = ...@@ -5415,12 +5423,23 @@ CChartSpace.prototype =
} }
else else
{ {
var default_line = parents.theme.themeElements.fmtScheme.lnStyleLst[0]; var default_line;
if(this.chart.plotArea.chart.getObjectType() === historyitem_type_ScatterChart && this.chart.plotArea.chart.scatterStyle === SCATTER_STYLE_MARKER || this.chart.plotArea.chart.scatterStyle === SCATTER_STYLE_NONE)
{
default_line = new CLn();
default_line.setFill(new CUniFill());
default_line.Fill.setFill(new CNoFill());
}
else
{
default_line = parents.theme.themeElements.fmtScheme.lnStyleLst[0];
}
var base_line_fills = getArrayFillsFromBase(style.line4, getMaxIdx(pts)); var base_line_fills = getArrayFillsFromBase(style.line4, getMaxIdx(pts));
for(var i = 0; i < pts.length; ++i) for(var i = 0; i < pts.length; ++i)
{ {
var compiled_line = new CLn(); var compiled_line = new CLn();
compiled_line.merge(default_line); compiled_line.merge(default_line);
if(!(this.chart.plotArea.chart.getObjectType() === historyitem_type_ScatterChart && this.chart.plotArea.chart.scatterStyle === SCATTER_STYLE_MARKER || this.chart.plotArea.chart.scatterStyle === SCATTER_STYLE_NONE))
compiled_line.Fill.merge(base_line_fills[pts[i].idx]); compiled_line.Fill.merge(base_line_fills[pts[i].idx]);
compiled_line.w *= style.line3; compiled_line.w *= style.line3;
if(ser.spPr && ser.spPr.ln) if(ser.spPr && ser.spPr.ln)
...@@ -5449,7 +5468,103 @@ CChartSpace.prototype = ...@@ -5449,7 +5468,103 @@ CChartSpace.prototype =
} }
else else
{ {
if(!(this.chart.plotArea.chart instanceof CLineChart || this.chart.plotArea.chart instanceof CScatterChart || this.chart.plotArea.chart instanceof CRadarChart)) switch(this.chart.plotArea.chart.getObjectType())
{
case historyitem_type_LineChart:
case historyitem_type_RadarChart:
{
var base_line_fills = getArrayFillsFromBase(style.line4, getMaxIdx(series));
for(var i = 0; i < series.length; ++i)
{
var default_line = parents.theme.themeElements.fmtScheme.lnStyleLst[0];
var ser = series[i];
var pts = getPtsFromSeries(ser);
for(var j = 0; j < pts.length; ++j)
{
var compiled_line = new CLn();
compiled_line.merge(default_line);
compiled_line.Fill.merge(base_line_fills[ser.idx]);
compiled_line.w *= style.line3;
if(ser.spPr && ser.spPr.ln)
compiled_line.merge(ser.spPr.ln);
if(j === 0)
ser.compiledSeriesPen = compiled_line.createDuplicate();
if(Array.isArray(ser.dPt))
{
for(var k = 0; k < ser.dPt.length; ++k)
{
if(ser.dPt[k].idx === pts[j].idx)
{
if(ser.dPt[k].spPr)
{
compiled_line.merge(ser.dPt[k].spPr.ln);
}
break;
}
}
}
pts[j].brush = null;
pts[j].pen = compiled_line;
pts[j].pen.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA);
}
}
break;
}
case historyitem_type_ScatterChart:
{
var base_line_fills = getArrayFillsFromBase(style.line4, getMaxIdx(series));
for(var i = 0; i < series.length; ++i)
{
var default_line = parents.theme.themeElements.fmtScheme.lnStyleLst[0];
var ser = series[i];
var pts = getPtsFromSeries(ser);
if(this.chart.plotArea.chart.scatterStyle === SCATTER_STYLE_SMOOTH || this.chart.plotArea.chart.scatterStyle === SCATTER_STYLE_SMOOTH_MARKER)
{
if(!isRealBool(ser.smooth))
{
ser.smooth = true;
}
}
if(this.chart.plotArea.chart.scatterStyle === SCATTER_STYLE_MARKER || this.chart.plotArea.chart.scatterStyle === SCATTER_STYLE_NONE)
{
default_line = new CLn();
default_line.setFill(new CUniFill());
default_line.Fill.setFill(new CNoFill());
}
for(var j = 0; j < pts.length; ++j)
{
var compiled_line = new CLn();
compiled_line.merge(default_line);
if(!(this.chart.plotArea.chart.scatterStyle === SCATTER_STYLE_MARKER || this.chart.plotArea.chart.scatterStyle === SCATTER_STYLE_NONE))
compiled_line.Fill.merge(base_line_fills[ser.idx]);
compiled_line.w *= style.line3;
if(ser.spPr && ser.spPr.ln)
compiled_line.merge(ser.spPr.ln);
if(j === 0)
ser.compiledSeriesPen = compiled_line.createDuplicate();
if(Array.isArray(ser.dPt))
{
for(var k = 0; k < ser.dPt.length; ++k)
{
if(ser.dPt[k].idx === pts[j].idx)
{
if(ser.dPt[k].spPr)
{
compiled_line.merge(ser.dPt[k].spPr.ln);
}
break;
}
}
}
pts[j].brush = null;
pts[j].pen = compiled_line;
pts[j].pen.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA);
}
}
break;
}
default :
{ {
var base_fills = getArrayFillsFromBase(style.fill2, getMaxIdx(series)); var base_fills = getArrayFillsFromBase(style.fill2, getMaxIdx(series));
var base_line_fills = null; var base_line_fills = null;
...@@ -5545,52 +5660,186 @@ CChartSpace.prototype = ...@@ -5545,52 +5660,186 @@ CChartSpace.prototype =
} }
} }
} }
break;
}
}
}
}
},
recalculateMarkers: function()
{
if(this.chart && this.chart.plotArea && this.chart.plotArea.chart)
{
var series = this.chart.plotArea.chart.series, pts;
for(var i = 0; i < series.length; ++i)
{
var ser = series[i];
ser.compiledSeriesMarker = null;
pts = getPtsFromSeries(ser);
for(var j = 0; j < pts.length; ++j)
{
pts[j].compiledMarker = null;
}
}
var oThis = this;
var recalculateMarkers2 = function()
{
var chart_style = CHART_STYLE_MANAGER.getStyleByIndex(oThis.style);
var effect_fill = chart_style.fill1;
var fill = chart_style.fill2;
var line = chart_style.line4;
var masrker_default_size = chart_style.markerSize;
var default_marker = new CMarker();
default_marker.setSize(masrker_default_size);
var parent_objects = oThis.getParentObjects();
if(parent_objects.theme && parent_objects.theme.themeElements
&& parent_objects.theme.themeElements.fmtScheme
&& parent_objects.theme.themeElements.fmtScheme.lnStyleLst)
{
default_marker.setSpPr(new CSpPr());
default_marker.spPr.setLn(new CLn());
default_marker.spPr.ln.merge(parent_objects.theme.themeElements.fmtScheme.lnStyleLst[0]);
}
var RGBA = {R:0, G:0, B:0, A: 255};
if(oThis.chart.plotArea.chart.varyColors && (oThis.chart.plotArea.chart.series.length === 1 || oThis.chart.plotArea.chart.getObjectType() === historyitem_type_PieChart || oThis.chart.plotArea.chart.getObjectType() === historyitem_type_DoughnutChart))
{
var ser = oThis.chart.plotArea.chart.series[0], pts;
pts = getPtsFromSeries(ser);
var series_marker = ser.marker;
var brushes = getArrayFillsFromBase(fill, getMaxIdx(pts));
var pens_fills = getArrayFillsFromBase(line, getMaxIdx(pts));
var compiled_markers = [];
for(var i = 0; i < pts.length; ++i)
{
var compiled_marker = new CMarker();
compiled_marker.merge(default_marker);
if(!compiled_marker.spPr)
{
compiled_marker.setSpPr(new CSpPr());
}
compiled_marker.spPr.setFill(brushes[pts[i].idx]);
compiled_marker.spPr.Fill.merge(pts[i].brush);
if(!compiled_marker.spPr.ln)
compiled_marker.spPr.setLn(new CLn());
compiled_marker.spPr.ln.merge(pts[i].pen);
compiled_marker.merge(ser.marker);
compiled_marker.setSymbol(GetTypeMarkerByIndex(j));
if(Array.isArray(ser.dPt))
{
for(var j = 0; j < ser.dPt.length; ++j)
{
if(ser.dPt[j].idx === pts[i].idx)
{
var d_pt = ser.dPt[j];
if(d_pt.spPr && (d_pt.spPr.Fill || d_pt.spPr.ln))
{
if(!compiled_marker.spPr)
{
compiled_marker.setSpPr(new CSpPr());
}
if(d_pt.spPr.Fill)
{
compiled_marker.spPr.setFill(d_pt.spPr.Fill.createDuplicate());
}
if(d_pt.spPr.ln)
{
if(!compiled_marker.spPr.ln)
{
compiled_marker.spPr.setLn(new CLn());
}
compiled_marker.spPr.ln.merge(d_pt.spPr.ln);
}
}
compiled_marker.merge(ser.dPt[j].marker);
break;
}
}
}
pts[i].compiledMarker = compiled_marker;
pts[i].compiledMarker.pen = compiled_marker.spPr.ln;
pts[i].compiledMarker.brush = compiled_marker.spPr.Fill;
pts[i].compiledMarker.brush.calculate(parent_objects.theme, parent_objects.slide, parent_objects.layout, parent_objects.master, RGBA);
pts[i].compiledMarker.pen.calculate(parent_objects.theme, parent_objects.slide, parent_objects.layout, parent_objects.master, RGBA);
}
} }
else else
{ {
var base_line_fills = getArrayFillsFromBase(style.line4, getMaxIdx(series)); var series = oThis.chart.plotArea.chart.series;
var brushes = getArrayFillsFromBase(fill, getMaxIdx(series));
var pens_fills = getArrayFillsFromBase(line, getMaxIdx(series));
for(var i = 0; i < series.length; ++i) for(var i = 0; i < series.length; ++i)
{ {
var default_line = parents.theme.themeElements.fmtScheme.lnStyleLst[0];
var ser = series[i]; var ser = series[i];
var pts = getPtsFromSeries(ser); pts = getPtsFromSeries(ser);
for(var j = 0; j < pts.length; ++j) for(var j = 0; j < pts.length; ++j)
{ {
var compiled_line = new CLn(); var compiled_marker = new CMarker();
compiled_line.merge(default_line); compiled_marker.merge(default_marker);
compiled_line.Fill.merge(base_line_fills[ser.idx]); if(!compiled_marker.spPr)
compiled_line.w *= style.line3; {
if(ser.spPr && ser.spPr.ln) compiled_marker.setSpPr(new CSpPr());
compiled_line.merge(ser.spPr.ln); }
compiled_marker.spPr.setFill(brushes[series[i].idx]);
if(!compiled_marker.spPr.ln)
compiled_marker.spPr.setLn(new CLn());
compiled_marker.spPr.ln.setFill(pens_fills[series[i].idx]);
compiled_marker.setSymbol(GetTypeMarkerByIndex(series[i].idx));
compiled_marker.merge(ser.marker);
if(j === 0) if(j === 0)
ser.compiledSeriesPen = compiled_line.createDuplicate(); ser.compiledSeriesMarker = compiled_marker.createDuplicate();
if(Array.isArray(ser.dPt)) if(Array.isArray(ser.dPt))
{ {
for(var k = 0; k < ser.dPt.length; ++k) for(var k = 0; k < ser.dPt.length; ++k)
{ {
if(ser.dPt[k].idx === pts[j].idx) if(ser.dPt[k].idx === pts[j].idx)
{ {
if(ser.dPt[k].spPr) compiled_marker.merge(ser.dPt[k].marker);
{
compiled_line.merge(ser.dPt[k].spPr.ln);
}
break; break;
} }
} }
} }
pts[j].brush = null; pts[j].compiledMarker = compiled_marker;
pts[j].pen = compiled_line; pts[j].compiledMarker.pen = compiled_marker.spPr.ln;
pts[j].pen.calculate(parents.theme, parents.slide, parents.layout, parents.master, RGBA); pts[j].compiledMarker.brush = compiled_marker.spPr.Fill;
pts[j].compiledMarker.brush.calculate(parent_objects.theme, parent_objects.slide, parent_objects.layout, parent_objects.master, RGBA);
pts[j].compiledMarker.pen.calculate(parent_objects.theme, parent_objects.slide, parent_objects.layout, parent_objects.master, RGBA);
} }
} }
} }
};
switch (this.chart.plotArea.chart.getObjectType())
{
case historyitem_type_LineChart:
case historyitem_type_RadarChart:
{
if(this.chart.plotArea.chart.marker)
{
recalculateMarkers2();
} }
break;
} }
}, case historyitem_type_ScatterChart:
{
recalculateMarkers: function() if(this.chart.plotArea.chart.scatterStyle === SCATTER_STYLE_MARKER || this.chart.plotArea.chart.scatterStyle === SCATTER_STYLE_LINE_MARKER || this.chart.plotArea.chart.scatterStyle === SCATTER_STYLE_SMOOTH_MARKER)
{
recalculateMarkers2();
}
break;
}
default:
{ {
if(this.chart.plotArea.chart.getObjectType() !== historyitem_type_LineChart && this.chart.plotArea.chart.getObjectType() !== historyitem_type_RadarChart || this.chart.plotArea.chart.marker) recalculateMarkers2();
break;
}
}
}
/*if(this.chart.plotArea.chart.getObjectType() !== historyitem_type_LineChart && this.chart.plotArea.chart.getObjectType() !== historyitem_type_RadarChart || this.chart.plotArea.chart.marker)
{ {
var chart_style = CHART_STYLE_MANAGER.getStyleByIndex(this.style); var chart_style = CHART_STYLE_MANAGER.getStyleByIndex(this.style);
var effect_fill = chart_style.fill1; var effect_fill = chart_style.fill1;
...@@ -5732,8 +5981,7 @@ CChartSpace.prototype = ...@@ -5732,8 +5981,7 @@ CChartSpace.prototype =
pts[j].compiledMarker = null; pts[j].compiledMarker = null;
} }
} }
} } */
}, },
recalculateGridLines: function() recalculateGridLines: function()
...@@ -5927,7 +6175,8 @@ CChartSpace.prototype = ...@@ -5927,7 +6175,8 @@ CChartSpace.prototype =
if(this.chart.plotArea.chart && this.chart.plotArea.chart.series) if(this.chart.plotArea.chart && this.chart.plotArea.chart.series)
{ {
var series = this.chart.plotArea.chart.series; var series = this.chart.plotArea.chart.series;
for(var i = 0; i < series.length; ++i) var _len = this.chart.plotArea.chart.getObjectType() === historyitem_type_PieChart ? 1 : series.length;
for(var i = 0; i < _len; ++i)
{ {
var ser = series[i]; var ser = series[i];
var pts = getPtsFromSeries(ser); var pts = getPtsFromSeries(ser);
...@@ -8660,7 +8909,7 @@ function CreateScatterChart(asc_chart) ...@@ -8660,7 +8909,7 @@ function CreateScatterChart(asc_chart)
plot_area.setLayout(new CLayout()); plot_area.setLayout(new CLayout());
plot_area.addChart(new CScatterChart()); plot_area.addChart(new CScatterChart());
var scatter_chart = plot_area.charts[0]; var scatter_chart = plot_area.charts[0];
scatter_chart.setScatterStyle(SCATTER_STYLE_LINE_MARKER); scatter_chart.setScatterStyle(SCATTER_STYLE_MARKER);
scatter_chart.setVaryColors(false); scatter_chart.setVaryColors(false);
plot_area.addAxis(new CValAx()); plot_area.addAxis(new CValAx());
plot_area.addAxis(new CValAx()); plot_area.addAxis(new CValAx());
......
...@@ -1036,6 +1036,12 @@ Geometry.prototype= ...@@ -1036,6 +1036,12 @@ Geometry.prototype=
this.pathLst[i].draw(shape_drawer); this.pathLst[i].draw(shape_drawer);
}, },
drawSmart: function(shape_drawer)
{
for (var i=0, n=this.pathLst.length; i<n;++i)
this.pathLst[i].drawSmart(shape_drawer);
},
check_bounds: function(checker) check_bounds: function(checker)
{ {
for(var i=0, n=this.pathLst.length; i<n;++i) for(var i=0, n=this.pathLst.length; i<n;++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