Commit d90bb719 authored by Sergey Luzyanin's avatar Sergey Luzyanin

charts preset

parent 5112ee80
...@@ -315,18 +315,18 @@ ChartPreviewManager.prototype.getChartByType = function(type) ...@@ -315,18 +315,18 @@ ChartPreviewManager.prototype.getChartByType = function(type)
chart_space.spPr.xfrm.setOffY(0); chart_space.spPr.xfrm.setOffY(0);
chart_space.spPr.xfrm.setExtX(50); chart_space.spPr.xfrm.setExtX(50);
chart_space.spPr.xfrm.setExtY(50); chart_space.spPr.xfrm.setExtY(50);
settings.putTitle(Asc.c_oAscChartTitleShowSettings.none); settings.putTitle(Asc.c_oAscChartTitleShowSettings.noOverlay);
settings.putHorAxisLabel(Asc.c_oAscChartTitleShowSettings.none); //settings.putHorAxisLabel(Asc.c_oAscChartTitleShowSettings.none);
settings.putVertAxisLabel(Asc.c_oAscChartTitleShowSettings.none); //settings.putVertAxisLabel(Asc.c_oAscChartTitleShowSettings.none);
settings.putLegendPos(Asc.c_oAscChartLegendShowSettings.none); //settings.putLegendPos(Asc.c_oAscChartLegendShowSettings.none);
settings.putHorGridLines(Asc.c_oAscGridLinesSettings.none); //settings.putHorGridLines(Asc.c_oAscGridLinesSettings.none);
settings.putVertGridLines(Asc.c_oAscGridLinesSettings.none); //settings.putVertGridLines(Asc.c_oAscGridLinesSettings.none);
var val_ax_props = new AscCommon.asc_ValAxisSettings(); var val_ax_props = new AscCommon.asc_ValAxisSettings();
val_ax_props.putMinValRule(Asc.c_oAscValAxisRule.auto); val_ax_props.putMinValRule(Asc.c_oAscValAxisRule.auto);
val_ax_props.putMaxValRule(Asc.c_oAscValAxisRule.auto); val_ax_props.putMaxValRule(Asc.c_oAscValAxisRule.auto);
val_ax_props.putTickLabelsPos(c_oAscTickLabelsPos.TICK_LABEL_POSITION_NONE); val_ax_props.putTickLabelsPos(c_oAscTickLabelsPos.TICK_LABEL_POSITION_NEXT_TO);
val_ax_props.putInvertValOrder(false); val_ax_props.putInvertValOrder(false);
val_ax_props.putDispUnitsRule(Asc.c_oAscValAxUnits.none); val_ax_props.putDispUnitsRule(Asc.c_oAscValAxUnits.none);
val_ax_props.putMajorTickMark(c_oAscTickMark.TICK_MARK_NONE); val_ax_props.putMajorTickMark(c_oAscTickMark.TICK_MARK_NONE);
...@@ -337,7 +337,7 @@ ChartPreviewManager.prototype.getChartByType = function(type) ...@@ -337,7 +337,7 @@ ChartPreviewManager.prototype.getChartByType = function(type)
var cat_ax_props = new AscCommon.asc_CatAxisSettings(); var cat_ax_props = new AscCommon.asc_CatAxisSettings();
cat_ax_props.putIntervalBetweenLabelsRule(Asc.c_oAscBetweenLabelsRule.auto); cat_ax_props.putIntervalBetweenLabelsRule(Asc.c_oAscBetweenLabelsRule.auto);
cat_ax_props.putLabelsPosition(Asc.c_oAscLabelsPosition.betweenDivisions); cat_ax_props.putLabelsPosition(Asc.c_oAscLabelsPosition.betweenDivisions);
cat_ax_props.putTickLabelsPos(c_oAscTickLabelsPos.TICK_LABEL_POSITION_NONE); cat_ax_props.putTickLabelsPos(c_oAscTickLabelsPos.TICK_LABEL_POSITION_NEXT_TO);
cat_ax_props.putLabelsAxisDistance(100); cat_ax_props.putLabelsAxisDistance(100);
cat_ax_props.putMajorTickMark(c_oAscTickMark.TICK_MARK_NONE); cat_ax_props.putMajorTickMark(c_oAscTickMark.TICK_MARK_NONE);
cat_ax_props.putMinorTickMark(c_oAscTickMark.TICK_MARK_NONE); cat_ax_props.putMinorTickMark(c_oAscTickMark.TICK_MARK_NONE);
...@@ -377,6 +377,7 @@ ChartPreviewManager.prototype.getChartByType = function(type) ...@@ -377,6 +377,7 @@ ChartPreviewManager.prototype.getChartByType = function(type)
cat_ax_props.putLabelsPosition(AscFormat.CROSS_BETWEEN_BETWEEN); cat_ax_props.putLabelsPosition(AscFormat.CROSS_BETWEEN_BETWEEN);
vert_axis_settings = val_ax_props; vert_axis_settings = val_ax_props;
hor_axis_settings = cat_ax_props; hor_axis_settings = cat_ax_props;
break; break;
} }
...@@ -423,6 +424,7 @@ ChartPreviewManager.prototype.getChartByType = function(type) ...@@ -423,6 +424,7 @@ ChartPreviewManager.prototype.getChartByType = function(type)
new_line.setFill(new AscFormat.CUniFill()); new_line.setFill(new AscFormat.CUniFill());
new_line.Fill.setFill(new AscFormat.CNoFill()); new_line.Fill.setFill(new AscFormat.CNoFill());
chart_space.spPr.setLn(new_line); chart_space.spPr.setLn(new_line);
chart_space.recalcInfo.recalculateReferences = false; chart_space.recalcInfo.recalculateReferences = false;
chart_space.recalculate(); chart_space.recalculate();
...@@ -439,20 +441,8 @@ ChartPreviewManager.prototype.createChartPreview = function(type, styleIndex) { ...@@ -439,20 +441,8 @@ ChartPreviewManager.prototype.createChartPreview = function(type, styleIndex) {
if(!this.chartsByTypes[type]) if(!this.chartsByTypes[type])
this.chartsByTypes[type] = this.getChartByType(type); this.chartsByTypes[type] = this.getChartByType(type);
var chart_space = this.chartsByTypes[type]; var chart_space = this.chartsByTypes[type];
if(chart_space.style !== styleIndex) AscFormat.ApplyPresetToChartSpace(chart_space, AscCommon.g_oChartPresets[type][styleIndex]);
{ chart_space.recalculate();
chart_space.style = styleIndex;
chart_space.recalculateMarkers();
chart_space.recalculateSeriesColors();
chart_space.recalculatePlotAreaChartBrush();
chart_space.recalculatePlotAreaChartPen();
chart_space.recalculateWalls();
chart_space.recalculateChartBrush();
chart_space.recalculateChartPen();
chart_space.recalculateUpDownBars();
}
chart_space.recalculatePenBrush();
if (null === this._canvas_charts) { if (null === this._canvas_charts) {
this._canvas_charts = document.createElement('canvas'); this._canvas_charts = document.createElement('canvas');
...@@ -482,8 +472,11 @@ ChartPreviewManager.prototype.getChartPreviews = function(chartType) { ...@@ -482,8 +472,11 @@ ChartPreviewManager.prototype.getChartPreviews = function(chartType) {
if (!this.previewGroups.hasOwnProperty(chartType)) { if (!this.previewGroups.hasOwnProperty(chartType)) {
this.previewGroups[chartType] = []; this.previewGroups[chartType] = [];
var arr = this.previewGroups[chartType]; var arr = this.previewGroups[chartType];
for(var i = 1; i < 49; ++i) if(AscCommon.g_oChartPresets[chartType]){
arr.push(this.createChartPreview(chartType, i)); var nStylesCount = AscCommon.g_oChartPresets[chartType].length;
for(var i = 0; i < nStylesCount; ++i)
arr.push(this.createChartPreview(chartType, i));
}
} }
var group = this.previewGroups[chartType]; var group = this.previewGroups[chartType];
var objectGroup = []; var objectGroup = [];
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
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