@operato/scene-chartjs 9.1.1 → 10.0.0-beta.2

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.
@@ -1,150 +1,169 @@
1
1
  import { TinyColor } from '@ctrl/tinycolor';
2
2
  import { format as formatText } from '@operato/utils/format.js';
3
+ /**
4
+ * v2 형식의 scene-chart config를 Chart.js v4 형식으로 변환한다.
5
+ * 기존 보드 설정(v2 형식)을 입력받아 v4 호환 config를 새 객체로 반환.
6
+ */
3
7
  export function convertConfigure(chart) {
4
8
  if (!chart)
5
- return;
6
- var data = chart.data || {};
7
- var datasets = data.datasets || [];
8
- var options = chart.options || {};
9
- var scales = options.scales || {};
10
- var xAxes;
11
- var yAxes;
12
- var scale;
13
- var legend = options.legend || {};
14
- var tooltips = options.tooltip === false ? undefined : (options.tooltips = options.tooltips || {});
15
- var multiAxis = options.multiAxis;
16
- var stacked = false;
17
- var yStacked = [false, false];
18
- var fontSize = Number(options.defaultFontSize);
19
- var fontFamily = options.defaultFontFamily;
20
- var fontColor = options.defaultFontColor;
21
- var theme = options.theme;
22
- // backward compatible
23
- _configureBackwardsCompatible(chart.type, options);
24
- // setup series configure
25
- for (let i in datasets) {
26
- let series = datasets[i];
27
- if (options.stacked && !series.stack) {
28
- series.stack = 'A';
29
- }
30
- /*
31
- * TODO from chartjs 2.9, categoryPercentage, barPercentage properties move to dataset.
32
- * so need to move related properties - categorySpacing, barSpacing should be moved to series.
33
- */
34
- if (chart.type == 'bar') {
35
- let categorySpacing = (scales.xAxes && scales.xAxes[0].categorySpacing) || 0;
36
- let barSpacing = (scales.xAxes && scales.xAxes[0].barSpacing) || 0;
37
- series.categoryPercentage = 1 - categorySpacing || 1;
38
- series.barPercentage = 1 - barSpacing || 0.8;
39
- }
40
- else if (chart.type == 'horizontalBar') {
41
- let categorySpacing = (scales.yAxes && scales.yAxes[0].categorySpacing) || 0;
42
- let barSpacing = (scales.yAxes && scales.yAxes[0].barSpacing) || 0;
43
- series.categoryPercentage = 1 - categorySpacing || 1;
44
- series.barPercentage = 1 - barSpacing || 0.8;
9
+ return chart;
10
+ const { type: chartType, data: fromData, options: fromOptions } = chart;
11
+ const options = fromOptions || {};
12
+ const datasets = fromData?.datasets || [];
13
+ const fontSize = Number(options.defaultFontSize) || undefined;
14
+ const fontFamily = options.defaultFontFamily;
15
+ const fontColor = options.defaultFontColor;
16
+ const theme = options.theme;
17
+ const multiAxis = options.multiAxis;
18
+ const stacked = options.stacked;
19
+ const xGridLine = options.xGridLine;
20
+ const yGridLine = options.yGridLine;
21
+ const y2ndGridLine = options.y2ndGridLine;
22
+ const showTooltip = options.tooltip !== false;
23
+ // backward compatible: ensure scales/scale exist
24
+ _ensureBackwardsCompatible(chartType, options);
25
+ const scales = options.scales || {};
26
+ const { xAxes = [], yAxes = [] } = scales;
27
+ // --- Build v4 scales object ---
28
+ const toScales = {};
29
+ const isCartesian = ['line', 'bar', 'horizontalBar'].includes(chartType);
30
+ if (isCartesian) {
31
+ // Determine actual xAxes/yAxes depending on horizontalBar swap
32
+ const actualXAxes = chartType === 'horizontalBar' ? yAxes : xAxes;
33
+ const actualYAxes = chartType === 'horizontalBar' ? xAxes : yAxes;
34
+ actualXAxes.forEach((xAxis, index) => {
35
+ const id = actualXAxes.length > 1 ? `x${index + 1}` : 'x';
36
+ toScales[id] = _buildScale({
37
+ axis: 'x',
38
+ id,
39
+ position: 'bottom',
40
+ display: xAxis.display !== false,
41
+ title: {
42
+ display: !!xAxis.axisTitle,
43
+ text: xAxis.axisTitle
44
+ },
45
+ grid: {
46
+ display: chartType === 'horizontalBar' ? yGridLine : xGridLine
47
+ },
48
+ ticks: xAxis.ticks,
49
+ stacked: stacked || false
50
+ }, { fontSize, fontFamily, fontColor, theme });
51
+ });
52
+ actualYAxes.forEach((yAxis, index) => {
53
+ const id = yAxis.id || (index === 0 ? 'left' : 'right');
54
+ const isSecondary = index > 0 || id === 'right';
55
+ const display = isSecondary ? (multiAxis || false) : (yAxis.display !== false);
56
+ toScales[id] = _buildScale({
57
+ axis: 'y',
58
+ id,
59
+ position: yAxis.position || id,
60
+ display,
61
+ title: {
62
+ display: !!yAxis.axisTitle,
63
+ text: yAxis.axisTitle
64
+ },
65
+ grid: {
66
+ display: isSecondary ? y2ndGridLine : yGridLine
67
+ },
68
+ ticks: yAxis.ticks,
69
+ stacked: stacked || false
70
+ }, { fontSize, fontFamily, fontColor, theme });
71
+ });
72
+ }
73
+ // radar/polarArea: handle scale (radial)
74
+ if (chartType === 'radar' || chartType === 'polarArea') {
75
+ const scale = options.scale || {};
76
+ toScales['r'] = {
77
+ type: 'radialLinear',
78
+ ticks: {
79
+ ...(scale.ticks || {}),
80
+ backdropColor: options.fillStyle || '#00ff0000'
81
+ },
82
+ pointLabels: {
83
+ font: { size: fontSize, family: fontFamily },
84
+ ...(fontColor ? { color: fontColor } : {})
85
+ }
86
+ };
87
+ if (fontColor) {
88
+ toScales['r'].ticks.color = fontColor;
45
89
  }
46
- _setSeriesConfigures(series, chart);
47
- if (!multiAxis) {
48
- if (series.yAxisID == 'right')
49
- series.yAxisID = 'left';
90
+ }
91
+ // --- Build v4 datasets ---
92
+ // axis → dataset 속성 마이그레이션 (bar thickness )
93
+ let barCategoryPercentage;
94
+ let barPercentage;
95
+ let barThickness;
96
+ if (chartType === 'bar' || chartType === 'horizontalBar') {
97
+ const barAxis = chartType === 'bar' ? xAxes[0] : yAxes[0];
98
+ if (barAxis) {
99
+ barCategoryPercentage = barAxis.categorySpacing != null ? 1 - barAxis.categorySpacing : undefined;
100
+ barPercentage = barAxis.barSpacing != null ? 1 - barAxis.barSpacing : undefined;
101
+ barThickness = barAxis.barThickness;
50
102
  }
51
103
  }
52
- delete options.stacked;
53
- var leftSeries = datasets.filter(d => d.yAxisID == 'left');
54
- var rightSeries = datasets.filter(d => d.yAxisID == 'right');
55
- leftSeries.forEach(s => {
56
- var filtered = leftSeries.filter(ss => s.stack == ss.stack);
57
- if (filtered.length > 1) {
58
- yStacked[0] = true;
59
- return;
104
+ const toDatasets = datasets.map((dataset, index) => {
105
+ const series = { ...dataset };
106
+ // horizontalBar series type bar
107
+ if (series.type === 'horizontalBar') {
108
+ series.type = 'bar';
60
109
  }
61
- });
62
- rightSeries.forEach(s => {
63
- var filtered = rightSeries.filter(ss => s.stack == ss.stack);
64
- if (filtered.length > 1) {
65
- yStacked[1] = true;
66
- return;
110
+ // multiAxis off: all series to left axis
111
+ if (!multiAxis && series.yAxisID === 'right') {
112
+ series.yAxisID = 'left';
67
113
  }
68
- });
69
- stacked = yStacked[0] || yStacked[1];
70
- // setup options
71
- // 1. setup scales
72
- switch (chart.type) {
73
- case 'line':
74
- case 'bar':
75
- case 'horizontalBar':
76
- xAxes = scales.xAxes || [];
77
- yAxes = scales.yAxes || [];
78
- if (chart.type == 'horizontalBar') {
79
- xAxes = scales.yAxes || [];
80
- yAxes = scales.xAxes || [];
81
- }
82
- // 1-1. setup xAxes
83
- for (let i in xAxes) {
84
- let axis = xAxes[i];
85
- _setStacked(axis, stacked);
86
- _setScalesFont(axis, {
87
- fontSize,
88
- fontFamily
89
- });
90
- _setScalesAutoMinMax(axis);
91
- _setScalesTickRotation(axis);
92
- _setAxisTitle(axis);
93
- _setScalesTheme(axis, theme, fontColor);
94
- _appendTickCallback(axis.ticks);
95
- axis.gridLines.display = options.xGridLine;
114
+ // bar spacing properties (moved from axis to dataset in v4)
115
+ if (chartType === 'bar' || chartType === 'horizontalBar') {
116
+ if (barCategoryPercentage != null)
117
+ series.categoryPercentage = barCategoryPercentage;
118
+ if (barPercentage != null)
119
+ series.barPercentage = barPercentage;
120
+ if (barThickness != null)
121
+ series.barThickness = barThickness;
122
+ }
123
+ // stack: v4 format
124
+ const isPieType = chartType === 'pie' || chartType === 'doughnut';
125
+ if (!isPieType) {
126
+ if (stacked && !dataset.stack) {
127
+ series.stack = '__all__';
96
128
  }
97
- // 1-2. setup yAxes
98
- for (let i in yAxes) {
99
- let axis = yAxes[i];
100
- //@ts-ignore
101
- if (i == 1) {
102
- _setMultiAxis(axis, multiAxis);
103
- }
104
- _setStacked(axis, yStacked[i]);
105
- _setScalesFont(axis, {
106
- fontSize,
107
- fontFamily
108
- });
109
- _setScalesAutoMinMax(axis);
110
- _setAxisTitle(axis);
111
- _setScalesTheme(axis, theme, fontColor);
112
- _appendTickCallback(axis.ticks);
113
- //@ts-ignore
114
- if (i == 0)
115
- axis.gridLines.display = options.yGridLine;
116
- //@ts-ignore
117
- if (i == 1)
118
- axis.gridLines.display = options.y2ndGridLine;
129
+ else {
130
+ const type = series.type || chartType;
131
+ series.stack = `__${type}_${series.yAxisID || 'left'}_${index}__`;
119
132
  }
120
- break;
121
- case 'pie':
122
- case 'doughnut':
123
- break;
124
- default:
125
- scale = options.scale || {};
126
- _setScalesFont(scale, {
127
- fontSize,
128
- fontFamily
129
- });
130
- break;
131
- }
132
- // 2. setup legend
133
- _setLegendFont(legend, {
134
- fontSize,
135
- fontFamily
133
+ }
134
+ // series visual setup
135
+ _setupSeriesVisuals(series, chartType);
136
+ return series;
136
137
  });
137
- legend.labels && (legend.labels.boxWidth = 15);
138
- _setLegendTheme(legend, theme, fontColor);
139
- // 3. setup tooltips
140
- options.tooltip &&
141
- _setTooltipFont(tooltips, {
142
- fontSize,
143
- fontFamily
144
- });
145
- options.tooltip && _setTooltipCallback(tooltips);
138
+ // --- Build converted config ---
139
+ const converted = {
140
+ type: chartType === 'horizontalBar' ? 'bar' : chartType,
141
+ data: {
142
+ labels: fromData?.labels || [],
143
+ datasets: toDatasets,
144
+ labelDataKey: fromData?.labelDataKey
145
+ },
146
+ options: {
147
+ maintainAspectRatio: false,
148
+ animation: options.animation,
149
+ indexAxis: chartType === 'horizontalBar' ? 'y' : undefined,
150
+ scales: isCartesian || chartType === 'radar' || chartType === 'polarArea' ? toScales : undefined,
151
+ plugins: {
152
+ legend: _buildLegend(options.legend || {}, { fontSize, fontFamily, fontColor, theme }),
153
+ tooltip: showTooltip
154
+ ? _buildTooltip({ fontSize, fontFamily })
155
+ : { enabled: false },
156
+ },
157
+ // preserve custom properties for datalabels font callback
158
+ defaultFontFamily: fontFamily,
159
+ defaultFontSize: fontSize,
160
+ defaultFontColor: fontColor
161
+ }
162
+ };
163
+ return converted;
146
164
  }
147
- function _configureBackwardsCompatible(type, options) {
165
+ // --- Helper functions ---
166
+ function _ensureBackwardsCompatible(type, options) {
148
167
  switch (type) {
149
168
  case 'horizontalBar':
150
169
  if (!options.scales)
@@ -152,16 +171,10 @@ function _configureBackwardsCompatible(type, options) {
152
171
  break;
153
172
  case 'radar':
154
173
  case 'polarArea':
155
- if (options.defaultFontColor) {
156
- options.scale.ticks.fontColor = options.defaultFontColor;
157
- if (options.scale.pointLabels) {
158
- options.scale.pointLabels.fontColor = options.defaultFontColor;
159
- }
160
- else {
161
- options.scale.pointLabels = { fontColor: options.defaultFontColor };
162
- }
163
- }
164
- options.scale.ticks.backdropColor = options.fillStyle ? options.fillStyle : '#00ff0000';
174
+ if (!options.scale)
175
+ options.scale = {};
176
+ if (!options.scale.ticks)
177
+ options.scale.ticks = {};
165
178
  break;
166
179
  case 'line':
167
180
  case 'bar':
@@ -170,23 +183,15 @@ function _configureBackwardsCompatible(type, options) {
170
183
  if (!options.scales.yAxes)
171
184
  options.scales.yAxes = [];
172
185
  if (options.scales.yAxes.length === 1) {
173
- let yAxes = options.scales.yAxes;
174
- yAxes.push({
186
+ options.scales.yAxes.push({
175
187
  position: 'right',
176
188
  id: 'right',
177
189
  display: options.multiAxis || false,
178
190
  gridLines: {
179
- display: (yAxes[0] && yAxes[0].gridLines && yAxes[0].gridLines.display) || false
191
+ display: (options.scales.yAxes[0]?.gridLines?.display) || false
180
192
  },
181
193
  ticks: {
182
- beginAtZero: false,
183
- callback: function (value, index, values) {
184
- var returnValue = value;
185
- if (typeof returnValue == 'number') {
186
- returnValue = returnValue.toLocaleString();
187
- }
188
- return returnValue;
189
- }
194
+ beginAtZero: false
190
195
  }
191
196
  });
192
197
  }
@@ -200,89 +205,91 @@ function _configureBackwardsCompatible(type, options) {
200
205
  break;
201
206
  }
202
207
  }
203
- function _setStacked(axis, stacked) {
204
- axis.stacked = stacked;
205
- }
206
- function _setMultiAxis(axis, multiAxis) {
207
- axis.display = multiAxis;
208
- }
209
- function _setAxisTitle(axis) {
210
- if (!axis.scaleLabel)
211
- axis.scaleLabel = {};
212
- axis.scaleLabel.labelString = axis.axisTitle;
213
- axis.scaleLabel.display = axis.axisTitle ? true : false;
214
- }
215
- function _setScalesFont(axis, { fontSize, fontFamily }) {
216
- axis.ticks = axis.ticks ? axis.ticks : {};
217
- axis.ticks.fontSize = fontSize;
218
- if (fontFamily) {
219
- axis.ticks.fontFamily = fontFamily;
220
- }
221
- ;
222
- axis.pointLabels = {
223
- fontSize,
224
- fontFamily
208
+ function _buildScale(axis, { fontSize, fontFamily, fontColor, theme }) {
209
+ const ticks = axis.ticks ? { ...axis.ticks } : {};
210
+ const baseColor = _getBaseColorFromTheme(theme);
211
+ // v4: min/max moved from ticks to scale level
212
+ const result = {
213
+ axis: axis.axis,
214
+ position: axis.position,
215
+ display: axis.display,
216
+ stacked: axis.stacked,
217
+ title: axis.title || {},
218
+ grid: {
219
+ display: axis.grid?.display,
220
+ tickColor: baseColor.clone().setAlpha(0.5).toString(),
221
+ color: baseColor.clone().setAlpha(0.1).toString()
222
+ },
223
+ ticks: {
224
+ display: ticks.display !== false,
225
+ color: fontColor || baseColor.clone().setAlpha(0.5).toString(),
226
+ font: { size: fontSize, family: fontFamily },
227
+ callback: function (value) {
228
+ if (!Number.isNaN(Number(value))) {
229
+ return Number(value).toLocaleString();
230
+ }
231
+ return value;
232
+ }
233
+ }
225
234
  };
226
- }
227
- function _setScalesAutoMinMax(axis) {
228
- axis.ticks = axis.ticks ? axis.ticks : {};
229
- let autoMin = axis.ticks.autoMin;
230
- let autoMax = axis.ticks.autoMax;
231
- if (autoMin === true) {
232
- delete axis.ticks.min;
235
+ // autoMin/autoMax handling
236
+ if (ticks.autoMin !== true && ticks.min != null) {
237
+ result.min = ticks.min;
233
238
  }
234
- if (autoMax === true) {
235
- delete axis.ticks.max;
239
+ if (ticks.autoMax !== true && ticks.max != null) {
240
+ result.max = ticks.max;
236
241
  }
237
- }
238
- function _setScalesTickRotation(axis) {
239
- axis.ticks = axis.ticks ? axis.ticks : {};
240
- // axis.ticks.maxRotation = 0
241
- }
242
- function _setScalesTheme(axis, theme, fontColor) {
243
- var baseColor = _getBaseColorFromTheme(theme);
244
- axis.gridLines = axis.gridLines ? axis.gridLines : {};
245
- if (axis.gridLines) {
246
- axis.gridLines.zeroLineColor = baseColor.clone().setAlpha(0.5).toString();
247
- axis.gridLines.color = baseColor.clone().setAlpha(0.1).toString();
242
+ if (ticks.beginAtZero) {
243
+ result.beginAtZero = true;
248
244
  }
249
- axis.ticks = axis.ticks ? axis.ticks : {};
250
- axis.ticks.fontColor = fontColor ? fontColor : baseColor.clone().setAlpha(0.5).toString();
251
- }
252
- function _setLegendFont(legend, { fontFamily, fontSize }) {
253
- legend.labels = legend.labels ? legend.labels : {};
254
- legend.labels.fontSize = fontSize;
255
- if (fontFamily)
256
- legend.labels.fontFamily = fontFamily;
245
+ return result;
257
246
  }
258
- function _setLegendTheme(legend, theme, fontColor) {
259
- var baseColor = _getBaseColorFromTheme(theme);
260
- legend.labels = legend.labels ? legend.labels : {};
261
- legend.labels.fontColor = fontColor ? fontColor : baseColor.clone().setAlpha(0.5).toString();
247
+ function _buildLegend(legend, { fontSize, fontFamily, fontColor, theme }) {
248
+ const baseColor = _getBaseColorFromTheme(theme);
249
+ const color = fontColor || baseColor.clone().setAlpha(0.5).toString();
250
+ return {
251
+ display: legend.display,
252
+ position: legend.position,
253
+ labels: {
254
+ boxWidth: 15,
255
+ color,
256
+ font: { size: fontSize, family: fontFamily }
257
+ }
258
+ };
262
259
  }
263
- function _getBaseColorFromTheme(theme) {
264
- let darkColor = '#000';
265
- let lightColor = '#fff';
266
- var baseColor;
267
- switch (theme) {
268
- case 'light':
269
- baseColor = lightColor;
270
- break;
271
- case 'dark':
272
- default:
273
- baseColor = darkColor;
274
- break;
275
- }
276
- baseColor = new TinyColor(baseColor);
277
- return baseColor;
260
+ function _buildTooltip({ fontSize, fontFamily }) {
261
+ return {
262
+ enabled: true,
263
+ mode: 'index',
264
+ intersect: false,
265
+ titleFont: { size: fontSize, family: fontFamily },
266
+ bodyFont: { size: fontSize, family: fontFamily },
267
+ footerFont: { size: fontSize, family: fontFamily },
268
+ callbacks: {
269
+ label: function (context) {
270
+ const dataset = context.dataset;
271
+ const value = context.parsed?.y ?? context.parsed ?? context.raw;
272
+ const label = dataset.label || context.label || '';
273
+ const format = dataset.valueFormat || '';
274
+ const prefix = dataset.valuePrefix || '';
275
+ const suffix = dataset.valueSuffix || '';
276
+ const stringValue = format ? formatText(format, Number(value)) : Number(value).toLocaleString();
277
+ return `${label}: ${prefix + stringValue + suffix}`;
278
+ }
279
+ }
280
+ };
278
281
  }
279
- function _setSeriesConfigures(series, chart) {
280
- var type = series.type || chart.type;
281
- var stackGroup = `${type} ${series.yAxisID} ${series.stack || series.dataKey}`;
282
- var color = series.color ? series.color : series.backgroundColor;
283
- var dataLabelAnchor = series.dataLabelAnchor || 'center';
284
- var dataLabelOffset = series.dataLabelOffset || 0;
285
- var dataLabelRotation = series.dataLabelRotation || 0;
282
+ function _setupSeriesVisuals(series, chartType) {
283
+ const type = series.type || chartType;
284
+ const color = (() => {
285
+ switch (type) {
286
+ case 'line':
287
+ case 'radar':
288
+ return series.color || series.borderColor;
289
+ default:
290
+ return series.color || series.backgroundColor;
291
+ }
292
+ })();
286
293
  switch (type) {
287
294
  case 'bar':
288
295
  case 'horizontalBar':
@@ -290,57 +297,25 @@ function _setSeriesConfigures(series, chart) {
290
297
  break;
291
298
  case 'line':
292
299
  case 'radar':
293
- color = series.color ? series.color : series.borderColor;
294
300
  series.pointBackgroundColor = series.pointBorderColor = series.borderColor = series.backgroundColor = color;
295
- series.pointBorderWidth = series.borderWidth * 0.5;
301
+ series.pointBorderWidth = (series.borderWidth || 0) * 0.5;
296
302
  series.pointHoverRadius = series.pointRadius;
297
303
  if (series.fill == undefined)
298
304
  series.fill = false;
305
+ // v2 lineTension → v4 tension
306
+ if (series.lineTension != null && series.tension == null) {
307
+ series.tension = series.lineTension;
308
+ }
299
309
  break;
300
310
  default:
301
311
  series.borderColor = series.backgroundColor = color;
302
312
  break;
303
313
  }
304
- series.stack = stackGroup;
305
- series.dataLabelAnchor = dataLabelAnchor;
306
- series.dataLabelOffset = dataLabelOffset;
307
- series.dataLabelRotation = dataLabelRotation;
314
+ series.dataLabelAnchor = series.dataLabelAnchor || 'center';
315
+ series.dataLabelOffset = series.dataLabelOffset || 0;
316
+ series.dataLabelRotation = series.dataLabelRotation || 0;
308
317
  }
309
- function _appendTickCallback(ticks) {
310
- if (!ticks) {
311
- return;
312
- }
313
- ticks.callback = function (value, index, values) {
314
- var returnValue;
315
- if (!Number.isNaN(Number(value))) {
316
- returnValue = Number(value).toLocaleString();
317
- }
318
- else {
319
- returnValue = value;
320
- }
321
- if (returnValue)
322
- return returnValue;
323
- };
324
- }
325
- function _setTooltipFont(tooltips, { fontSize, fontFamily }) {
326
- tooltips.titleFontSize = tooltips.bodyFontSize = tooltips.footerFontSize = fontSize;
327
- if (fontFamily)
328
- tooltips.titleFontFamily = tooltips.bodyFontFamily = tooltips.footerFontFamily = fontFamily;
329
- }
330
- function _setTooltipCallback(tooltips) {
331
- tooltips.callbacks = tooltips.callbacks || {};
332
- tooltips.intersect = false;
333
- tooltips.mode = 'index';
334
- tooltips.callbacks.label = function (tooltipItem, data) {
335
- var _a, _b, _c, _d, _e, _f, _g;
336
- var value = (_b = (_a = data.datasets) === null || _a === void 0 ? void 0 : _a[tooltipItem.datasetIndex || 0].data) === null || _b === void 0 ? void 0 : _b[tooltipItem.index || 0];
337
- var datasetLabel = (_c = data.datasets) === null || _c === void 0 ? void 0 : _c[tooltipItem.datasetIndex || 0].label;
338
- var label = datasetLabel || ((_d = data.labels) === null || _d === void 0 ? void 0 : _d[tooltipItem.index || 0]);
339
- var format = ((_e = data.datasets) === null || _e === void 0 ? void 0 : _e[tooltipItem.datasetIndex || 0].valueFormat) || '';
340
- var prefix = ((_f = data.datasets) === null || _f === void 0 ? void 0 : _f[tooltipItem.datasetIndex || 0].valuePrefix) || '';
341
- var suffix = ((_g = data.datasets) === null || _g === void 0 ? void 0 : _g[tooltipItem.datasetIndex || 0].valueSuffix) || '';
342
- var stringValue = format ? formatText(format, Number(value)) : Number(value).toLocaleString();
343
- return `${label}: ${prefix + stringValue + suffix}`;
344
- };
318
+ function _getBaseColorFromTheme(theme) {
319
+ return new TinyColor(theme === 'light' ? '#fff' : '#000');
345
320
  }
346
321
  //# sourceMappingURL=config-converter.js.map