@mozaic-ds/chart 0.1.0-beta.3 → 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/dist/mozaic-chart.js +4453 -2623
- package/dist/mozaic-chart.umd.cjs +17 -11
- package/dist/style.css +1 -1
- package/package.json +25 -10
- package/src/assets/base.css +1 -1
- package/src/assets/img/bubbles.svg +4 -0
- package/src/components/bar/BarChart.stories.ts +105 -103
- package/src/components/bar/BarChart.vue +257 -131
- package/src/components/bar/index.ts +3 -3
- package/src/components/bubble/BubbleChart.stories.ts +66 -0
- package/src/components/bubble/BubbleChart.vue +363 -0
- package/src/components/bubble/index.ts +8 -0
- package/src/components/doughnut/DoughnutChart.stories.ts +38 -36
- package/src/components/doughnut/DoughnutChart.vue +210 -111
- package/src/components/doughnut/index.ts +3 -3
- package/src/components/index.ts +4 -4
- package/src/components/line/LineChart.stories.ts +52 -27
- package/src/components/line/LineChart.vue +346 -254
- package/src/components/line/index.ts +3 -3
- package/src/components/mixed/MixedBarLineChart.stories.ts +91 -0
- package/src/components/mixed/MixedBarLineChart.vue +413 -0
- package/src/components/mixed/index.ts +8 -0
- package/src/components/radar/RadarChart.stories.ts +102 -102
- package/src/components/radar/RadarChart.vue +204 -165
- package/src/components/radar/index.ts +3 -3
- package/src/main.ts +14 -4
- package/src/plugin.ts +10 -8
- package/src/services/BarChartFunctions.ts +136 -35
- package/src/services/BubbleTooltipService.ts +67 -0
- package/src/services/ChartsCommonLegend.ts +309 -137
- package/src/services/ColorFunctions.ts +1 -1
- package/src/services/DoughnutChartFunctions.ts +132 -55
- package/src/services/FormatUtilities.ts +28 -14
- package/src/services/GenericTooltipService.ts +140 -65
- package/src/services/MixedBarLineFunctions.ts +262 -0
- package/src/services/PatternFunctions.ts +25 -18
- package/src/services/RadarChartFunctions.ts +33 -12
- 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 +6 -0
- package/src/stories/Contributing.mdx +101 -0
- package/src/stories/GettingStarted.mdx +92 -0
- package/src/stories/SupportAndOnboarding.mdx +44 -0
- package/src/types/AxisDefinition.ts +4 -0
- package/src/types/BarData.ts +1 -0
- 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/MixedBarLineData.ts +7 -0
- package/src/types/RadarData.ts +33 -29
- package/src/types/TooltipChartType.ts +7 -6
- package/src/vite-env.d.ts +3 -3
- package/src/App.vue +0 -80
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// MixedBarLineChart.stories.ts
|
|
2
|
+
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/vue3';
|
|
4
|
+
import MixedBarLineChart from './MixedBarLineChart.vue';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Charts/MixedBarLine',
|
|
8
|
+
component: MixedBarLineChart
|
|
9
|
+
} satisfies Meta<typeof MixedBarLineChart>;
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof meta>;
|
|
13
|
+
|
|
14
|
+
export const Default = {
|
|
15
|
+
args: {
|
|
16
|
+
width: '500px',
|
|
17
|
+
height: '400px',
|
|
18
|
+
tooltipFirstLineLabel: 'content',
|
|
19
|
+
tooltipSecondLineLabel: 'content2',
|
|
20
|
+
disableAccessibility: false,
|
|
21
|
+
newPatternsOrder: [0, 1, 0, 1, 2, 3],
|
|
22
|
+
colourSet: 0,
|
|
23
|
+
barUnit: '',
|
|
24
|
+
lineUnit: '€',
|
|
25
|
+
xAxisTitle: 'X Axis',
|
|
26
|
+
yLeftAxisTitle: 'Y1 Axis',
|
|
27
|
+
yRightAxisTitle: 'Y2 Axis',
|
|
28
|
+
barDatasets: [
|
|
29
|
+
{
|
|
30
|
+
type: 'bar',
|
|
31
|
+
label: 'Bar Label 1',
|
|
32
|
+
data: [10, 20, 30, 40],
|
|
33
|
+
borderColor: 'rgb(255, 99, 132)',
|
|
34
|
+
backgroundColor: 'rgba(255, 99, 132, 0.2)'
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
lineDatasets: [
|
|
38
|
+
{
|
|
39
|
+
type: 'line',
|
|
40
|
+
label: 'Line Label 1',
|
|
41
|
+
data: [5, 15, 20, 25],
|
|
42
|
+
borderColor: 'rgb(54, 162, 235)'
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
labels: ['Label 1', 'Label 2', 'Label 3', 'Label 4']
|
|
46
|
+
}
|
|
47
|
+
} satisfies Story;
|
|
48
|
+
|
|
49
|
+
export const Multiple_Data = {
|
|
50
|
+
args: {
|
|
51
|
+
width: '500px',
|
|
52
|
+
height: '400px',
|
|
53
|
+
tooltipFirstLineLabel: 'content',
|
|
54
|
+
tooltipSecondLineLabel: 'content2',
|
|
55
|
+
disableAccessibility: false,
|
|
56
|
+
newPatternsOrder: [0, 1, 0, 1, 2, 3],
|
|
57
|
+
colourSet: 0,
|
|
58
|
+
lineUnit: '€',
|
|
59
|
+
barDatasets: [
|
|
60
|
+
{
|
|
61
|
+
type: 'bar',
|
|
62
|
+
label: 'Bar Label 1',
|
|
63
|
+
data: [10, 20, 30, 40],
|
|
64
|
+
borderColor: 'rgb(255, 99, 132)',
|
|
65
|
+
backgroundColor: 'rgba(255, 99, 132, 0.2)'
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: 'bar',
|
|
69
|
+
label: 'Bar Label 2',
|
|
70
|
+
data: [20, 20, 30, 40],
|
|
71
|
+
borderColor: 'rgb(255, 99, 132)',
|
|
72
|
+
backgroundColor: 'rgba(255, 99, 132, 0.2)'
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
lineDatasets: [
|
|
76
|
+
{
|
|
77
|
+
type: 'line',
|
|
78
|
+
label: 'Line Label 1',
|
|
79
|
+
data: [50, 150, 20, 250],
|
|
80
|
+
borderColor: 'rgb(54, 162, 235)'
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
type: 'line',
|
|
84
|
+
label: 'Line Label 2',
|
|
85
|
+
data: [1, 8, 6, 24],
|
|
86
|
+
borderColor: 'rgb(54, 162, 235)'
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
labels: ['Label 1', 'Label 2', 'Label 3', 'Label 4']
|
|
90
|
+
}
|
|
91
|
+
} satisfies Story;
|
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="container">
|
|
3
|
+
<div class="main">
|
|
4
|
+
<Bar
|
|
5
|
+
v-if="chartData"
|
|
6
|
+
ref="mixedBarLineChartRef"
|
|
7
|
+
:id="chartId"
|
|
8
|
+
:data="chartData"
|
|
9
|
+
:options="options"
|
|
10
|
+
:plugins="htmlLegendPlugin"
|
|
11
|
+
:class="cssClasses"
|
|
12
|
+
:style="[{ width, height, cursor: 'pointer' }, styles]"
|
|
13
|
+
/>
|
|
14
|
+
</div>
|
|
15
|
+
<div ref="legendContainer" />
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script setup lang="ts">
|
|
20
|
+
import { computed, ref, watch, PropType } from 'vue';
|
|
21
|
+
import { Bar } from 'vue-chartjs';
|
|
22
|
+
import type { Context } from '../../services/GenericTooltipService';
|
|
23
|
+
import { GenericTooltipService } from '../../services/GenericTooltipService';
|
|
24
|
+
import { TooltipChartType } from '../../types/TooltipChartType';
|
|
25
|
+
import {
|
|
26
|
+
formatTicks,
|
|
27
|
+
formatWithThousandsSeprators
|
|
28
|
+
} from '../../services/FormatUtilities';
|
|
29
|
+
import {
|
|
30
|
+
BarElement,
|
|
31
|
+
CategoryScale,
|
|
32
|
+
Chart as ChartJS,
|
|
33
|
+
Legend,
|
|
34
|
+
LinearScale,
|
|
35
|
+
Title,
|
|
36
|
+
Tooltip,
|
|
37
|
+
LineElement,
|
|
38
|
+
PointElement,
|
|
39
|
+
Plugin
|
|
40
|
+
} from 'chart.js';
|
|
41
|
+
import { MixedBarLineData } from '../../types/MixedBarLineData';
|
|
42
|
+
import ChartDesign from '../../services/patterns/ChartDesign';
|
|
43
|
+
import mixedBarLineFunctions from '../../services/MixedBarLineFunctions';
|
|
44
|
+
|
|
45
|
+
ChartJS.register(
|
|
46
|
+
Title,
|
|
47
|
+
Tooltip,
|
|
48
|
+
Legend,
|
|
49
|
+
BarElement,
|
|
50
|
+
CategoryScale,
|
|
51
|
+
LinearScale,
|
|
52
|
+
LineElement,
|
|
53
|
+
PointElement
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const { privateGetHtmlLegendPlugin, getMixedDatasets } =
|
|
57
|
+
mixedBarLineFunctions();
|
|
58
|
+
|
|
59
|
+
const { colourSets, patternsStandardList } = ChartDesign();
|
|
60
|
+
|
|
61
|
+
const legendContainer = ref(null);
|
|
62
|
+
const selectMode = ref(false);
|
|
63
|
+
const mixedBarLineDataProps = defineProps({
|
|
64
|
+
/**
|
|
65
|
+
* Value of the id attribute present on the <canvas> tag element the chart
|
|
66
|
+
*/
|
|
67
|
+
chartId: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: 'mixed-bar-line-chart'
|
|
70
|
+
},
|
|
71
|
+
/**
|
|
72
|
+
* Unit of values on canvas Y axis
|
|
73
|
+
*/
|
|
74
|
+
unit: {
|
|
75
|
+
type: String,
|
|
76
|
+
default: ''
|
|
77
|
+
},
|
|
78
|
+
/**
|
|
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
|
+
*/
|
|
81
|
+
labels: {
|
|
82
|
+
type: Array as PropType<string[]>,
|
|
83
|
+
default: () => []
|
|
84
|
+
},
|
|
85
|
+
/**
|
|
86
|
+
* Used to choose the colour set of the charts as defined in the Figma prototypes.
|
|
87
|
+
* 7 colour sets are currently defined:
|
|
88
|
+
* - Default 0 corresponds to the current one
|
|
89
|
+
* - 1 to 6 corresponds to the "new" [colour sets](https://www.figma.com/file/Hn6PyvnR385Ta0XN3KqOI9/04.-Dataviz---Documentation-(read-only)?type=design&node-id=1-69316&mode=design&t=sDytQ5BipsryWkuA-0)
|
|
90
|
+
* Note: All the sets are defined in /src/services/patterns/ChartDesign.ts
|
|
91
|
+
*/
|
|
92
|
+
colourSet: {
|
|
93
|
+
type: Number,
|
|
94
|
+
default: 0
|
|
95
|
+
},
|
|
96
|
+
/**
|
|
97
|
+
* 6 patterns exist and are not randomly given but follow the order defined in [patternsStandardList](/src/services/patterns/ChartDesign.ts)
|
|
98
|
+
* Additionally, a pattern has only one possible colour per colour set as defined in the Figma prototype.
|
|
99
|
+
* In some use cases, the chart may need to show a different orders of these patterns, this can be changed using the props newPatternsOrder
|
|
100
|
+
*/
|
|
101
|
+
newPatternsOrder: {
|
|
102
|
+
type: Array as PropType<number[]>,
|
|
103
|
+
default: () => [0, 1, 2, 3, 4, 5]
|
|
104
|
+
},
|
|
105
|
+
/**
|
|
106
|
+
* Value of the `bar datasets` key present in the `data` object passed to the Chart config
|
|
107
|
+
*/
|
|
108
|
+
barDatasets: {
|
|
109
|
+
type: Array as PropType<MixedBarLineData[]>,
|
|
110
|
+
default: () => []
|
|
111
|
+
},
|
|
112
|
+
/**
|
|
113
|
+
* Unit of the `bar datasets`
|
|
114
|
+
*/
|
|
115
|
+
barUnit: {
|
|
116
|
+
type: String,
|
|
117
|
+
default: ''
|
|
118
|
+
},
|
|
119
|
+
/**
|
|
120
|
+
* Value of the `line datasets` key present in the `data` object passed to the Chart config
|
|
121
|
+
*/
|
|
122
|
+
lineDatasets: {
|
|
123
|
+
type: Array as PropType<MixedBarLineData[]>,
|
|
124
|
+
default: () => []
|
|
125
|
+
},
|
|
126
|
+
/**
|
|
127
|
+
* Unit of the `line datasets`
|
|
128
|
+
*/
|
|
129
|
+
lineUnit: {
|
|
130
|
+
type: String,
|
|
131
|
+
default: ''
|
|
132
|
+
},
|
|
133
|
+
/**
|
|
134
|
+
* Value of the `width` css property used to define the width of the <canvas> element
|
|
135
|
+
*/
|
|
136
|
+
width: {
|
|
137
|
+
type: String,
|
|
138
|
+
default: '400px'
|
|
139
|
+
},
|
|
140
|
+
/**
|
|
141
|
+
* Value of the `height` css property used to define the height of the <canvas> element
|
|
142
|
+
*/
|
|
143
|
+
height: {
|
|
144
|
+
type: String,
|
|
145
|
+
default: '300px'
|
|
146
|
+
},
|
|
147
|
+
/**
|
|
148
|
+
* Add custom CSS classes to the <canvas> element
|
|
149
|
+
*/
|
|
150
|
+
cssClasses: {
|
|
151
|
+
type: String,
|
|
152
|
+
default: undefined
|
|
153
|
+
},
|
|
154
|
+
/**
|
|
155
|
+
* Add custom CSS styles to the <canvas> element
|
|
156
|
+
*/
|
|
157
|
+
styles: {
|
|
158
|
+
type: Object as PropType<Partial<CSSStyleDeclaration>>,
|
|
159
|
+
default: () => {}
|
|
160
|
+
},
|
|
161
|
+
/**
|
|
162
|
+
* Value of the `plugins` key passed to the Chart config
|
|
163
|
+
*/
|
|
164
|
+
plugins: {
|
|
165
|
+
type: Array as PropType<Plugin<'bar'>[]>,
|
|
166
|
+
default: () => []
|
|
167
|
+
},
|
|
168
|
+
/**
|
|
169
|
+
* Activates "stacked" mode
|
|
170
|
+
*/
|
|
171
|
+
stacked: {
|
|
172
|
+
type: Boolean,
|
|
173
|
+
default: false
|
|
174
|
+
},
|
|
175
|
+
/**
|
|
176
|
+
* Disable accessibility patterns
|
|
177
|
+
*/
|
|
178
|
+
disableAccessibility: {
|
|
179
|
+
type: Boolean,
|
|
180
|
+
default: false
|
|
181
|
+
},
|
|
182
|
+
/**
|
|
183
|
+
* Label of the first line in the Tooltip
|
|
184
|
+
*/
|
|
185
|
+
tooltipFirstLineLabel: {
|
|
186
|
+
type: String,
|
|
187
|
+
default: 'content'
|
|
188
|
+
},
|
|
189
|
+
/**
|
|
190
|
+
* Label of the second line in the Tooltip
|
|
191
|
+
*/
|
|
192
|
+
tooltipSecondLineLabel: {
|
|
193
|
+
type: String,
|
|
194
|
+
default: 'content2'
|
|
195
|
+
},
|
|
196
|
+
/**
|
|
197
|
+
* Title of the x axis
|
|
198
|
+
*/
|
|
199
|
+
xAxisTitle: {
|
|
200
|
+
type: String,
|
|
201
|
+
default: null
|
|
202
|
+
},
|
|
203
|
+
/**
|
|
204
|
+
* Title of the y left axis
|
|
205
|
+
*/
|
|
206
|
+
yLeftAxisTitle: {
|
|
207
|
+
type: String,
|
|
208
|
+
default: null
|
|
209
|
+
},
|
|
210
|
+
/**
|
|
211
|
+
* Title of the y right axis
|
|
212
|
+
*/
|
|
213
|
+
yRightAxisTitle: {
|
|
214
|
+
type: String,
|
|
215
|
+
default: null
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
const chartDatasets = computed(() => {
|
|
220
|
+
let datasets: MixedBarLineData[] = [];
|
|
221
|
+
if (mixedBarLineDataProps.barDatasets) {
|
|
222
|
+
datasets = datasets.concat(mixedBarLineDataProps.barDatasets);
|
|
223
|
+
}
|
|
224
|
+
if (mixedBarLineDataProps.lineDatasets) {
|
|
225
|
+
datasets = datasets.concat(mixedBarLineDataProps.lineDatasets);
|
|
226
|
+
}
|
|
227
|
+
return datasets;
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
// computed to make the colors list reactive to the props
|
|
231
|
+
const patternsColors = computed(() => {
|
|
232
|
+
return mixedBarLineDataProps.newPatternsOrder.length !==
|
|
233
|
+
patternsStandardList.length
|
|
234
|
+
? colourSets[mixedBarLineDataProps.colourSet]
|
|
235
|
+
: mixedBarLineDataProps.newPatternsOrder.map((id) => {
|
|
236
|
+
return colourSets[mixedBarLineDataProps.colourSet][id];
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
// computed to make the patterns list reactive to the props
|
|
241
|
+
const patternsOrderedList = computed(() => {
|
|
242
|
+
return mixedBarLineDataProps.newPatternsOrder.length !==
|
|
243
|
+
patternsStandardList.length
|
|
244
|
+
? patternsStandardList
|
|
245
|
+
: mixedBarLineDataProps.newPatternsOrder.map((id) => {
|
|
246
|
+
return patternsStandardList[id];
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
const disablePattern = computed(() => {
|
|
251
|
+
return mixedBarLineDataProps.disableAccessibility;
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
const chartData = computed(() => {
|
|
255
|
+
const chartsLabels = getChartLabels();
|
|
256
|
+
return {
|
|
257
|
+
labels: chartsLabels,
|
|
258
|
+
datasets: getMixedDatasets(
|
|
259
|
+
chartDatasets.value,
|
|
260
|
+
disablePattern.value,
|
|
261
|
+
patternsColors.value,
|
|
262
|
+
patternsOrderedList.value,
|
|
263
|
+
0
|
|
264
|
+
)
|
|
265
|
+
};
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
const getTooltipData = (context: Context) => {
|
|
269
|
+
const datasetIndex = context.tooltip.dataPoints[0].datasetIndex as number;
|
|
270
|
+
const dataIndex = context.tooltip.dataPoints[0].dataIndex as number;
|
|
271
|
+
const rawdata: number = chartDatasets.value[datasetIndex].data[dataIndex];
|
|
272
|
+
const amountUnit =
|
|
273
|
+
chartDatasets.value[datasetIndex].type === 'bar'
|
|
274
|
+
? mixedBarLineDataProps.barUnit
|
|
275
|
+
: mixedBarLineDataProps.lineUnit;
|
|
276
|
+
const data =
|
|
277
|
+
amountUnit === '%'
|
|
278
|
+
? parseFloat(rawdata.toString().replace(',', '.')).toFixed(2)
|
|
279
|
+
: formatWithThousandsSeprators(rawdata);
|
|
280
|
+
return data + amountUnit;
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
const getChartLabels = () => {
|
|
284
|
+
const labels = Object.assign([], mixedBarLineDataProps.labels);
|
|
285
|
+
|
|
286
|
+
return labels.map((label: string) => label);
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
const options = computed(() => ({
|
|
290
|
+
type: 'bar',
|
|
291
|
+
responsive: true,
|
|
292
|
+
maintainAspectRatio: true,
|
|
293
|
+
maxBarThickness: 64,
|
|
294
|
+
categoryPercentage: 0.6,
|
|
295
|
+
elements: {
|
|
296
|
+
bar: {
|
|
297
|
+
borderSkipped: false
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
plugins: {
|
|
301
|
+
legend: {
|
|
302
|
+
display: false
|
|
303
|
+
},
|
|
304
|
+
title: {
|
|
305
|
+
display: false
|
|
306
|
+
},
|
|
307
|
+
datalabels: {
|
|
308
|
+
display: false
|
|
309
|
+
},
|
|
310
|
+
tooltip: {
|
|
311
|
+
enabled: false,
|
|
312
|
+
external: function (context: Context) {
|
|
313
|
+
new GenericTooltipService().createTooltip(
|
|
314
|
+
context,
|
|
315
|
+
getTooltipData,
|
|
316
|
+
{
|
|
317
|
+
chartType: TooltipChartType.MIXED_BAR_LINE_CHART,
|
|
318
|
+
firstLineLabel: mixedBarLineDataProps.tooltipFirstLineLabel,
|
|
319
|
+
secondLineLabel: mixedBarLineDataProps.tooltipSecondLineLabel
|
|
320
|
+
},
|
|
321
|
+
patternsColors.value,
|
|
322
|
+
patternsOrderedList.value,
|
|
323
|
+
mixedBarLineDataProps.disableAccessibility
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
scales: {
|
|
329
|
+
x: {
|
|
330
|
+
offset: true,
|
|
331
|
+
title: {
|
|
332
|
+
display: mixedBarLineDataProps.xAxisTitle !== null,
|
|
333
|
+
text: mixedBarLineDataProps.xAxisTitle
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
A: {
|
|
337
|
+
type: 'linear' as const,
|
|
338
|
+
display: true,
|
|
339
|
+
position: 'left' as const,
|
|
340
|
+
grid: {
|
|
341
|
+
drawOnChartArea: true
|
|
342
|
+
},
|
|
343
|
+
title: {
|
|
344
|
+
display: mixedBarLineDataProps.yLeftAxisTitle !== null,
|
|
345
|
+
text: mixedBarLineDataProps.yLeftAxisTitle
|
|
346
|
+
},
|
|
347
|
+
ticks: {
|
|
348
|
+
callback: function (val: string | number) {
|
|
349
|
+
return mixedBarLineDataProps.barUnit === '%'
|
|
350
|
+
? formatTicks(val as number, mixedBarLineDataProps.unit)
|
|
351
|
+
: formatWithThousandsSeprators(val as number) +
|
|
352
|
+
' ' +
|
|
353
|
+
mixedBarLineDataProps.barUnit;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
},
|
|
357
|
+
B: {
|
|
358
|
+
type: 'linear' as const,
|
|
359
|
+
display: true,
|
|
360
|
+
position: 'right' as const,
|
|
361
|
+
grid: {
|
|
362
|
+
drawOnChartArea: false
|
|
363
|
+
},
|
|
364
|
+
title: {
|
|
365
|
+
display: mixedBarLineDataProps.yRightAxisTitle !== null,
|
|
366
|
+
text: mixedBarLineDataProps.yRightAxisTitle
|
|
367
|
+
},
|
|
368
|
+
ticks: {
|
|
369
|
+
callback: function (val: string | number) {
|
|
370
|
+
return (
|
|
371
|
+
(mixedBarLineDataProps.lineUnit === '%'
|
|
372
|
+
? formatTicks(val as number, mixedBarLineDataProps.unit)
|
|
373
|
+
: formatWithThousandsSeprators(val as number)) +
|
|
374
|
+
' ' +
|
|
375
|
+
mixedBarLineDataProps.lineUnit
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}));
|
|
382
|
+
|
|
383
|
+
const htmlLegendPlugin = ref(
|
|
384
|
+
privateGetHtmlLegendPlugin(
|
|
385
|
+
legendContainer,
|
|
386
|
+
selectMode,
|
|
387
|
+
disablePattern,
|
|
388
|
+
patternsColors,
|
|
389
|
+
patternsOrderedList
|
|
390
|
+
)
|
|
391
|
+
);
|
|
392
|
+
</script>
|
|
393
|
+
|
|
394
|
+
<style lang="scss">
|
|
395
|
+
@import 'settings-tools/all-settings';
|
|
396
|
+
@import 'components/c.checkbox';
|
|
397
|
+
</style>
|
|
398
|
+
|
|
399
|
+
<style scoped>
|
|
400
|
+
.container {
|
|
401
|
+
-moz-osx-font-smoothing: grayscale;
|
|
402
|
+
-webkit-font-smoothing: antialiased;
|
|
403
|
+
font-weight: 400;
|
|
404
|
+
font-family: 'Roboto', sans-serif;
|
|
405
|
+
}
|
|
406
|
+
.main {
|
|
407
|
+
display: flex;
|
|
408
|
+
flex-direction: column;
|
|
409
|
+
justify-content: center;
|
|
410
|
+
align-items: center;
|
|
411
|
+
margin-bottom: 20px;
|
|
412
|
+
}
|
|
413
|
+
</style>
|