@mozaic-ds/chart 0.1.0-beta.29 → 0.1.0-beta.30
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/README.md +1 -1
- package/dist/mozaic-chart.js +2303 -2109
- package/dist/mozaic-chart.umd.cjs +9 -9
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/assets/base.css +1 -1
- package/src/components/bar/BarChart.stories.ts +99 -99
- package/src/components/bar/BarChart.vue +70 -53
- package/src/components/bar/index.ts +3 -3
- package/src/components/bubble/BubbleChart.stories.ts +12 -12
- package/src/components/bubble/BubbleChart.vue +118 -91
- package/src/components/bubble/index.ts +3 -3
- package/src/components/doughnut/DoughnutChart.stories.ts +38 -37
- package/src/components/doughnut/DoughnutChart.vue +89 -71
- package/src/components/doughnut/index.ts +3 -3
- package/src/components/index.ts +4 -4
- package/src/components/line/LineChart.stories.ts +38 -38
- package/src/components/line/LineChart.vue +54 -51
- package/src/components/line/index.ts +3 -3
- package/src/components/mixed/MixedBarLineChart.stories.ts +15 -15
- package/src/components/mixed/MixedBarLineChart.vue +44 -44
- package/src/components/mixed/index.ts +1 -1
- package/src/components/radar/RadarChart.stories.ts +100 -100
- package/src/components/radar/RadarChart.vue +41 -34
- package/src/components/radar/index.ts +3 -3
- package/src/main.ts +14 -7
- package/src/plugin.ts +9 -9
- package/src/services/BarChartFunctions.ts +133 -35
- package/src/services/BubbleTooltipService.ts +58 -56
- package/src/services/ChartsCommonLegend.ts +271 -127
- package/src/services/ColorFunctions.ts +1 -1
- package/src/services/DoughnutChartFunctions.ts +42 -13
- package/src/services/FormatUtilities.ts +28 -14
- package/src/services/GenericTooltipService.ts +125 -65
- package/src/services/MixedBarLineFunctions.ts +46 -44
- package/src/services/PatternFunctions.ts +25 -18
- package/src/services/RadarChartFunctions.ts +5 -5
- package/src/services/patterns/ChartDesign.ts +35 -24
- package/src/services/patterns/patternCircles.ts +63 -36
- package/src/services/patterns/patternDashedDiagonals.ts +64 -57
- package/src/services/patterns/patternDiagonals.ts +138 -106
- package/src/services/patterns/patternSquares.ts +86 -80
- package/src/services/patterns/patternVerticalLines.ts +76 -69
- package/src/services/patterns/patternZigzag.ts +92 -85
- package/src/stories/Changelog.mdx +2 -2
- package/src/stories/Contributing.mdx +2 -2
- package/src/stories/GettingStarted.mdx +5 -5
- package/src/stories/SupportAndOnboarding.mdx +6 -6
- package/src/types/AxisDefinition.ts +0 -2
- package/src/types/Chart.ts +9 -7
- package/src/types/DoughnutData.ts +8 -0
- package/src/types/GenericData.ts +10 -10
- package/src/types/LineChart.ts +4 -4
- package/src/types/RadarData.ts +33 -29
- package/src/types/TooltipChartType.ts +7 -7
- package/src/vite-env.d.ts +3 -3
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
createLegendElementWithSquareArea,
|
|
35
35
|
getOrCreateLegendList,
|
|
36
36
|
createLegendCheckbox,
|
|
37
|
-
switchItemVisibility
|
|
37
|
+
switchItemVisibility
|
|
38
38
|
} from '../../services/ChartsCommonLegend';
|
|
39
39
|
|
|
40
40
|
import {
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
PointElement,
|
|
47
47
|
Title,
|
|
48
48
|
Tooltip,
|
|
49
|
-
Plugin
|
|
49
|
+
Plugin
|
|
50
50
|
} from 'chart.js';
|
|
51
51
|
|
|
52
52
|
ChartJS.register(
|
|
@@ -69,42 +69,42 @@ const lineDataProps = defineProps({
|
|
|
69
69
|
*/
|
|
70
70
|
chartId: {
|
|
71
71
|
type: String,
|
|
72
|
-
default: 'radar-chart'
|
|
72
|
+
default: 'radar-chart'
|
|
73
73
|
},
|
|
74
74
|
/**
|
|
75
75
|
* Label of the first line in the Tooltip
|
|
76
76
|
*/
|
|
77
77
|
tooltipFirstLineLabel: {
|
|
78
78
|
type: String,
|
|
79
|
-
default: 'content'
|
|
79
|
+
default: 'content'
|
|
80
80
|
},
|
|
81
81
|
/**
|
|
82
82
|
* Label of the second line in the Tooltip
|
|
83
83
|
*/
|
|
84
84
|
tooltipSecondLineLabel: {
|
|
85
85
|
type: String,
|
|
86
|
-
default: 'content2'
|
|
86
|
+
default: 'content2'
|
|
87
87
|
},
|
|
88
88
|
/**
|
|
89
89
|
* Value of the `width` css property used to define the width of the <canvas> element
|
|
90
90
|
*/
|
|
91
91
|
width: {
|
|
92
92
|
type: String,
|
|
93
|
-
default: '200px'
|
|
93
|
+
default: '200px'
|
|
94
94
|
},
|
|
95
95
|
/**
|
|
96
96
|
* Value of the `height` css property used to define the height of the <canvas> element
|
|
97
97
|
*/
|
|
98
98
|
height: {
|
|
99
99
|
type: String,
|
|
100
|
-
default: '400px'
|
|
100
|
+
default: '400px'
|
|
101
101
|
},
|
|
102
102
|
/**
|
|
103
103
|
* Disable accessibility patterns
|
|
104
104
|
*/
|
|
105
105
|
disableAccessibility: {
|
|
106
106
|
type: Boolean,
|
|
107
|
-
default: false
|
|
107
|
+
default: false
|
|
108
108
|
},
|
|
109
109
|
/**
|
|
110
110
|
* Used to choose the colour set of the charts as defined in the Figma prototypes.
|
|
@@ -115,7 +115,7 @@ const lineDataProps = defineProps({
|
|
|
115
115
|
*/
|
|
116
116
|
colourSet: {
|
|
117
117
|
type: Number,
|
|
118
|
-
default: 0
|
|
118
|
+
default: 0
|
|
119
119
|
},
|
|
120
120
|
/**
|
|
121
121
|
* 6 patterns exist and are not randomly given but follow the order defined in [patternsStandardList](/src/services/patterns/ChartDesign.ts)
|
|
@@ -124,71 +124,71 @@ const lineDataProps = defineProps({
|
|
|
124
124
|
*/
|
|
125
125
|
newPatternsOrder: {
|
|
126
126
|
type: Array as PropType<number[]>,
|
|
127
|
-
default: () => [0, 1, 2, 3, 4, 5]
|
|
127
|
+
default: () => [0, 1, 2, 3, 4, 5]
|
|
128
128
|
},
|
|
129
129
|
/**
|
|
130
130
|
* Line data _(can contain `label`, `data` and `unit` keys)_
|
|
131
131
|
*/
|
|
132
132
|
lines: {
|
|
133
133
|
type: Array as PropType<LineData[]>,
|
|
134
|
-
default: () => {}
|
|
134
|
+
default: () => {}
|
|
135
135
|
},
|
|
136
136
|
/**
|
|
137
137
|
* Labels used to label the index axis (default x axes). See [Data structures documentation](https://www.chartjs.org/docs/latest/general/data-structures.html)
|
|
138
138
|
*/
|
|
139
139
|
labels: {
|
|
140
140
|
type: Array as PropType<string[]>,
|
|
141
|
-
default: () => []
|
|
141
|
+
default: () => []
|
|
142
142
|
},
|
|
143
143
|
/**
|
|
144
144
|
* X axis title
|
|
145
145
|
*/
|
|
146
|
-
|
|
146
|
+
xAxisTitle: {
|
|
147
147
|
type: String,
|
|
148
|
-
default: null
|
|
148
|
+
default: null
|
|
149
149
|
},
|
|
150
150
|
/**
|
|
151
151
|
* Y axis title
|
|
152
152
|
*/
|
|
153
|
-
|
|
153
|
+
yAxisTitle: {
|
|
154
154
|
type: String,
|
|
155
|
-
default: null
|
|
155
|
+
default: null
|
|
156
156
|
},
|
|
157
157
|
/**
|
|
158
158
|
* Adjustment used when calculating the minimum data value.
|
|
159
159
|
*/
|
|
160
160
|
suggestedMin: {
|
|
161
161
|
type: Number,
|
|
162
|
-
default: undefined
|
|
162
|
+
default: undefined
|
|
163
163
|
},
|
|
164
164
|
/**
|
|
165
165
|
* Adjustment used when calculating the maximum data value.
|
|
166
166
|
*/
|
|
167
167
|
suggestedMax: {
|
|
168
168
|
type: Number,
|
|
169
|
-
default: undefined
|
|
169
|
+
default: undefined
|
|
170
170
|
},
|
|
171
171
|
/**
|
|
172
172
|
* Add custom CSS classes to the <canvas> element
|
|
173
173
|
*/
|
|
174
174
|
cssClasses: {
|
|
175
175
|
type: String,
|
|
176
|
-
default: undefined
|
|
176
|
+
default: undefined
|
|
177
177
|
},
|
|
178
178
|
/**
|
|
179
179
|
* Add custom CSS styles to the <canvas> element
|
|
180
180
|
*/
|
|
181
181
|
styles: {
|
|
182
182
|
type: Object as PropType<Partial<CSSStyleDeclaration>>,
|
|
183
|
-
default: () => {}
|
|
183
|
+
default: () => {}
|
|
184
184
|
},
|
|
185
185
|
/**
|
|
186
186
|
* Value of the `plugins` key passed to the Chart config
|
|
187
187
|
*/
|
|
188
188
|
plugins: {
|
|
189
189
|
type: Array as PropType<Plugin<'line'>[]>,
|
|
190
|
-
default: () => []
|
|
191
|
-
}
|
|
190
|
+
default: () => []
|
|
191
|
+
}
|
|
192
192
|
});
|
|
193
193
|
|
|
194
194
|
const patternsColors = computed(() =>
|
|
@@ -226,28 +226,27 @@ const tooltipSecondLine = computed(() => {
|
|
|
226
226
|
const getLinePointStyle = (index: number) => {
|
|
227
227
|
switch (index) {
|
|
228
228
|
case 1:
|
|
229
|
-
return 'circle'
|
|
229
|
+
return 'circle';
|
|
230
230
|
default:
|
|
231
|
-
return 'rectRot'
|
|
231
|
+
return 'rectRot';
|
|
232
232
|
}
|
|
233
|
-
}
|
|
233
|
+
};
|
|
234
234
|
|
|
235
235
|
const chartData = computed(() => {
|
|
236
236
|
return {
|
|
237
237
|
labels: lineDataProps.labels.map((label: string) => label),
|
|
238
|
-
datasets: lineDataProps.lines.map((line: any, index) =>
|
|
239
|
-
{
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
),
|
|
238
|
+
datasets: lineDataProps.lines.map((line: any, index) => {
|
|
239
|
+
return {
|
|
240
|
+
type: 'line' as const,
|
|
241
|
+
borderColor: patternsColors.value[index],
|
|
242
|
+
pointStyle: getLinePointStyle(index),
|
|
243
|
+
pointBackgroundColor: '#FFFFFF',
|
|
244
|
+
pointRadius: 5,
|
|
245
|
+
label: line.label,
|
|
246
|
+
data: line.data,
|
|
247
|
+
borderWidth: 2
|
|
248
|
+
};
|
|
249
|
+
})
|
|
251
250
|
};
|
|
252
251
|
});
|
|
253
252
|
|
|
@@ -282,13 +281,17 @@ function getHtmlLegendPlugin(legendContainer: Ref, selectMode: Ref) {
|
|
|
282
281
|
li.appendChild(createHtmlLegendItemText(item));
|
|
283
282
|
ul.appendChild(li);
|
|
284
283
|
});
|
|
285
|
-
}
|
|
286
|
-
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
287
286
|
];
|
|
288
287
|
}
|
|
289
288
|
|
|
290
289
|
function createLegendElementWithCheckbox(chart: any, item: ChartItem) {
|
|
291
|
-
const liContent = createLegendCheckbox(
|
|
290
|
+
const liContent = createLegendCheckbox(
|
|
291
|
+
chart,
|
|
292
|
+
item,
|
|
293
|
+
null as unknown as string[]
|
|
294
|
+
);
|
|
292
295
|
liContent.onclick = (e: Event) => {
|
|
293
296
|
switchItemVisibility(chart, item.datasetIndex, selectMode);
|
|
294
297
|
e.stopPropagation();
|
|
@@ -303,7 +306,7 @@ const options = computed(() => ({
|
|
|
303
306
|
maintainAspectRatio: false,
|
|
304
307
|
plugins: {
|
|
305
308
|
legend: {
|
|
306
|
-
display: false
|
|
309
|
+
display: false
|
|
307
310
|
},
|
|
308
311
|
datalabels: {
|
|
309
312
|
display: false
|
|
@@ -317,14 +320,14 @@ const options = computed(() => ({
|
|
|
317
320
|
{
|
|
318
321
|
chartType: TooltipChartType.LINE_CHART,
|
|
319
322
|
firstLineLabel: tooltipFirstLine.value,
|
|
320
|
-
secondLineLabel: tooltipSecondLine.value
|
|
323
|
+
secondLineLabel: tooltipSecondLine.value
|
|
321
324
|
},
|
|
322
325
|
patternsColors.value,
|
|
323
326
|
patternsOrderedList,
|
|
324
327
|
lineDataProps.disableAccessibility
|
|
325
328
|
);
|
|
326
|
-
}
|
|
327
|
-
}
|
|
329
|
+
}
|
|
330
|
+
}
|
|
328
331
|
},
|
|
329
332
|
scales: {
|
|
330
333
|
x: {
|
|
@@ -332,7 +335,7 @@ const options = computed(() => ({
|
|
|
332
335
|
title: {
|
|
333
336
|
display: lineDataProps.xAxisTitle !== null,
|
|
334
337
|
text: lineDataProps.xAxisTitle
|
|
335
|
-
}
|
|
338
|
+
}
|
|
336
339
|
},
|
|
337
340
|
y: {
|
|
338
341
|
type: 'linear' as const,
|
|
@@ -345,7 +348,7 @@ const options = computed(() => ({
|
|
|
345
348
|
suggestedMax: lineDataProps.suggestedMax,
|
|
346
349
|
position: 'left' as const,
|
|
347
350
|
grid: {
|
|
348
|
-
drawOnChartArea: true
|
|
351
|
+
drawOnChartArea: true
|
|
349
352
|
},
|
|
350
353
|
ticks: {
|
|
351
354
|
callback: function (val: number | string) {
|
|
@@ -353,10 +356,10 @@ const options = computed(() => ({
|
|
|
353
356
|
return `${formatWithThousandsSeprators(val as number)} ${
|
|
354
357
|
unit ? unit : ''
|
|
355
358
|
}`;
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
360
363
|
}));
|
|
361
364
|
</script>
|
|
362
365
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { App } from
|
|
2
|
-
import LineChart from
|
|
1
|
+
import type { App } from 'vue';
|
|
2
|
+
import LineChart from './LineChart.vue';
|
|
3
3
|
|
|
4
4
|
LineChart.install = (app: App) => {
|
|
5
|
-
app.component(
|
|
5
|
+
app.component('LineChart', LineChart);
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
export { LineChart };
|
|
@@ -5,7 +5,7 @@ import MixedBarLineChart from './MixedBarLineChart.vue';
|
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
7
|
title: 'Charts/MixedBarLine',
|
|
8
|
-
component: MixedBarLineChart
|
|
8
|
+
component: MixedBarLineChart
|
|
9
9
|
} satisfies Meta<typeof MixedBarLineChart>;
|
|
10
10
|
|
|
11
11
|
export default meta;
|
|
@@ -31,19 +31,19 @@ export const Default = {
|
|
|
31
31
|
label: 'Bar Label 1',
|
|
32
32
|
data: [10, 20, 30, 40],
|
|
33
33
|
borderColor: 'rgb(255, 99, 132)',
|
|
34
|
-
backgroundColor: 'rgba(255, 99, 132, 0.2)'
|
|
35
|
-
}
|
|
34
|
+
backgroundColor: 'rgba(255, 99, 132, 0.2)'
|
|
35
|
+
}
|
|
36
36
|
],
|
|
37
37
|
lineDatasets: [
|
|
38
38
|
{
|
|
39
39
|
type: 'line',
|
|
40
40
|
label: 'Line Label 1',
|
|
41
41
|
data: [5, 15, 20, 25],
|
|
42
|
-
borderColor: 'rgb(54, 162, 235)'
|
|
43
|
-
}
|
|
42
|
+
borderColor: 'rgb(54, 162, 235)'
|
|
43
|
+
}
|
|
44
44
|
],
|
|
45
|
-
labels: ['Label 1', 'Label 2', 'Label 3', 'Label 4']
|
|
46
|
-
}
|
|
45
|
+
labels: ['Label 1', 'Label 2', 'Label 3', 'Label 4']
|
|
46
|
+
}
|
|
47
47
|
} satisfies Story;
|
|
48
48
|
|
|
49
49
|
export const Multiple_Data = {
|
|
@@ -62,30 +62,30 @@ export const Multiple_Data = {
|
|
|
62
62
|
label: 'Bar Label 1',
|
|
63
63
|
data: [10, 20, 30, 40],
|
|
64
64
|
borderColor: 'rgb(255, 99, 132)',
|
|
65
|
-
backgroundColor: 'rgba(255, 99, 132, 0.2)'
|
|
65
|
+
backgroundColor: 'rgba(255, 99, 132, 0.2)'
|
|
66
66
|
},
|
|
67
67
|
{
|
|
68
68
|
type: 'bar',
|
|
69
69
|
label: 'Bar Label 2',
|
|
70
70
|
data: [20, 20, 30, 40],
|
|
71
71
|
borderColor: 'rgb(255, 99, 132)',
|
|
72
|
-
backgroundColor: 'rgba(255, 99, 132, 0.2)'
|
|
73
|
-
}
|
|
72
|
+
backgroundColor: 'rgba(255, 99, 132, 0.2)'
|
|
73
|
+
}
|
|
74
74
|
],
|
|
75
75
|
lineDatasets: [
|
|
76
76
|
{
|
|
77
77
|
type: 'line',
|
|
78
78
|
label: 'Line Label 1',
|
|
79
79
|
data: [50, 150, 20, 250],
|
|
80
|
-
borderColor: 'rgb(54, 162, 235)'
|
|
80
|
+
borderColor: 'rgb(54, 162, 235)'
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
83
|
type: 'line',
|
|
84
84
|
label: 'Line Label 2',
|
|
85
85
|
data: [1, 8, 6, 24],
|
|
86
|
-
borderColor: 'rgb(54, 162, 235)'
|
|
87
|
-
}
|
|
86
|
+
borderColor: 'rgb(54, 162, 235)'
|
|
87
|
+
}
|
|
88
88
|
],
|
|
89
|
-
labels: ['Label 1', 'Label 2', 'Label 3', 'Label 4']
|
|
90
|
-
}
|
|
89
|
+
labels: ['Label 1', 'Label 2', 'Label 3', 'Label 4']
|
|
90
|
+
}
|
|
91
91
|
} satisfies Story;
|
|
@@ -24,7 +24,7 @@ import { GenericTooltipService } from '../../services/GenericTooltipService';
|
|
|
24
24
|
import { TooltipChartType } from '../../types/TooltipChartType';
|
|
25
25
|
import {
|
|
26
26
|
formatTicks,
|
|
27
|
-
formatWithThousandsSeprators
|
|
27
|
+
formatWithThousandsSeprators
|
|
28
28
|
} from '../../services/FormatUtilities';
|
|
29
29
|
import {
|
|
30
30
|
BarElement,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
Tooltip,
|
|
37
37
|
LineElement,
|
|
38
38
|
PointElement,
|
|
39
|
-
Plugin
|
|
39
|
+
Plugin
|
|
40
40
|
} from 'chart.js';
|
|
41
41
|
import { MixedBarLineData } from '../../types/MixedBarLineData';
|
|
42
42
|
import ChartDesign from '../../services/patterns/ChartDesign';
|
|
@@ -66,21 +66,21 @@ const mixedBarLineDataProps = defineProps({
|
|
|
66
66
|
*/
|
|
67
67
|
chartId: {
|
|
68
68
|
type: String,
|
|
69
|
-
default: 'mixed-bar-line-chart'
|
|
69
|
+
default: 'mixed-bar-line-chart'
|
|
70
70
|
},
|
|
71
71
|
/**
|
|
72
72
|
* Unit of values on canvas Y axis
|
|
73
73
|
*/
|
|
74
74
|
unit: {
|
|
75
75
|
type: String,
|
|
76
|
-
default: ''
|
|
76
|
+
default: ''
|
|
77
77
|
},
|
|
78
78
|
/**
|
|
79
79
|
* Labels used to label the index axis (default x axes). See [Data structures documentation](https://www.chartjs.org/docs/latest/general/data-structures.html)
|
|
80
80
|
*/
|
|
81
81
|
labels: {
|
|
82
82
|
type: Array as PropType<string[]>,
|
|
83
|
-
default: () => []
|
|
83
|
+
default: () => []
|
|
84
84
|
},
|
|
85
85
|
/**
|
|
86
86
|
* Used to choose the colour set of the charts as defined in the Figma prototypes.
|
|
@@ -91,7 +91,7 @@ const mixedBarLineDataProps = defineProps({
|
|
|
91
91
|
*/
|
|
92
92
|
colourSet: {
|
|
93
93
|
type: Number,
|
|
94
|
-
default: 0
|
|
94
|
+
default: 0
|
|
95
95
|
},
|
|
96
96
|
/**
|
|
97
97
|
* 6 patterns exist and are not randomly given but follow the order defined in [patternsStandardList](/src/services/patterns/ChartDesign.ts)
|
|
@@ -100,120 +100,120 @@ const mixedBarLineDataProps = defineProps({
|
|
|
100
100
|
*/
|
|
101
101
|
newPatternsOrder: {
|
|
102
102
|
type: Array as PropType<number[]>,
|
|
103
|
-
default: () => [0, 1, 2, 3, 4, 5]
|
|
103
|
+
default: () => [0, 1, 2, 3, 4, 5]
|
|
104
104
|
},
|
|
105
105
|
/**
|
|
106
106
|
* Value of the `bar datasets` key present in the `data` object passed to the Chart config
|
|
107
107
|
*/
|
|
108
108
|
barDatasets: {
|
|
109
109
|
type: Array as PropType<MixedBarLineData[]>,
|
|
110
|
-
default: () => []
|
|
110
|
+
default: () => []
|
|
111
111
|
},
|
|
112
112
|
/**
|
|
113
113
|
* Unit of the `bar datasets`
|
|
114
114
|
*/
|
|
115
115
|
barUnit: {
|
|
116
116
|
type: String,
|
|
117
|
-
default: ''
|
|
117
|
+
default: ''
|
|
118
118
|
},
|
|
119
119
|
/**
|
|
120
120
|
* Value of the `line datasets` key present in the `data` object passed to the Chart config
|
|
121
121
|
*/
|
|
122
122
|
lineDatasets: {
|
|
123
123
|
type: Array as PropType<MixedBarLineData[]>,
|
|
124
|
-
default: () => []
|
|
124
|
+
default: () => []
|
|
125
125
|
},
|
|
126
126
|
/**
|
|
127
127
|
* Unit of the `line datasets`
|
|
128
128
|
*/
|
|
129
129
|
lineUnit: {
|
|
130
130
|
type: String,
|
|
131
|
-
default: ''
|
|
131
|
+
default: ''
|
|
132
132
|
},
|
|
133
133
|
/**
|
|
134
134
|
* Value of the `width` css property used to define the width of the <canvas> element
|
|
135
135
|
*/
|
|
136
136
|
width: {
|
|
137
137
|
type: String,
|
|
138
|
-
default: '400px'
|
|
138
|
+
default: '400px'
|
|
139
139
|
},
|
|
140
140
|
/**
|
|
141
141
|
* Value of the `height` css property used to define the height of the <canvas> element
|
|
142
142
|
*/
|
|
143
143
|
height: {
|
|
144
144
|
type: String,
|
|
145
|
-
default: '300px'
|
|
145
|
+
default: '300px'
|
|
146
146
|
},
|
|
147
147
|
/**
|
|
148
148
|
* Add custom CSS classes to the <canvas> element
|
|
149
149
|
*/
|
|
150
150
|
cssClasses: {
|
|
151
151
|
type: String,
|
|
152
|
-
default: undefined
|
|
152
|
+
default: undefined
|
|
153
153
|
},
|
|
154
154
|
/**
|
|
155
155
|
* Add custom CSS styles to the <canvas> element
|
|
156
156
|
*/
|
|
157
157
|
styles: {
|
|
158
158
|
type: Object as PropType<Partial<CSSStyleDeclaration>>,
|
|
159
|
-
default: () => {}
|
|
159
|
+
default: () => {}
|
|
160
160
|
},
|
|
161
161
|
/**
|
|
162
162
|
* Value of the `plugins` key passed to the Chart config
|
|
163
163
|
*/
|
|
164
164
|
plugins: {
|
|
165
165
|
type: Array as PropType<Plugin<'bar'>[]>,
|
|
166
|
-
default: () => []
|
|
166
|
+
default: () => []
|
|
167
167
|
},
|
|
168
168
|
/**
|
|
169
169
|
* Activates "stacked" mode
|
|
170
170
|
*/
|
|
171
171
|
stacked: {
|
|
172
172
|
type: Boolean,
|
|
173
|
-
default: false
|
|
173
|
+
default: false
|
|
174
174
|
},
|
|
175
175
|
/**
|
|
176
176
|
* Disable accessibility patterns
|
|
177
177
|
*/
|
|
178
178
|
disableAccessibility: {
|
|
179
179
|
type: Boolean,
|
|
180
|
-
default: false
|
|
180
|
+
default: false
|
|
181
181
|
},
|
|
182
182
|
/**
|
|
183
183
|
* Label of the first line in the Tooltip
|
|
184
184
|
*/
|
|
185
185
|
tooltipFirstLineLabel: {
|
|
186
186
|
type: String,
|
|
187
|
-
default: 'content'
|
|
187
|
+
default: 'content'
|
|
188
188
|
},
|
|
189
189
|
/**
|
|
190
190
|
* Label of the second line in the Tooltip
|
|
191
191
|
*/
|
|
192
192
|
tooltipSecondLineLabel: {
|
|
193
193
|
type: String,
|
|
194
|
-
default: 'content2'
|
|
194
|
+
default: 'content2'
|
|
195
195
|
},
|
|
196
196
|
/**
|
|
197
197
|
* Title of the x axis
|
|
198
198
|
*/
|
|
199
199
|
xAxisTitle: {
|
|
200
200
|
type: String,
|
|
201
|
-
default: null
|
|
201
|
+
default: null
|
|
202
202
|
},
|
|
203
203
|
/**
|
|
204
204
|
* Title of the y left axis
|
|
205
205
|
*/
|
|
206
206
|
yLeftAxisTitle: {
|
|
207
207
|
type: String,
|
|
208
|
-
default: null
|
|
208
|
+
default: null
|
|
209
209
|
},
|
|
210
210
|
/**
|
|
211
211
|
* Title of the y right axis
|
|
212
212
|
*/
|
|
213
213
|
yRightAxisTitle: {
|
|
214
214
|
type: String,
|
|
215
|
-
default: null
|
|
216
|
-
}
|
|
215
|
+
default: null
|
|
216
|
+
}
|
|
217
217
|
});
|
|
218
218
|
|
|
219
219
|
const chartDatasets = computed(() => {
|
|
@@ -261,7 +261,7 @@ const chartData = computed(() => {
|
|
|
261
261
|
patternsColors.value,
|
|
262
262
|
patternsOrderedList.value,
|
|
263
263
|
0
|
|
264
|
-
)
|
|
264
|
+
)
|
|
265
265
|
};
|
|
266
266
|
});
|
|
267
267
|
|
|
@@ -294,15 +294,15 @@ const options = computed(() => ({
|
|
|
294
294
|
categoryPercentage: 0.6,
|
|
295
295
|
elements: {
|
|
296
296
|
bar: {
|
|
297
|
-
borderSkipped: false
|
|
298
|
-
}
|
|
297
|
+
borderSkipped: false
|
|
298
|
+
}
|
|
299
299
|
},
|
|
300
300
|
plugins: {
|
|
301
301
|
legend: {
|
|
302
|
-
display: false
|
|
302
|
+
display: false
|
|
303
303
|
},
|
|
304
304
|
title: {
|
|
305
|
-
display: false
|
|
305
|
+
display: false
|
|
306
306
|
},
|
|
307
307
|
datalabels: {
|
|
308
308
|
display: false
|
|
@@ -316,33 +316,33 @@ const options = computed(() => ({
|
|
|
316
316
|
{
|
|
317
317
|
chartType: TooltipChartType.MIXED_BAR_LINE_CHART,
|
|
318
318
|
firstLineLabel: mixedBarLineDataProps.tooltipFirstLineLabel,
|
|
319
|
-
secondLineLabel: mixedBarLineDataProps.tooltipSecondLineLabel
|
|
319
|
+
secondLineLabel: mixedBarLineDataProps.tooltipSecondLineLabel
|
|
320
320
|
},
|
|
321
321
|
patternsColors.value,
|
|
322
322
|
patternsOrderedList.value,
|
|
323
323
|
mixedBarLineDataProps.disableAccessibility
|
|
324
324
|
);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
327
|
},
|
|
328
328
|
scales: {
|
|
329
329
|
x: {
|
|
330
330
|
offset: true,
|
|
331
331
|
title: {
|
|
332
332
|
display: mixedBarLineDataProps.xAxisTitle !== null,
|
|
333
|
-
text: mixedBarLineDataProps.xAxisTitle
|
|
334
|
-
}
|
|
333
|
+
text: mixedBarLineDataProps.xAxisTitle
|
|
334
|
+
}
|
|
335
335
|
},
|
|
336
336
|
A: {
|
|
337
337
|
type: 'linear' as const,
|
|
338
338
|
display: true,
|
|
339
339
|
position: 'left' as const,
|
|
340
340
|
grid: {
|
|
341
|
-
drawOnChartArea: true
|
|
341
|
+
drawOnChartArea: true
|
|
342
342
|
},
|
|
343
343
|
title: {
|
|
344
344
|
display: mixedBarLineDataProps.yLeftAxisTitle !== null,
|
|
345
|
-
text: mixedBarLineDataProps.yLeftAxisTitle
|
|
345
|
+
text: mixedBarLineDataProps.yLeftAxisTitle
|
|
346
346
|
},
|
|
347
347
|
ticks: {
|
|
348
348
|
callback: function (val: string | number) {
|
|
@@ -351,19 +351,19 @@ const options = computed(() => ({
|
|
|
351
351
|
: formatWithThousandsSeprators(val as number) +
|
|
352
352
|
' ' +
|
|
353
353
|
mixedBarLineDataProps.barUnit;
|
|
354
|
-
}
|
|
355
|
-
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
356
|
},
|
|
357
357
|
B: {
|
|
358
358
|
type: 'linear' as const,
|
|
359
359
|
display: true,
|
|
360
360
|
position: 'right' as const,
|
|
361
361
|
grid: {
|
|
362
|
-
drawOnChartArea: false
|
|
362
|
+
drawOnChartArea: false
|
|
363
363
|
},
|
|
364
364
|
title: {
|
|
365
365
|
display: mixedBarLineDataProps.yRightAxisTitle !== null,
|
|
366
|
-
text: mixedBarLineDataProps.yRightAxisTitle
|
|
366
|
+
text: mixedBarLineDataProps.yRightAxisTitle
|
|
367
367
|
},
|
|
368
368
|
ticks: {
|
|
369
369
|
callback: function (val: string | number) {
|
|
@@ -374,10 +374,10 @@ const options = computed(() => ({
|
|
|
374
374
|
' ' +
|
|
375
375
|
mixedBarLineDataProps.lineUnit
|
|
376
376
|
);
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
381
|
}));
|
|
382
382
|
|
|
383
383
|
const htmlLegendPlugin = ref(
|