[SSE] Fix multichart settings
This commit is contained in:
parent
27663a1691
commit
3dbe65cffc
|
@ -70,7 +70,7 @@ define([
|
||||||
SSE.Views.ChartTypeDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({
|
SSE.Views.ChartTypeDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({
|
||||||
options: {
|
options: {
|
||||||
contentWidth: 370,
|
contentWidth: 370,
|
||||||
height: 400
|
height: 385
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize : function(options) {
|
initialize : function(options) {
|
||||||
|
@ -84,7 +84,7 @@ define([
|
||||||
'<div class="settings-panel active">',
|
'<div class="settings-panel active">',
|
||||||
'<table cols="1" style="width: 100%;">',
|
'<table cols="1" style="width: 100%;">',
|
||||||
'<tr>',
|
'<tr>',
|
||||||
'<td class="padding-small">',
|
'<td class="padding-large">',
|
||||||
'<label class="header">', me.textType, '</label>',
|
'<label class="header">', me.textType, '</label>',
|
||||||
'<div id="chart-type-dlg-button-type" style=""></div>',
|
'<div id="chart-type-dlg-button-type" style=""></div>',
|
||||||
'</td>',
|
'</td>',
|
||||||
|
@ -99,12 +99,12 @@ define([
|
||||||
'<td>',
|
'<td>',
|
||||||
'<label id="chart-type-dlg-label-column" class="header" style="width: 115px;">', me.textSeries, '</label>',
|
'<label id="chart-type-dlg-label-column" class="header" style="width: 115px;">', me.textSeries, '</label>',
|
||||||
'<label id="chart-type-dlg-label-sort" class="header" style="width: 100px;">', me.textType, '</label>',
|
'<label id="chart-type-dlg-label-sort" class="header" style="width: 100px;">', me.textType, '</label>',
|
||||||
'<label class="header" style="">', me.textSecondary, '</label>',
|
'<label class="header" style="width: 134px;text-align: center;">', me.textSecondary, '</label>',
|
||||||
'</td>',
|
'</td>',
|
||||||
'</tr>',
|
'</tr>',
|
||||||
'<tr class="combined-chart">',
|
'<tr class="combined-chart">',
|
||||||
'<td class="padding-small">',
|
'<td class="padding-small">',
|
||||||
'<div id="chart-type-dlg-series-list" class="" style="width:100%; height: 150px;"></div>',
|
'<div id="chart-type-dlg-series-list" class="" style="width:100%; height: 180px;"></div>',
|
||||||
'</td>',
|
'</td>',
|
||||||
'</tr>',
|
'</tr>',
|
||||||
'</table>',
|
'</table>',
|
||||||
|
@ -186,13 +186,14 @@ define([
|
||||||
store: new Common.UI.DataViewStore(),
|
store: new Common.UI.DataViewStore(),
|
||||||
emptyText: '',
|
emptyText: '',
|
||||||
enableKeyEvents: false,
|
enableKeyEvents: false,
|
||||||
|
scrollAlwaysVisible: true,
|
||||||
template: _.template(['<div class="listview inner" style=""></div>'].join('')),
|
template: _.template(['<div class="listview inner" style=""></div>'].join('')),
|
||||||
itemTemplate: _.template([
|
itemTemplate: _.template([
|
||||||
'<div class="list-item" style="width: 100%;" id="chart-type-dlg-item-<%= seriesIndex %>">',
|
'<div class="list-item" style="width: 100%;" id="chart-type-dlg-item-<%= seriesIndex %>">',
|
||||||
'<div style="width:8px;height:12px;display: inline-block;vertical-align: middle;" id="chart-type-dlg-series-preview-<%= seriesIndex %>"></div>',
|
'<div style="width:8px;height:12px;display: inline-block;vertical-align: middle;" id="chart-type-dlg-series-preview-<%= seriesIndex %>"></div>',
|
||||||
'<div style="width:95px;padding-left: 5px;display: inline-block;vertical-align: middle;overflow: hidden; text-overflow: ellipsis;white-space: nowrap;"><%= value %></div>',
|
'<div style="width:95px;padding-left: 5px;display: inline-block;vertical-align: middle;overflow: hidden; text-overflow: ellipsis;white-space: nowrap;"><%= value %></div>',
|
||||||
'<div style="width: 100px;padding-left: 5px;display: inline-block;vertical-align: middle;color: initial;"><div id="chart-type-dlg-cmb-series-<%= seriesIndex %>" class="input-group-nr" style=""></div></div>',
|
'<div style="width: 110px;padding-left: 5px;display: inline-block;vertical-align: middle;color: initial;"><div id="chart-type-dlg-cmb-series-<%= seriesIndex %>" class="input-group-nr" style=""></div></div>',
|
||||||
'<div style="padding-left: 64px;display: inline-block;vertical-align: middle;"><div id="chart-type-dlg-chk-series-<%= seriesIndex %>" style=""></div></div>',
|
'<div style="padding-left: 55px;display: inline-block;vertical-align: middle;"><div id="chart-type-dlg-chk-series-<%= seriesIndex %>" style=""></div></div>',
|
||||||
'</div>'
|
'</div>'
|
||||||
].join(''))
|
].join(''))
|
||||||
});
|
});
|
||||||
|
@ -202,9 +203,6 @@ define([
|
||||||
model: record
|
model: record
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
// this.seriesList.on('item:select', _.bind(this.onSelectLevel, this))
|
|
||||||
// .on('item:keydown', _.bind(this.onKeyDown, this));
|
|
||||||
|
|
||||||
this.NotCombinedSettings = $('.simple-chart', this.$window);
|
this.NotCombinedSettings = $('.simple-chart', this.$window);
|
||||||
this.CombinedSettings = $('.combined-chart', this.$window);
|
this.CombinedSettings = $('.combined-chart', this.$window);
|
||||||
|
|
||||||
|
@ -291,9 +289,6 @@ define([
|
||||||
this.updateChartStyles(this.api.asc_getChartPreviews(this.currentChartType));
|
this.updateChartStyles(this.api.asc_getChartPreviews(this.currentChartType));
|
||||||
},
|
},
|
||||||
|
|
||||||
onSelectStyle: function(combo, record) {
|
|
||||||
},
|
|
||||||
|
|
||||||
updateChartStyles: function(styles) {
|
updateChartStyles: function(styles) {
|
||||||
var me = this;
|
var me = this;
|
||||||
if (styles && styles.length>0){
|
if (styles && styles.length>0){
|
||||||
|
@ -346,6 +341,7 @@ define([
|
||||||
arr.push(rec);
|
arr.push(rec);
|
||||||
}
|
}
|
||||||
store.reset(arr);
|
store.reset(arr);
|
||||||
|
(arr.length>0) && (index!==undefined) && (index < arr.length) && this.seriesList.selectByIndex(index);
|
||||||
},
|
},
|
||||||
|
|
||||||
addControls: function(listView, itemView, item) {
|
addControls: function(listView, itemView, item) {
|
||||||
|
@ -356,35 +352,37 @@ define([
|
||||||
cmpEl = this.seriesList.cmpEl.find('#chart-type-dlg-item-' + i),
|
cmpEl = this.seriesList.cmpEl.find('#chart-type-dlg-item-' + i),
|
||||||
series = item.get('series');
|
series = item.get('series');
|
||||||
series.asc_drawPreviewRect('chart-type-dlg-series-preview-' + i);
|
series.asc_drawPreviewRect('chart-type-dlg-series-preview-' + i);
|
||||||
var combo = this.initSeriesType(cmpEl.find('#chart-type-dlg-cmb-series-' + i), i, item);
|
var combo = this.initSeriesType('#chart-type-dlg-cmb-series-' + i, i, item);
|
||||||
var check = new Common.UI.CheckBox({
|
var check = new Common.UI.CheckBox({
|
||||||
el: cmpEl.find('#chart-type-dlg-chk-series-' + i),
|
el: cmpEl.find('#chart-type-dlg-chk-series-' + i),
|
||||||
value: !item.get('isSecondary'),
|
value: item.get('isSecondary'),
|
||||||
disabled: !item.get('canChangeSecondary')
|
disabled: !item.get('canChangeSecondary')
|
||||||
});
|
});
|
||||||
check.on('change', function(field, newValue, oldValue, eOpts) {
|
check.on('change', function(field, newValue, oldValue, eOpts) {
|
||||||
var res = series.asc_TryChangeAxisType(field.getValue()=='checked');
|
var res = series.asc_TryChangeAxisType(field.getValue()=='checked');
|
||||||
if (res !== Asc.c_oAscError.ID.No) {
|
if (res !== Asc.c_oAscError.ID.No) {
|
||||||
field.setValue(field.getValue()!='checked', true);
|
field.setValue(field.getValue()!='checked', true);
|
||||||
}
|
} else
|
||||||
|
me.updateSeriesList(me.chartSettings.getSeries(), i);
|
||||||
});
|
});
|
||||||
cmpEl.on('mousedown', '.combobox', function(){
|
cmpEl.on('mousedown', '.combobox', function(){
|
||||||
me.seriesList.selectRecord(item);
|
me.seriesList.selectRecord(item);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
initSeriesType: function(el, index, item) {
|
initSeriesType: function(id, index, item) {
|
||||||
var me = this,
|
var me = this,
|
||||||
series = item.get('series'),
|
series = item.get('series'),
|
||||||
store = new Common.UI.DataViewStore(me._arrSeriesType),
|
store = new Common.UI.DataViewStore(me._arrSeriesType),
|
||||||
currentTypeRec = store.findWhere({type: item.get('type')}),
|
currentTypeRec = store.findWhere({type: item.get('type')}),
|
||||||
tip = currentTypeRec ? currentTypeRec.get('tip') : '';
|
tip = currentTypeRec ? currentTypeRec.get('tip') : '',
|
||||||
|
el = $(id);
|
||||||
var combo = new Common.UI.ComboBox({
|
var combo = new Common.UI.ComboBox({
|
||||||
el: el,
|
el: el,
|
||||||
template: _.template([
|
template: _.template([
|
||||||
'<span class="input-group combobox combo-dataview-menu input-group-nr dropdown-toggle no-highlighted" tabindex="0" data-toggle="dropdown">',
|
'<span class="input-group combobox combo-dataview-menu input-group-nr dropdown-toggle no-highlighted" tabindex="0" data-toggle="dropdown">',
|
||||||
'<input type="text" class="form-control" spellcheck="false">',
|
'<input type="text" class="form-control" spellcheck="false">',
|
||||||
'<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret img-commonctrl"></span></button>',
|
'<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" data-target="' + id + '"><span class="caret img-commonctrl"></span></button>',
|
||||||
'</span>'
|
'</span>'
|
||||||
].join(''))
|
].join(''))
|
||||||
});
|
});
|
||||||
|
@ -413,10 +411,12 @@ define([
|
||||||
var res = series.asc_TryChangeChartType(record.get('type'));
|
var res = series.asc_TryChangeChartType(record.get('type'));
|
||||||
if (res == Asc.c_oAscError.ID.No) {
|
if (res == Asc.c_oAscError.ID.No) {
|
||||||
combo.setValue(record.get('tip'));
|
combo.setValue(record.get('tip'));
|
||||||
|
me.updateSeriesList(me.chartSettings.getSeries(), index);
|
||||||
} else {
|
} else {
|
||||||
var oldrecord = picker.store.findWhere({type: oldtype});
|
var oldrecord = picker.store.findWhere({type: oldtype});
|
||||||
picker.selectRecord(oldrecord, true);
|
picker.selectRecord(oldrecord, true);
|
||||||
}
|
if (res==Asc.c_oAscError.ID.SecondaryAxis)
|
||||||
|
Common.UI.warning({msg: me.errorSecondaryAxis, maxwidth: 500}); }
|
||||||
});
|
});
|
||||||
menu.off('show:before', onShowBefore);
|
menu.off('show:before', onShowBefore);
|
||||||
};
|
};
|
||||||
|
@ -435,7 +435,8 @@ define([
|
||||||
textType: 'Type',
|
textType: 'Type',
|
||||||
textStyle: 'Style',
|
textStyle: 'Style',
|
||||||
textSeries: 'Series',
|
textSeries: 'Series',
|
||||||
textSecondary: 'Secondary Axis'
|
textSecondary: 'Secondary Axis',
|
||||||
|
errorSecondaryAxis: 'The selected chart type requires the secondary axis that an existing chart is using. Select another chart type.'
|
||||||
|
|
||||||
}, SSE.Views.ChartTypeDialog || {}))
|
}, SSE.Views.ChartTypeDialog || {}))
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue