@mozaic-ds/chart 0.1.0-beta.3 → 0.1.0-beta.31
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 +4454 -2624
- 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 +141 -66
- 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
|
@@ -1,32 +1,37 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="container">
|
|
3
|
-
<div class=
|
|
3
|
+
<div class="main" :style="{ height }">
|
|
4
4
|
<Radar
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
:style='{ height, cursor:"pointer",}'
|
|
5
|
+
v-if="radarData"
|
|
6
|
+
:id="chartId"
|
|
7
|
+
:data="radarData"
|
|
8
|
+
:options="chartOptions"
|
|
9
|
+
:plugins="radarPlugins"
|
|
10
|
+
:class="cssClasses"
|
|
11
|
+
:style="[{ height, cursor: 'pointer' }, styles]"
|
|
13
12
|
/>
|
|
14
13
|
</div>
|
|
15
|
-
<div ref=
|
|
14
|
+
<div ref="legendContainer" class="legendContainer" />
|
|
16
15
|
</div>
|
|
17
16
|
</template>
|
|
18
17
|
|
|
19
|
-
<script setup lang=
|
|
18
|
+
<script setup lang="ts">
|
|
20
19
|
import { PropType, ref, computed } from 'vue';
|
|
21
20
|
import type { Area } from '../../types/RadarData';
|
|
22
21
|
import { Radar } from 'vue-chartjs';
|
|
23
22
|
import type { ActiveElement, ChartData } from 'chart.js';
|
|
24
|
-
import {
|
|
25
|
-
|
|
23
|
+
import {
|
|
24
|
+
Context,
|
|
25
|
+
GenericTooltipService
|
|
26
|
+
} from '../../services/GenericTooltipService';
|
|
27
|
+
import { formatWithThousandsSeprators } from '../../services/FormatUtilities';
|
|
26
28
|
import { TooltipChartType } from '../../types/TooltipChartType';
|
|
27
|
-
import {
|
|
29
|
+
import {
|
|
30
|
+
drawLabels,
|
|
31
|
+
splitLabelIfTooLong
|
|
32
|
+
} from '../../services/RadarChartFunctions';
|
|
28
33
|
import type { Chart, ChartItem } from '../../services/ChartsCommonLegend';
|
|
29
|
-
import { addAlpha } from '../../services/ColorFunctions'
|
|
34
|
+
import { addAlpha } from '../../services/ColorFunctions';
|
|
30
35
|
import {
|
|
31
36
|
Chart as ChartJS,
|
|
32
37
|
Filler,
|
|
@@ -58,113 +63,137 @@ ChartJS.register(
|
|
|
58
63
|
RadialLinearScale,
|
|
59
64
|
LineElement,
|
|
60
65
|
PointElement,
|
|
61
|
-
Filler
|
|
66
|
+
Filler
|
|
62
67
|
);
|
|
63
68
|
|
|
64
|
-
const {
|
|
65
|
-
colourSets,
|
|
66
|
-
patternsStandardList
|
|
67
|
-
} = ChartDesign();
|
|
69
|
+
const { colourSets, patternsStandardList } = ChartDesign();
|
|
68
70
|
|
|
69
71
|
const radarComponentChartProps = defineProps({
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
/**
|
|
73
|
+
* Value of the id attribute present on the <canvas> tag element the chart
|
|
74
|
+
*/
|
|
75
|
+
chartId: {
|
|
76
|
+
type: String,
|
|
77
|
+
default: 'radar-chart'
|
|
78
|
+
},
|
|
79
|
+
/**
|
|
80
|
+
* Value of the `height` css property used to define the height of the <canvas> element
|
|
81
|
+
*/
|
|
82
|
+
height: {
|
|
83
|
+
type: String,
|
|
84
|
+
default: '600px'
|
|
85
|
+
},
|
|
86
|
+
/**
|
|
87
|
+
* Labels used to label the index axis (default x axes). See [Data structures documentation](https://www.chartjs.org/docs/latest/general/data-structures.html)
|
|
88
|
+
*/
|
|
89
|
+
labels: {
|
|
79
90
|
type: Array as PropType<string[]>,
|
|
80
91
|
default: () => []
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
92
|
+
},
|
|
93
|
+
/**
|
|
94
|
+
* Disable accessibility patterns
|
|
95
|
+
*/
|
|
96
|
+
disableAccessibility: {
|
|
97
|
+
type: Boolean,
|
|
98
|
+
default: false
|
|
99
|
+
},
|
|
100
|
+
/**
|
|
101
|
+
* Used to choose the colour set of the charts as defined in the Figma prototypes.
|
|
102
|
+
* 7 colour sets are currently defined:
|
|
103
|
+
* - Default 0 corresponds to the current one
|
|
104
|
+
* - 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)
|
|
105
|
+
* Note: All the sets are defined in /src/services/patterns/ChartDesign.ts
|
|
106
|
+
*/
|
|
107
|
+
colourSet: {
|
|
108
|
+
type: Number,
|
|
109
|
+
default: 0
|
|
110
|
+
},
|
|
111
|
+
/**
|
|
112
|
+
* 6 patterns exist and are not randomly given but follow the order defined in [patternsStandardList](/src/services/patterns/ChartDesign.ts)
|
|
113
|
+
* Additionally, a pattern has only one possible colour per colour set as defined in the Figma prototype.
|
|
114
|
+
* In some use cases, the chart may need to show a different orders of these patterns, this can be changed using the props newPatternsOrder
|
|
115
|
+
*/
|
|
116
|
+
newPatternsOrder: {
|
|
117
|
+
type: Array as PropType<number[]>,
|
|
118
|
+
default: () => [0, 1, 2, 3, 4, 5]
|
|
119
|
+
},
|
|
120
|
+
/**
|
|
121
|
+
* Value of the `datasets` key present in the `data` object passed to the Chart config
|
|
122
|
+
*/
|
|
123
|
+
datasets: {
|
|
124
|
+
type: Array as PropType<Area[]>,
|
|
125
|
+
default: () => []
|
|
126
|
+
},
|
|
127
|
+
/**
|
|
128
|
+
* Add custom CSS classes to the <canvas> element
|
|
129
|
+
*/
|
|
130
|
+
cssClasses: {
|
|
131
|
+
default: '',
|
|
132
|
+
type: String
|
|
133
|
+
},
|
|
134
|
+
/**
|
|
135
|
+
* Add custom CSS styles to the <canvas> element
|
|
136
|
+
*/
|
|
137
|
+
styles: {
|
|
138
|
+
type: Object as PropType<Partial<CSSStyleDeclaration>>,
|
|
139
|
+
default: () => {}
|
|
140
|
+
},
|
|
141
|
+
/**
|
|
142
|
+
* Value of the `plugins` key passed to the Chart config
|
|
143
|
+
*/
|
|
144
|
+
plugins: {
|
|
145
|
+
type: Array as PropType<Plugin<'radar'>[]>,
|
|
146
|
+
default: () => []
|
|
147
|
+
}
|
|
148
|
+
});
|
|
120
149
|
|
|
121
|
-
const patternsColors = computed(() =>
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
)
|
|
150
|
+
const patternsColors = computed(() =>
|
|
151
|
+
radarComponentChartProps.newPatternsOrder.length !== 6
|
|
152
|
+
? colourSets[radarComponentChartProps.colourSet]
|
|
153
|
+
: radarComponentChartProps.newPatternsOrder.map((id) => {
|
|
154
|
+
return colourSets[radarComponentChartProps.colourSet][id];
|
|
155
|
+
})
|
|
156
|
+
);
|
|
125
157
|
|
|
126
|
-
const patternsOrderedList = computed(() =>
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
)
|
|
158
|
+
const patternsOrderedList = computed(() =>
|
|
159
|
+
radarComponentChartProps.newPatternsOrder.length !== 6
|
|
160
|
+
? patternsStandardList
|
|
161
|
+
: radarComponentChartProps.newPatternsOrder.map((id) => {
|
|
162
|
+
return patternsStandardList[id];
|
|
163
|
+
})
|
|
164
|
+
);
|
|
130
165
|
|
|
131
166
|
const radarData = computed<ChartData<'radar'>>(() => ({
|
|
132
167
|
labels: getRadarLabels(),
|
|
133
|
-
datasets:
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
pointHitRadius: 55,
|
|
143
|
-
pointRadius: 5,
|
|
144
|
-
pointHoverBackgroundColor: patternsColors.value[0],
|
|
145
|
-
pointHoverBorderColor: patternsColors.value[0],
|
|
146
|
-
data: radarComponentChartProps.areas[0].areaData.map((x: { position: number }) => x.position)
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
label: 'Data Two',
|
|
150
|
-
backgroundColor: addAlpha(patternsColors.value[1], 0.1),
|
|
151
|
-
borderColor: patternsColors.value[1],
|
|
168
|
+
datasets: getDatasets()
|
|
169
|
+
}));
|
|
170
|
+
|
|
171
|
+
function getDatasets() {
|
|
172
|
+
return radarComponentChartProps.datasets.map((dataset, index) => {
|
|
173
|
+
return {
|
|
174
|
+
label: dataset.label,
|
|
175
|
+
backgroundColor: addAlpha(patternsColors.value[index], 0.1),
|
|
176
|
+
borderColor: patternsColors.value[index],
|
|
152
177
|
pointBackgroundColor: '#FFFFFF',
|
|
153
|
-
pointBorderColor: patternsColors.value[
|
|
178
|
+
pointBorderColor: patternsColors.value[index],
|
|
154
179
|
pointBorderWidth: 2,
|
|
155
180
|
borderWidth: 2,
|
|
156
181
|
pointHitRadius: 55,
|
|
157
182
|
pointRadius: 5,
|
|
158
|
-
pointStyle: 'rectRot',
|
|
159
|
-
pointHoverBackgroundColor: patternsColors.value[
|
|
160
|
-
pointHoverBorderColor: patternsColors.value[
|
|
161
|
-
data:
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
}
|
|
183
|
+
pointStyle: index % 2 === 0 ? 'circle' : 'rectRot',
|
|
184
|
+
pointHoverBackgroundColor: patternsColors.value[index],
|
|
185
|
+
pointHoverBorderColor: patternsColors.value[index],
|
|
186
|
+
data: dataset.areaData.map((x: { position: number }) => x.position)
|
|
187
|
+
};
|
|
188
|
+
});
|
|
189
|
+
}
|
|
165
190
|
|
|
166
191
|
const chartOptions: any = {
|
|
167
|
-
|
|
192
|
+
onClick: (
|
|
193
|
+
_ingnore: unknown,
|
|
194
|
+
clickedElements: ActiveElement[],
|
|
195
|
+
chart: Chart
|
|
196
|
+
) => {
|
|
168
197
|
if (clickedElements[0]) {
|
|
169
198
|
hideAllButThis(chart, clickedElements[0].datasetIndex, selectMode);
|
|
170
199
|
}
|
|
@@ -179,6 +208,9 @@ const chartOptions: any = {
|
|
|
179
208
|
title: {
|
|
180
209
|
display: false
|
|
181
210
|
},
|
|
211
|
+
datalabels: {
|
|
212
|
+
display: false
|
|
213
|
+
},
|
|
182
214
|
tooltip: {
|
|
183
215
|
enabled: false,
|
|
184
216
|
position: 'nearest' as const,
|
|
@@ -195,16 +227,22 @@ const chartOptions: any = {
|
|
|
195
227
|
}
|
|
196
228
|
},
|
|
197
229
|
layout: {
|
|
198
|
-
padding:
|
|
230
|
+
padding: {
|
|
231
|
+
left: 130,
|
|
232
|
+
right: 95,
|
|
233
|
+
top: 95,
|
|
234
|
+
bottom: 95
|
|
235
|
+
}
|
|
199
236
|
},
|
|
200
237
|
scales: {
|
|
201
238
|
r: {
|
|
202
239
|
min: 0,
|
|
203
240
|
max: 100,
|
|
204
241
|
pointLabels: {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
242
|
+
display: false,
|
|
243
|
+
font: {
|
|
244
|
+
weight: 400,
|
|
245
|
+
family: 'Roboto'
|
|
208
246
|
}
|
|
209
247
|
},
|
|
210
248
|
ticks: {
|
|
@@ -213,37 +251,30 @@ const chartOptions: any = {
|
|
|
213
251
|
}
|
|
214
252
|
}
|
|
215
253
|
}
|
|
216
|
-
|
|
254
|
+
};
|
|
217
255
|
const legendContainer = ref(null);
|
|
218
256
|
const selectMode = ref(false);
|
|
219
|
-
|
|
220
|
-
const radarLimitLabelLength = 15;
|
|
221
|
-
if (axisLabel.length > radarLimitLabelLength && axisLabel.includes(' ', radarLimitLabelLength)) {
|
|
222
|
-
const indexOfFirstSpaceAfterLimit: number = axisLabel.indexOf(' ', radarLimitLabelLength);
|
|
223
|
-
return [
|
|
224
|
-
axisLabel.substring(0, indexOfFirstSpaceAfterLimit),
|
|
225
|
-
axisLabel.substring(indexOfFirstSpaceAfterLimit),
|
|
226
|
-
buildValue
|
|
227
|
-
];
|
|
228
|
-
}
|
|
229
|
-
return [
|
|
230
|
-
axisLabel,
|
|
231
|
-
buildValue
|
|
232
|
-
];
|
|
233
|
-
}
|
|
257
|
+
|
|
234
258
|
const getRadarLabels = () => {
|
|
235
259
|
return radarComponentChartProps.labels.map((label: string, index: number) => {
|
|
236
|
-
const buildValue = radarComponentChartProps.
|
|
237
|
-
|
|
260
|
+
const buildValue = radarComponentChartProps.datasets[0].areaData[index]
|
|
261
|
+
.value
|
|
262
|
+
? `${formatNumber(
|
|
263
|
+
radarComponentChartProps.datasets[0].areaData[index].value + ''
|
|
264
|
+
)} ${radarComponentChartProps.datasets[0].areaData[index].unit}`
|
|
238
265
|
: 'No Data';
|
|
239
266
|
return splitLabelIfTooLong(label, buildValue);
|
|
240
267
|
});
|
|
241
|
-
}
|
|
268
|
+
};
|
|
242
269
|
const formatNumber = (numberFromJson: string) => {
|
|
243
270
|
return formatWithThousandsSeprators(parseFloat(numberFromJson));
|
|
244
271
|
};
|
|
245
|
-
function createLegendElementWithCheckbox
|
|
246
|
-
const liContent = createLegendCheckbox(
|
|
272
|
+
function createLegendElementWithCheckbox(chart: any, item: ChartItem) {
|
|
273
|
+
const liContent = createLegendCheckbox(
|
|
274
|
+
chart,
|
|
275
|
+
item,
|
|
276
|
+
null as unknown as string[]
|
|
277
|
+
);
|
|
247
278
|
liContent.onclick = (e: Event) => {
|
|
248
279
|
switchItemVisibility(chart, item.datasetIndex, selectMode);
|
|
249
280
|
e.stopPropagation();
|
|
@@ -251,44 +282,53 @@ function createLegendElementWithCheckbox (chart: any, item: ChartItem) {
|
|
|
251
282
|
return liContent;
|
|
252
283
|
}
|
|
253
284
|
|
|
254
|
-
const radarPlugins = [
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
ul.firstChild
|
|
260
|
-
|
|
261
|
-
const items = chart.options.plugins.legend.labels.generateLabels(chart).reverse();
|
|
262
|
-
items.forEach((item: ChartItem) => {
|
|
263
|
-
const li = createHtmlLegendListElement(chart, selectMode, item.datasetIndex);
|
|
264
|
-
let liContent;
|
|
265
|
-
li.style.marginRight = '0.625rem';
|
|
266
|
-
if (!selectMode.value) {
|
|
267
|
-
liContent = createLegendElementWithSquareArea(item, true);
|
|
268
|
-
} else {
|
|
269
|
-
liContent = createLegendElementWithCheckbox(chart, item);
|
|
285
|
+
const radarPlugins = [
|
|
286
|
+
{
|
|
287
|
+
id: 'htmlLegend',
|
|
288
|
+
afterUpdate(chart: any) {
|
|
289
|
+
const ul = getOrCreateLegendList(legendContainer, 'row');
|
|
290
|
+
while (ul.firstChild) {
|
|
291
|
+
ul.firstChild.remove();
|
|
270
292
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
293
|
+
const items = chart.options.plugins.legend.labels
|
|
294
|
+
.generateLabels(chart)
|
|
295
|
+
.reverse();
|
|
296
|
+
items.forEach((item: ChartItem) => {
|
|
297
|
+
const li = createHtmlLegendListElement(
|
|
298
|
+
chart,
|
|
299
|
+
selectMode,
|
|
300
|
+
item.datasetIndex
|
|
301
|
+
);
|
|
302
|
+
let liContent;
|
|
303
|
+
li.style.marginRight = '0.625rem';
|
|
304
|
+
if (!selectMode.value) {
|
|
305
|
+
liContent = createLegendElementWithSquareArea(item, true);
|
|
306
|
+
} else {
|
|
307
|
+
liContent = createLegendElementWithCheckbox(chart, item);
|
|
308
|
+
}
|
|
309
|
+
li.appendChild(liContent);
|
|
310
|
+
li.appendChild(createHtmlLegendItemText(item));
|
|
311
|
+
ul.appendChild(li);
|
|
312
|
+
});
|
|
313
|
+
}
|
|
280
314
|
},
|
|
281
|
-
|
|
315
|
+
{
|
|
316
|
+
id: 'radarLabelPlugin',
|
|
317
|
+
beforeDraw(chart: any) {
|
|
318
|
+
drawLabels(chart, radarComponentChartProps);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
];
|
|
282
322
|
|
|
283
323
|
const getTooltipData = (context: Context): string => {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
324
|
+
const datasetIndex = context.tooltip.dataPoints[0].datasetIndex as number;
|
|
325
|
+
const dataIndex = context.tooltip.dataPoints[0].dataIndex as number;
|
|
326
|
+
const data = radarComponentChartProps.datasets[datasetIndex];
|
|
327
|
+
return (
|
|
328
|
+
data.areaData[dataIndex].value.toFixed(2) +
|
|
329
|
+
' ' +
|
|
330
|
+
data.areaData[dataIndex].unit
|
|
331
|
+
);
|
|
292
332
|
};
|
|
293
333
|
</script>
|
|
294
334
|
|
|
@@ -300,10 +340,9 @@ const getTooltipData = (context: Context): string => {
|
|
|
300
340
|
font-family: 'Roboto', sans-serif;
|
|
301
341
|
}
|
|
302
342
|
.main {
|
|
303
|
-
height: 600px;
|
|
304
343
|
display: flex;
|
|
305
344
|
flex-direction: column;
|
|
306
345
|
justify-content: center;
|
|
307
346
|
align-items: center;
|
|
308
347
|
}
|
|
309
|
-
</style>
|
|
348
|
+
</style>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { App } from
|
|
2
|
-
import RadarChart from
|
|
1
|
+
import type { App } from 'vue';
|
|
2
|
+
import RadarChart from './RadarChart.vue';
|
|
3
3
|
|
|
4
4
|
RadarChart.install = (app: App) => {
|
|
5
|
-
app.component(
|
|
5
|
+
app.component('RadarChart', RadarChart);
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
export { RadarChart };
|
package/src/main.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import BarChart from './components/bar/BarChart.vue';
|
|
2
|
+
import DoughnutChart from './components/doughnut/DoughnutChart.vue';
|
|
3
|
+
import LineChart from './components/line/LineChart.vue';
|
|
4
|
+
import RadarChart from './components/radar/RadarChart.vue';
|
|
5
|
+
import MixedBarLineChart from './components/mixed/MixedBarLineChart.vue';
|
|
6
|
+
import BubbleChart from './components/bubble/BubbleChart.vue';
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
export {
|
|
9
|
+
BarChart,
|
|
10
|
+
DoughnutChart,
|
|
11
|
+
LineChart,
|
|
12
|
+
RadarChart,
|
|
13
|
+
MixedBarLineChart,
|
|
14
|
+
BubbleChart
|
|
15
|
+
};
|
package/src/plugin.ts
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import type { App } from
|
|
2
|
-
import * as Components from
|
|
1
|
+
import type { App } from 'vue';
|
|
2
|
+
import * as Components from './components';
|
|
3
3
|
|
|
4
4
|
const MozaicChart = {
|
|
5
|
-
install: (app: App) => {
|
|
5
|
+
install: (app: App, options: {}) => {
|
|
6
6
|
Object.keys(Components).forEach((name) => {
|
|
7
7
|
// @ts-ignore
|
|
8
8
|
app.component(name, Components[name]);
|
|
9
9
|
});
|
|
10
|
-
}
|
|
10
|
+
}
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
export default MozaicChart;
|
|
14
14
|
|
|
15
|
-
export { BarChart } from
|
|
16
|
-
export { DoughnutChart } from
|
|
17
|
-
export { LineChart } from
|
|
18
|
-
export { RadarChart } from
|
|
15
|
+
export { BarChart } from './components/bar';
|
|
16
|
+
export { DoughnutChart } from './components/doughnut';
|
|
17
|
+
export { LineChart } from './components/line';
|
|
18
|
+
export { RadarChart } from './components/radar';
|
|
19
|
+
export { MixedBarLineChart } from './components/mixed';
|
|
20
|
+
export { BubbleChart } from './components/bubble';
|