@progress/kendo-angular-chart-wizard 16.6.0-develop.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +11 -0
- package/NOTICE.txt +200 -0
- package/README.md +32 -0
- package/chart-wizard-state.d.ts +149 -0
- package/chart-wizard.component.d.ts +80 -0
- package/chart-wizard.module.d.ts +19 -0
- package/common/get-wizard-data-from-data-rows.d.ts +41 -0
- package/common/index.d.ts +5 -0
- package/common/models.d.ts +19 -0
- package/directives.d.ts +10 -0
- package/esm2020/chart-wizard-state.mjs +502 -0
- package/esm2020/chart-wizard.component.mjs +552 -0
- package/esm2020/chart-wizard.module.mjs +53 -0
- package/esm2020/common/get-wizard-data-from-data-rows.mjs +27 -0
- package/esm2020/common/index.mjs +5 -0
- package/esm2020/common/models.mjs +5 -0
- package/esm2020/directives.mjs +13 -0
- package/esm2020/events/export-event.mjs +18 -0
- package/esm2020/events/index.mjs +5 -0
- package/esm2020/events/preventable-event.mjs +30 -0
- package/esm2020/grid-integration/get-grid-selected-rows.mjs +48 -0
- package/esm2020/grid-integration/get-wizard-data-from-grid-selection.mjs +13 -0
- package/esm2020/grid-integration/grid-chart-wizard.directive.mjs +74 -0
- package/esm2020/grid-integration/index.mjs +7 -0
- package/esm2020/index.mjs +11 -0
- package/esm2020/package-metadata.mjs +15 -0
- package/esm2020/progress-kendo-angular-chart-wizard.mjs +8 -0
- package/esm2020/property-pane/chart-tab.component.mjs +257 -0
- package/esm2020/property-pane/data-tab.component.mjs +229 -0
- package/esm2020/property-pane/form-field.component.mjs +245 -0
- package/esm2020/property-pane/format-tab.component.mjs +945 -0
- package/esm2020/series-type-button.component.mjs +67 -0
- package/esm2020/state.service.mjs +32 -0
- package/events/export-event.d.ts +24 -0
- package/events/index.d.ts +5 -0
- package/events/preventable-event.d.ts +24 -0
- package/fesm2015/progress-kendo-angular-chart-wizard.mjs +2999 -0
- package/fesm2020/progress-kendo-angular-chart-wizard.mjs +2993 -0
- package/grid-integration/get-grid-selected-rows.d.ts +20 -0
- package/grid-integration/get-wizard-data-from-grid-selection.d.ts +19 -0
- package/grid-integration/grid-chart-wizard.directive.d.ts +42 -0
- package/grid-integration/index.d.ts +7 -0
- package/index.d.ts +12 -0
- package/package-metadata.d.ts +9 -0
- package/package.json +65 -0
- package/property-pane/chart-tab.component.d.ts +35 -0
- package/property-pane/data-tab.component.d.ts +33 -0
- package/property-pane/form-field.component.d.ts +45 -0
- package/property-pane/format-tab.component.d.ts +102 -0
- package/schematics/collection.json +12 -0
- package/schematics/ngAdd/index.js +8 -0
- package/schematics/ngAdd/schema.json +24 -0
- package/series-type-button.component.d.ts +24 -0
- package/state.service.d.ts +23 -0
@@ -0,0 +1,502 @@
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
2
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
5
|
+
/**
|
6
|
+
* @hidden
|
7
|
+
*/
|
8
|
+
export const fontSizes = [
|
9
|
+
{ text: '16', value: '16px' },
|
10
|
+
{ text: '20', value: '20px' },
|
11
|
+
{ text: '24', value: '24px' },
|
12
|
+
{ text: '48', value: '48px' },
|
13
|
+
{ text: '60', value: '60px' },
|
14
|
+
{ text: '96', value: '96px' },
|
15
|
+
];
|
16
|
+
/**
|
17
|
+
* @hidden
|
18
|
+
*/
|
19
|
+
export const fontNames = [
|
20
|
+
{ text: 'Arial', value: 'Arial, Helvetica, sans-serif',
|
21
|
+
style: { fontFamily: 'Arial, Helvetica, sans-serif' } },
|
22
|
+
{ text: 'Courier New', value: '\'Courier New\', Courier, monospace',
|
23
|
+
style: { fontFamily: '\'Courier New\', Courier, monospace' } },
|
24
|
+
{ text: 'Georgia', value: 'Georgia, serif',
|
25
|
+
style: { fontFamily: 'Georgia, serif' } },
|
26
|
+
{ text: 'Impact', value: 'Impact, Charcoal, sans-serif',
|
27
|
+
style: { fontFamily: 'Impact, Charcoal, sans-serif' } },
|
28
|
+
{ text: 'Lucida Console', value: '\'Lucida Console\', Monaco, monospace',
|
29
|
+
style: { fontFamily: '\'Lucida Console\', Monaco, monospace' } },
|
30
|
+
{ text: 'Tahoma', value: 'Tahoma, Geneva, sans-serif',
|
31
|
+
style: { fontFamily: 'Tahoma, Geneva, sans-serif' } },
|
32
|
+
{ text: 'Times New Roman', value: '\'Times New Roman\', Times,serif',
|
33
|
+
style: { fontFamily: '\'Times New Roman\', Times,serif' } },
|
34
|
+
{ text: 'Trebuchet MS', value: '\'Trebuchet MS\', Helvetica, sans-serif',
|
35
|
+
style: { fontFamily: '\'Trebuchet MS\', Helvetica, sans-serif' } },
|
36
|
+
{ text: 'Verdana', value: 'Verdana, Geneva, sans-serif',
|
37
|
+
style: { fontFamily: 'Verdana, Geneva, sans-serif' } }
|
38
|
+
];
|
39
|
+
/**
|
40
|
+
* @hidden
|
41
|
+
*/
|
42
|
+
export const rotations = [
|
43
|
+
{ text: '0°', value: 0 },
|
44
|
+
{ text: '45°', value: 45 },
|
45
|
+
{ text: '90°', value: 90 },
|
46
|
+
{ text: '135°', value: 135 },
|
47
|
+
{ text: '180°', value: 180 }
|
48
|
+
];
|
49
|
+
/**
|
50
|
+
* @hidden
|
51
|
+
*/
|
52
|
+
export const positions = [
|
53
|
+
{ text: 'Top', value: 'top' },
|
54
|
+
{ text: 'Bottom', value: 'bottom' },
|
55
|
+
{ text: 'Left', value: 'left' },
|
56
|
+
{ text: 'Right', value: 'right' }
|
57
|
+
];
|
58
|
+
const columnType = 'column';
|
59
|
+
const barType = 'bar';
|
60
|
+
const lineType = 'line';
|
61
|
+
const pieType = 'pie';
|
62
|
+
const scatterType = 'scatter';
|
63
|
+
const categoricalTypes = [columnType, barType, lineType, scatterType];
|
64
|
+
const scatterSeries = {
|
65
|
+
type: lineType,
|
66
|
+
width: 0
|
67
|
+
};
|
68
|
+
/**
|
69
|
+
* @hidden
|
70
|
+
*/
|
71
|
+
export const isCategorical = (type) => type && categoricalTypes.includes(type);
|
72
|
+
const categoryTypes = ['string', 'date', 'number'];
|
73
|
+
const valueTypes = ['number'];
|
74
|
+
const axesDefinitions = {
|
75
|
+
bar: [
|
76
|
+
{ axisType: 'category', types: categoryTypes },
|
77
|
+
{ axisType: 'value', types: valueTypes },
|
78
|
+
],
|
79
|
+
column: [
|
80
|
+
{ axisType: 'category', types: categoryTypes },
|
81
|
+
{ axisType: 'value', types: valueTypes },
|
82
|
+
],
|
83
|
+
line: [
|
84
|
+
{ axisType: 'category', types: categoryTypes },
|
85
|
+
{ axisType: 'value', types: valueTypes },
|
86
|
+
],
|
87
|
+
pie: [
|
88
|
+
{ axisType: 'category', types: categoryTypes },
|
89
|
+
{ axisType: 'value', types: valueTypes },
|
90
|
+
],
|
91
|
+
scatter: [
|
92
|
+
{ axisType: 'value', types: valueTypes, count: 2 }
|
93
|
+
]
|
94
|
+
};
|
95
|
+
const getFont = (font, size) => `${size || ''} ${font || ''}`.trim();
|
96
|
+
/**
|
97
|
+
* @hidden
|
98
|
+
*/
|
99
|
+
export const parseFont = (font) => {
|
100
|
+
const spaceIndex = (font || '').indexOf(' ');
|
101
|
+
const size = font?.substring(0, spaceIndex);
|
102
|
+
const name = font?.substring(spaceIndex + 1);
|
103
|
+
return { size, name };
|
104
|
+
};
|
105
|
+
const updateFontName = (fontName, defaultSize, currentFont) => {
|
106
|
+
const { size } = parseFont(currentFont);
|
107
|
+
return fontName ? getFont(fontName, size || defaultSize) : '';
|
108
|
+
};
|
109
|
+
const updateFontSize = (fontSize, defaultFontName, currentFont) => {
|
110
|
+
const { name } = parseFont(currentFont);
|
111
|
+
return fontSize ? getFont(name || defaultFontName, fontSize) : '';
|
112
|
+
};
|
113
|
+
const getCategoryColumnIndex = (data, categoryDef) => {
|
114
|
+
const candidates = [];
|
115
|
+
const firstRecord = data[0].slice();
|
116
|
+
categoryDef.types.forEach((type) => {
|
117
|
+
firstRecord.forEach((item, i) => {
|
118
|
+
if (typeof item.value === type) {
|
119
|
+
candidates.push(i);
|
120
|
+
}
|
121
|
+
});
|
122
|
+
});
|
123
|
+
const result = candidates.findIndex((index) => {
|
124
|
+
const values = data.map((record) => record[index].value);
|
125
|
+
return new Set(values).size === values.length;
|
126
|
+
});
|
127
|
+
return Math.max(result, 0);
|
128
|
+
};
|
129
|
+
const getValueColumnIndexes = (data, valuesDef) => {
|
130
|
+
const candidates = [];
|
131
|
+
const firstRecord = data[0].slice();
|
132
|
+
valuesDef.forEach((def) => {
|
133
|
+
def.types.forEach((type) => {
|
134
|
+
firstRecord.forEach((item, i) => {
|
135
|
+
if (typeof item.value === type) {
|
136
|
+
candidates.push(i);
|
137
|
+
}
|
138
|
+
});
|
139
|
+
});
|
140
|
+
});
|
141
|
+
return candidates;
|
142
|
+
};
|
143
|
+
const emptyState = () => structuredClone({
|
144
|
+
columns: [],
|
145
|
+
data: [],
|
146
|
+
series: [],
|
147
|
+
initialSeries: [],
|
148
|
+
categoryAxis: [],
|
149
|
+
valueAxis: [{ labels: { visible: true } }],
|
150
|
+
area: {
|
151
|
+
margin: { left: undefined, right: undefined, top: undefined, bottom: undefined }
|
152
|
+
},
|
153
|
+
});
|
154
|
+
const categoryValueChartState = (data, seriesType, options) => {
|
155
|
+
const state = emptyState();
|
156
|
+
state.seriesType = seriesType;
|
157
|
+
state.data = data;
|
158
|
+
const chartDef = axesDefinitions[seriesType];
|
159
|
+
if (!chartDef) {
|
160
|
+
return state;
|
161
|
+
}
|
162
|
+
const firstRecord = data[0].slice();
|
163
|
+
state.columns = data[0].map(i => String(i.field));
|
164
|
+
const categoryDef = chartDef.find(def => def.axisType === 'category');
|
165
|
+
let catIndex = -1;
|
166
|
+
if (categoryDef) {
|
167
|
+
catIndex = options?.categoryAxis ? state.columns.indexOf(options?.categoryAxis) : getCategoryColumnIndex(data, categoryDef);
|
168
|
+
}
|
169
|
+
const valuesDef = chartDef.filter(def => def.axisType === 'value');
|
170
|
+
let valuesIndexes = getValueColumnIndexes(data, valuesDef);
|
171
|
+
if (valuesIndexes.includes(catIndex)) {
|
172
|
+
valuesIndexes = valuesIndexes.filter(index => index !== catIndex);
|
173
|
+
}
|
174
|
+
const series = [];
|
175
|
+
valuesIndexes.forEach(index => {
|
176
|
+
const valuesColumn = firstRecord[index];
|
177
|
+
const valuesResult = [];
|
178
|
+
data.forEach(record => {
|
179
|
+
valuesResult.push(record[index].value);
|
180
|
+
});
|
181
|
+
series.push({
|
182
|
+
name: valuesColumn.field,
|
183
|
+
type: seriesType,
|
184
|
+
data: valuesResult,
|
185
|
+
stack: false,
|
186
|
+
labels: { visible: true },
|
187
|
+
...(seriesType === scatterType ? scatterSeries : {})
|
188
|
+
});
|
189
|
+
});
|
190
|
+
const categories = catIndex > -1 ? data.map(item => String(item[catIndex].value)) : [];
|
191
|
+
if (series.length) {
|
192
|
+
state.series = series.map((s, i) => ({ ...s, id: i }));
|
193
|
+
state.initialSeries = structuredClone(state.series);
|
194
|
+
}
|
195
|
+
if (categories.length) {
|
196
|
+
state.categoryAxis = [{ categories, labels: { visible: true } }];
|
197
|
+
state.categoryField = state.columns[catIndex];
|
198
|
+
}
|
199
|
+
state.legend = { visible: true };
|
200
|
+
state.title = { text: null };
|
201
|
+
state.subtitle = { text: null };
|
202
|
+
return state;
|
203
|
+
};
|
204
|
+
const pieChartState = (data, seriesType, options) => {
|
205
|
+
const state = emptyState();
|
206
|
+
state.seriesType = seriesType;
|
207
|
+
state.data = data;
|
208
|
+
const chartDef = axesDefinitions[seriesType];
|
209
|
+
if (!chartDef) {
|
210
|
+
return state;
|
211
|
+
}
|
212
|
+
const categoriesAxis = data[0].map(i => i.field);
|
213
|
+
const categoryDef = chartDef.find(def => def.axisType === 'category');
|
214
|
+
let catIndex = -1;
|
215
|
+
if (categoryDef) {
|
216
|
+
catIndex = options?.categoryAxis ? categoriesAxis.indexOf(options?.categoryAxis) : getCategoryColumnIndex(data, categoryDef);
|
217
|
+
}
|
218
|
+
const valuesDef = chartDef.filter(def => def.axisType === 'value');
|
219
|
+
let valuesIndexes = [];
|
220
|
+
if (options?.valueAxis) {
|
221
|
+
valuesIndexes = [categoriesAxis.indexOf(options.valueAxis)];
|
222
|
+
}
|
223
|
+
else {
|
224
|
+
valuesIndexes = getValueColumnIndexes(data, valuesDef);
|
225
|
+
}
|
226
|
+
if (valuesIndexes.includes(catIndex) && valuesIndexes.length > 1) {
|
227
|
+
valuesIndexes = valuesIndexes.filter(index => index !== catIndex);
|
228
|
+
}
|
229
|
+
if (typeof valuesDef[0].count === 'number') {
|
230
|
+
valuesIndexes = valuesIndexes.slice(0, valuesDef[0].count);
|
231
|
+
}
|
232
|
+
const categories = catIndex > -1 ? data.map(item => String(item[catIndex].value)) : [];
|
233
|
+
const flatData = [];
|
234
|
+
data.forEach(item => {
|
235
|
+
const record = {};
|
236
|
+
valuesIndexes.forEach((index) => {
|
237
|
+
const col = item[index];
|
238
|
+
record[col.field] = col.value;
|
239
|
+
record[item[catIndex].field] = item[catIndex].value;
|
240
|
+
});
|
241
|
+
flatData.push(record);
|
242
|
+
});
|
243
|
+
state.columns = categoriesAxis;
|
244
|
+
state.categoryAxis = [{ categories, title: { text: '' } }];
|
245
|
+
state.series = [{
|
246
|
+
id: 0,
|
247
|
+
data: flatData,
|
248
|
+
type: seriesType,
|
249
|
+
name: categoriesAxis[catIndex],
|
250
|
+
labels: { visible: true },
|
251
|
+
categoryField: categoriesAxis[catIndex],
|
252
|
+
field: categoriesAxis[valuesIndexes[0]]
|
253
|
+
}];
|
254
|
+
state.categoryField = categoriesAxis[catIndex];
|
255
|
+
state.valueField = categoriesAxis[valuesIndexes[0]];
|
256
|
+
state.initialSeries = structuredClone(state.series);
|
257
|
+
return state;
|
258
|
+
};
|
259
|
+
/**
|
260
|
+
* @hidden
|
261
|
+
*/
|
262
|
+
export const createState = (data, seriesType) => {
|
263
|
+
return (isCategorical(seriesType) ? categoryValueChartState : pieChartState)(data, seriesType);
|
264
|
+
};
|
265
|
+
/**
|
266
|
+
* @hidden
|
267
|
+
*/
|
268
|
+
export var ActionTypes;
|
269
|
+
(function (ActionTypes) {
|
270
|
+
ActionTypes[ActionTypes["seriesType"] = 0] = "seriesType";
|
271
|
+
ActionTypes[ActionTypes["stacked"] = 1] = "stacked";
|
272
|
+
ActionTypes[ActionTypes["categoryAxisX"] = 2] = "categoryAxisX";
|
273
|
+
ActionTypes[ActionTypes["valueAxisY"] = 3] = "valueAxisY";
|
274
|
+
ActionTypes[ActionTypes["seriesChange"] = 4] = "seriesChange";
|
275
|
+
ActionTypes[ActionTypes["areaMarginLeft"] = 5] = "areaMarginLeft";
|
276
|
+
ActionTypes[ActionTypes["areaMarginRight"] = 6] = "areaMarginRight";
|
277
|
+
ActionTypes[ActionTypes["areaMarginTop"] = 7] = "areaMarginTop";
|
278
|
+
ActionTypes[ActionTypes["areaMarginBottom"] = 8] = "areaMarginBottom";
|
279
|
+
ActionTypes[ActionTypes["areaBackground"] = 9] = "areaBackground";
|
280
|
+
ActionTypes[ActionTypes["titleText"] = 10] = "titleText";
|
281
|
+
ActionTypes[ActionTypes["titleFontName"] = 11] = "titleFontName";
|
282
|
+
ActionTypes[ActionTypes["titleFontSize"] = 12] = "titleFontSize";
|
283
|
+
ActionTypes[ActionTypes["titleColor"] = 13] = "titleColor";
|
284
|
+
ActionTypes[ActionTypes["subtitleText"] = 14] = "subtitleText";
|
285
|
+
ActionTypes[ActionTypes["subtitleFontName"] = 15] = "subtitleFontName";
|
286
|
+
ActionTypes[ActionTypes["subtitleFontSize"] = 16] = "subtitleFontSize";
|
287
|
+
ActionTypes[ActionTypes["subtitleColor"] = 17] = "subtitleColor";
|
288
|
+
ActionTypes[ActionTypes["seriesColor"] = 18] = "seriesColor";
|
289
|
+
ActionTypes[ActionTypes["seriesLabel"] = 19] = "seriesLabel";
|
290
|
+
ActionTypes[ActionTypes["legendVisible"] = 20] = "legendVisible";
|
291
|
+
ActionTypes[ActionTypes["legendFontName"] = 21] = "legendFontName";
|
292
|
+
ActionTypes[ActionTypes["legendFontSize"] = 22] = "legendFontSize";
|
293
|
+
ActionTypes[ActionTypes["legendColor"] = 23] = "legendColor";
|
294
|
+
ActionTypes[ActionTypes["legendPosition"] = 24] = "legendPosition";
|
295
|
+
ActionTypes[ActionTypes["categoryAxisTitleText"] = 25] = "categoryAxisTitleText";
|
296
|
+
ActionTypes[ActionTypes["categoryAxisTitleFontName"] = 26] = "categoryAxisTitleFontName";
|
297
|
+
ActionTypes[ActionTypes["categoryAxisTitleFontSize"] = 27] = "categoryAxisTitleFontSize";
|
298
|
+
ActionTypes[ActionTypes["categoryAxisTitleColor"] = 28] = "categoryAxisTitleColor";
|
299
|
+
ActionTypes[ActionTypes["categoryAxisLabelsFontName"] = 29] = "categoryAxisLabelsFontName";
|
300
|
+
ActionTypes[ActionTypes["categoryAxisLabelsFontSize"] = 30] = "categoryAxisLabelsFontSize";
|
301
|
+
ActionTypes[ActionTypes["categoryAxisLabelsColor"] = 31] = "categoryAxisLabelsColor";
|
302
|
+
ActionTypes[ActionTypes["categoryAxisLabelsRotation"] = 32] = "categoryAxisLabelsRotation";
|
303
|
+
ActionTypes[ActionTypes["categoryAxisReverseOrder"] = 33] = "categoryAxisReverseOrder";
|
304
|
+
ActionTypes[ActionTypes["valueAxisTitleText"] = 34] = "valueAxisTitleText";
|
305
|
+
ActionTypes[ActionTypes["valueAxisTitleFontName"] = 35] = "valueAxisTitleFontName";
|
306
|
+
ActionTypes[ActionTypes["valueAxisTitleFontSize"] = 36] = "valueAxisTitleFontSize";
|
307
|
+
ActionTypes[ActionTypes["valueAxisTitleColor"] = 37] = "valueAxisTitleColor";
|
308
|
+
ActionTypes[ActionTypes["valueAxisLabelsFormat"] = 38] = "valueAxisLabelsFormat";
|
309
|
+
ActionTypes[ActionTypes["valueAxisLabelsFontName"] = 39] = "valueAxisLabelsFontName";
|
310
|
+
ActionTypes[ActionTypes["valueAxisLabelsFontSize"] = 40] = "valueAxisLabelsFontSize";
|
311
|
+
ActionTypes[ActionTypes["valueAxisLabelsColor"] = 41] = "valueAxisLabelsColor";
|
312
|
+
ActionTypes[ActionTypes["valueAxisLabelsRotation"] = 42] = "valueAxisLabelsRotation";
|
313
|
+
})(ActionTypes || (ActionTypes = {}));
|
314
|
+
/**
|
315
|
+
* @hidden
|
316
|
+
*/
|
317
|
+
export const mergeStates = (state, newState) => {
|
318
|
+
newState.legend = state.legend;
|
319
|
+
newState.area = state.area;
|
320
|
+
newState.title = state.title;
|
321
|
+
newState.subtitle = state.subtitle;
|
322
|
+
if (newState.series.length === state.series.length) {
|
323
|
+
for (let i = 0; i < newState.series.length; i++) {
|
324
|
+
newState.series[i].color = state.series[i].color;
|
325
|
+
newState.series[i].labels = state.series[i].labels;
|
326
|
+
}
|
327
|
+
}
|
328
|
+
if (state.series.every(s => s.labels?.visible)) {
|
329
|
+
newState.series.forEach(s => {
|
330
|
+
s.labels = s.labels || {};
|
331
|
+
s.labels.visible = true;
|
332
|
+
});
|
333
|
+
}
|
334
|
+
return newState;
|
335
|
+
};
|
336
|
+
/**
|
337
|
+
* @hidden
|
338
|
+
*/
|
339
|
+
export const updateState = (currentState, action, value) => {
|
340
|
+
const state = { ...currentState };
|
341
|
+
switch (action) {
|
342
|
+
case ActionTypes.seriesType:
|
343
|
+
return createState(state.data, value);
|
344
|
+
case ActionTypes.stacked:
|
345
|
+
state.series = state.series.map(s => ({ ...s, stack: value }));
|
346
|
+
return state;
|
347
|
+
case ActionTypes.categoryAxisX: {
|
348
|
+
if (state.seriesType && isCategorical(state.seriesType)) {
|
349
|
+
const newState = categoryValueChartState(state.data, state.seriesType, { categoryAxis: value });
|
350
|
+
return mergeStates(state, newState);
|
351
|
+
}
|
352
|
+
else if (state.seriesType === pieType) {
|
353
|
+
const newState = pieChartState(state.data, state.seriesType, { categoryAxis: value });
|
354
|
+
return mergeStates(state, newState);
|
355
|
+
}
|
356
|
+
return state;
|
357
|
+
}
|
358
|
+
case ActionTypes.valueAxisY: {
|
359
|
+
if (state.seriesType === pieType) {
|
360
|
+
const newState = pieChartState(state.data, state.seriesType, { categoryAxis: state.categoryField, valueAxis: value });
|
361
|
+
return mergeStates(state, newState);
|
362
|
+
}
|
363
|
+
return state;
|
364
|
+
}
|
365
|
+
case ActionTypes.seriesChange:
|
366
|
+
state.series = value;
|
367
|
+
return state;
|
368
|
+
case ActionTypes.areaMarginLeft:
|
369
|
+
state.area = { ...state.area, margin: { ...(state.area?.margin || {}), left: value } };
|
370
|
+
return state;
|
371
|
+
case ActionTypes.areaMarginRight:
|
372
|
+
state.area = { ...state.area, margin: { ...(state.area?.margin || {}), right: value } };
|
373
|
+
return state;
|
374
|
+
case ActionTypes.areaMarginTop:
|
375
|
+
state.area = { ...state.area, margin: { ...(state.area?.margin || {}), top: value } };
|
376
|
+
return state;
|
377
|
+
case ActionTypes.areaMarginBottom:
|
378
|
+
state.area = { ...state.area, margin: { ...(state.area?.margin || {}), bottom: value } };
|
379
|
+
return state;
|
380
|
+
case ActionTypes.areaBackground:
|
381
|
+
state.area = { ...state.area, background: value };
|
382
|
+
return state;
|
383
|
+
case ActionTypes.titleText:
|
384
|
+
state.title = { ...state.title, text: value };
|
385
|
+
return state;
|
386
|
+
case ActionTypes.titleFontName: {
|
387
|
+
state.title = { ...state.title, font: updateFontName(value, fontSizes[0].value, state.title?.font) };
|
388
|
+
return state;
|
389
|
+
}
|
390
|
+
case ActionTypes.titleFontSize:
|
391
|
+
state.title = { ...state.title, font: updateFontSize(value, fontNames[0].value, state.title?.font) };
|
392
|
+
return state;
|
393
|
+
case ActionTypes.titleColor:
|
394
|
+
state.title = { ...state.title, color: value };
|
395
|
+
return state;
|
396
|
+
case ActionTypes.subtitleText:
|
397
|
+
state.subtitle = { ...state.subtitle, text: value };
|
398
|
+
return state;
|
399
|
+
case ActionTypes.subtitleFontName:
|
400
|
+
state.subtitle = { ...state.subtitle, font: updateFontName(value, fontSizes[0].value, state.subtitle?.font) };
|
401
|
+
return state;
|
402
|
+
case ActionTypes.subtitleFontSize:
|
403
|
+
state.subtitle = { ...state.subtitle, font: updateFontSize(value, fontNames[0].value, state.subtitle?.font) };
|
404
|
+
return state;
|
405
|
+
case ActionTypes.subtitleColor:
|
406
|
+
state.subtitle = { ...state.subtitle, color: value };
|
407
|
+
return state;
|
408
|
+
case ActionTypes.seriesColor:
|
409
|
+
state.series = state.series.map(s => ({ ...s, color: value.seriesName === s.name ? value.color : s.color }));
|
410
|
+
return state;
|
411
|
+
case ActionTypes.seriesLabel:
|
412
|
+
state.series = state.series.map(s => {
|
413
|
+
if (value.all || value.seriesName === s.name) {
|
414
|
+
return { ...s, labels: { visible: value.visible } };
|
415
|
+
}
|
416
|
+
return s;
|
417
|
+
});
|
418
|
+
return state;
|
419
|
+
case ActionTypes.legendVisible:
|
420
|
+
state.legend = { ...state.legend, visible: value };
|
421
|
+
return state;
|
422
|
+
case ActionTypes.legendFontName: {
|
423
|
+
state.legend = { ...state.legend, labels: { ...state.legend?.labels, font: updateFontName(value, fontSizes[0].value, state.legend?.labels?.font) } };
|
424
|
+
return state;
|
425
|
+
}
|
426
|
+
case ActionTypes.legendFontSize:
|
427
|
+
state.legend = { ...state.legend, labels: { ...state.legend?.labels, font: updateFontSize(value, fontNames[0].value, state.legend?.labels?.font) } };
|
428
|
+
return state;
|
429
|
+
case ActionTypes.legendColor:
|
430
|
+
state.legend = { ...state.legend, labels: { ...state.legend?.labels, color: value } };
|
431
|
+
return state;
|
432
|
+
case ActionTypes.legendPosition:
|
433
|
+
state.legend = { ...state.legend, position: value };
|
434
|
+
return state;
|
435
|
+
case ActionTypes.categoryAxisTitleText:
|
436
|
+
state.categoryAxis = state.categoryAxis?.map(axis => ({ ...axis, title: { ...axis.title, text: value } }));
|
437
|
+
return state;
|
438
|
+
case ActionTypes.categoryAxisTitleFontName: {
|
439
|
+
state.categoryAxis = state.categoryAxis?.map(axis => ({ ...axis, title: { ...axis.title, font: updateFontName(value, fontSizes[0].value, axis.title?.font) } }));
|
440
|
+
return state;
|
441
|
+
}
|
442
|
+
case ActionTypes.categoryAxisTitleFontSize:
|
443
|
+
state.categoryAxis = state.categoryAxis?.map(axis => ({ ...axis, title: { ...axis.title, font: updateFontSize(value, fontNames[0].value, axis.title?.font) } }));
|
444
|
+
return state;
|
445
|
+
case ActionTypes.categoryAxisTitleColor:
|
446
|
+
state.categoryAxis = state.categoryAxis?.map(axis => ({ ...axis, title: { ...axis.title, color: value } }));
|
447
|
+
return state;
|
448
|
+
case ActionTypes.categoryAxisLabelsFontName: {
|
449
|
+
state.categoryAxis = state.categoryAxis?.map(axis => ({ ...axis, labels: { ...axis.labels, font: updateFontName(value, fontSizes[0].value, axis.labels?.font) } }));
|
450
|
+
return state;
|
451
|
+
}
|
452
|
+
case ActionTypes.categoryAxisLabelsFontSize:
|
453
|
+
state.categoryAxis = state.categoryAxis?.map(axis => ({ ...axis, labels: { ...axis.labels, font: updateFontSize(value, fontNames[0].value, axis.labels?.font) } }));
|
454
|
+
return state;
|
455
|
+
case ActionTypes.categoryAxisLabelsColor:
|
456
|
+
state.categoryAxis = state.categoryAxis?.map(axis => ({ ...axis, labels: { ...axis.labels, color: value } }));
|
457
|
+
return state;
|
458
|
+
case ActionTypes.categoryAxisLabelsRotation:
|
459
|
+
state.categoryAxis = state.categoryAxis?.map(axis => ({ ...axis, labels: { ...axis.labels, rotation: value } }));
|
460
|
+
return state;
|
461
|
+
case ActionTypes.categoryAxisReverseOrder:
|
462
|
+
state.categoryAxis = state.categoryAxis?.map(axis => ({ ...axis, reverse: value }));
|
463
|
+
return state;
|
464
|
+
case ActionTypes.valueAxisTitleText: {
|
465
|
+
if (!state.valueAxis || state.valueAxis.length === 0) {
|
466
|
+
state.valueAxis = [{ title: { text: value } }];
|
467
|
+
}
|
468
|
+
else {
|
469
|
+
state.valueAxis = state.valueAxis?.map(axis => ({ ...axis, title: { ...axis.title, text: value } }));
|
470
|
+
}
|
471
|
+
return state;
|
472
|
+
}
|
473
|
+
case ActionTypes.valueAxisTitleFontName: {
|
474
|
+
state.valueAxis = state.valueAxis?.map(axis => ({ ...axis, title: { ...axis.title, font: updateFontName(value, fontSizes[0].value, axis.title?.font) } }));
|
475
|
+
return state;
|
476
|
+
}
|
477
|
+
case ActionTypes.valueAxisTitleFontSize:
|
478
|
+
state.valueAxis = state.valueAxis?.map(axis => ({ ...axis, title: { ...axis.title, font: updateFontSize(value, fontNames[0].value, axis.title?.font) } }));
|
479
|
+
return state;
|
480
|
+
case ActionTypes.valueAxisTitleColor:
|
481
|
+
state.valueAxis = state.valueAxis?.map(axis => ({ ...axis, title: { ...axis.title, color: value } }));
|
482
|
+
return state;
|
483
|
+
case ActionTypes.valueAxisLabelsFormat:
|
484
|
+
state.valueAxis = state.valueAxis?.map(axis => ({ ...axis, labels: { ...axis.labels, format: value } }));
|
485
|
+
return state;
|
486
|
+
case ActionTypes.valueAxisLabelsFontName: {
|
487
|
+
state.valueAxis = state.valueAxis?.map(axis => ({ ...axis, labels: { ...axis.labels, font: updateFontName(value, fontSizes[0].value, axis.labels?.font) } }));
|
488
|
+
return state;
|
489
|
+
}
|
490
|
+
case ActionTypes.valueAxisLabelsFontSize:
|
491
|
+
state.valueAxis = state.valueAxis?.map(axis => ({ ...axis, labels: { ...axis.labels, font: updateFontSize(value, fontNames[0].value, axis.labels?.font) } }));
|
492
|
+
return state;
|
493
|
+
case ActionTypes.valueAxisLabelsColor:
|
494
|
+
state.valueAxis = state.valueAxis?.map(axis => ({ ...axis, labels: { ...axis.labels, color: value } }));
|
495
|
+
return state;
|
496
|
+
case ActionTypes.valueAxisLabelsRotation:
|
497
|
+
state.valueAxis = state.valueAxis?.map(axis => ({ ...axis, labels: { ...axis.labels, rotation: value } }));
|
498
|
+
return state;
|
499
|
+
default:
|
500
|
+
return state;
|
501
|
+
}
|
502
|
+
};
|