[SSE] Add sparkline

This commit is contained in:
Julia Radzhabova 2021-03-23 17:51:50 +03:00
parent 5ab470ec5f
commit 8489136021
3 changed files with 45 additions and 45 deletions

View file

@ -62,7 +62,8 @@ define([
'spreadsheeteditor/main/app/view/ScaleDialog',
'spreadsheeteditor/main/app/view/FormatRulesManagerDlg',
'spreadsheeteditor/main/app/view/SlicerAddDialog',
'spreadsheeteditor/main/app/view/AdvancedSeparatorDialog'
'spreadsheeteditor/main/app/view/AdvancedSeparatorDialog',
'spreadsheeteditor/main/app/view/CreateSparklineDialog'
], function () { 'use strict';
SSE.Controllers.Toolbar = Backbone.Controller.extend(_.extend({
@ -1079,22 +1080,10 @@ define([
if (!this.editMode) return;
var me = this,
info = me.api.asc_getCellInfo(),
seltype = info.asc_getSelectionType(),
isSpark = (group == 'menu-chart-group-sparkcolumn' || group == 'menu-chart-group-sparkline' || group == 'menu-chart-group-sparkwin');
seltype = info.asc_getSelectionType();
if (me.api) {
var win, props;
if (isSpark && (seltype==Asc.c_oAscSelectionType.RangeCells || seltype==Asc.c_oAscSelectionType.RangeCol ||
seltype==Asc.c_oAscSelectionType.RangeRow || seltype==Asc.c_oAscSelectionType.RangeMax)) {
var sparkLineInfo = info.asc_getSparklineInfo();
if (!!sparkLineInfo) {
var props = new Asc.sparklineGroup();
props.asc_setType(type);
this.api.asc_setSparklineGroup(sparkLineInfo.asc_getId(), props);
} else {
// add sparkline
}
} else if (!isSpark) {
var ischartedit = ( seltype == Asc.c_oAscSelectionType.RangeChart || seltype == Asc.c_oAscSelectionType.RangeChartText);
props = me.api.asc_getChartObject(true); // don't lock chart object
if (props) {
@ -1127,7 +1116,6 @@ define([
}
}
}
}
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
},
@ -1146,7 +1134,19 @@ define([
props.asc_setType(type);
this.api.asc_setSparklineGroup(sparkLineInfo.asc_getId(), props);
} else {
// add sparkline
var me = this;
(new SSE.Views.CreateSparklineDialog(
{
api: me.api,
handler: function(result, settings) {
if (result == 'ok' && settings) {
me.view && me.view.fireEvent('insertspark', me.view);
if (settings.destination)
me.api.asc_addSparklineGroup(type, settings.source, settings.destination);
}
Common.NotificationCenter.trigger('edit:complete', me);
}
})).show();
}
}
}

View file

@ -2689,6 +2689,6 @@ define([
textAutoColor: 'Automatic',
textItems: 'Items',
tipInsertSpark: 'Insert sparkline',
capInsertSpark: 'Sparkline'
capInsertSpark: 'Sparklines'
}, SSE.Views.Toolbar || {}));
});

View file

@ -3258,7 +3258,7 @@
"SSE.Views.Toolbar.txtUnmerge": "Unmerge Cells",
"SSE.Views.Toolbar.txtYen": "¥ Yen",
"SSE.Views.Toolbar.tipInsertSpark": "Insert sparkline",
"SSE.Views.Toolbar.capInsertSpark": "Sparkline",
"SSE.Views.Toolbar.capInsertSpark": "Sparklines",
"SSE.Views.Top10FilterDialog.textType": "Show",
"SSE.Views.Top10FilterDialog.txtBottom": "Bottom",
"SSE.Views.Top10FilterDialog.txtBy": "by",