[DE] Refactoring drawing current chart style

This commit is contained in:
Julia Radzhabova 2022-02-16 17:03:12 +03:00
parent 412249db4f
commit d2622e2f5a
2 changed files with 5 additions and 9 deletions

View file

@ -95,7 +95,7 @@ define([
this.delayRenderTips = this.options.delayRenderTips || false;
this.itemTemplate = this.options.itemTemplate || _.template([
'<div class="style" id="<%= id %>">',
'<img src="<%= imageUrl %>" width="' + this.itemWidth + '" height="' + this.itemHeight + '"/>',
'<img src="<%= imageUrl %>" width="' + this.itemWidth + '" height="' + this.itemHeight + '" + <% if(typeof imageUrl === "undefined" || imageUrl===null || imageUrl==="") { %> style="visibility: hidden;" <% } %>/>',
'<% if (typeof title !== "undefined") {%>',
'<span class="title"><%= title %></span>',
'<% } %>',

View file

@ -172,8 +172,8 @@ define([
value = this.chartProps.getStyle();
if (this._state.ChartStyle !== value || this._isChartStylesChanged) {
this._state.ChartStyle = value;
this.selectCurrentChartStyle();
this._isChartStylesChanged && this.api.asc_generateChartPreviews(this._state.ChartType);
var arr = this.selectCurrentChartStyle();
this._isChartStylesChanged && this.api.asc_generateChartPreviews(this._state.ChartType, arr);
}
}
this._isChartStylesChanged = false;
@ -443,10 +443,7 @@ define([
_.each(currentRecords, function(style, index){
arr.push(style.get('data'));
});
arr = this.api.asc_getChartPreviews(this._state.ChartType, arr);
_.each(arr, function(style, index){
currentRecords[index].set('imageUrl', style.asc_getImage());
});
return arr;
}
}
},
@ -492,8 +489,7 @@ define([
!(this._state.ChartType==Asc.c_oAscChartTypeSettings.comboBarLine || this._state.ChartType==Asc.c_oAscChartTypeSettings.comboBarLineSecondary ||
this._state.ChartType==Asc.c_oAscChartTypeSettings.comboAreaBar || this._state.ChartType==Asc.c_oAscChartTypeSettings.comboCustom)) {
this.updateChartStyles(this.api.asc_getChartPreviews(this._state.ChartType, undefined, true));
this.selectCurrentChartStyle();
this.api.asc_generateChartPreviews(this._state.ChartType);
this.api.asc_generateChartPreviews(this._state.ChartType, this.selectCurrentChartStyle());
}
},