@mozaic-ds/chart 0.1.0-beta.2 → 0.1.0-beta.23
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 +4111 -2476
- package/dist/mozaic-chart.umd.cjs +17 -11
- package/dist/style.css +1 -1
- package/package.json +23 -10
- package/src/assets/img/bubbles.svg +4 -0
- package/src/components/bar/BarChart.stories.ts +12 -10
- package/src/components/bar/BarChart.vue +248 -141
- package/src/components/bubble/BubbleChart.stories.ts +66 -0
- package/src/components/bubble/BubbleChart.vue +336 -0
- package/src/components/bubble/index.ts +8 -0
- package/src/components/doughnut/DoughnutChart.stories.ts +1 -0
- package/src/components/doughnut/DoughnutChart.vue +182 -101
- package/src/components/line/LineChart.stories.ts +2 -1
- package/src/components/line/LineChart.vue +331 -258
- package/src/components/mixed/MixedBarLineChart.stories.ts +91 -0
- package/src/components/mixed/MixedBarLineChart.vue +411 -0
- package/src/components/mixed/index.ts +8 -0
- package/src/components/radar/RadarChart.stories.ts +2 -2
- package/src/components/radar/RadarChart.vue +203 -157
- package/src/main.ts +3 -1
- package/src/plugin.ts +2 -0
- package/src/services/BarChartFunctions.ts +10 -7
- package/src/services/BubbleTooltipService.ts +65 -0
- package/src/services/ChartsCommonLegend.ts +86 -58
- package/src/services/DoughnutChartFunctions.ts +107 -59
- package/src/services/FormatUtilities.ts +1 -1
- package/src/services/GenericTooltipService.ts +25 -10
- package/src/services/MixedBarLineFunctions.ts +258 -0
- package/src/services/RadarChartFunctions.ts +33 -12
- 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 +6 -0
- package/src/types/BarData.ts +1 -0
- package/src/types/MixedBarLineData.ts +7 -0
- package/src/types/TooltipChartType.ts +1 -0
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { reactive, ref, type Ref } from 'vue';
|
|
2
|
+
import PatternFunctions from './PatternFunctions';
|
|
3
|
+
import { addAlpha } from './ColorFunctions';
|
|
4
|
+
import type { HTMLLegendPlugin } from '../types/Chart';
|
|
5
|
+
import {
|
|
6
|
+
getOrCreateLegendList,
|
|
7
|
+
createHtmlLegendListElement,
|
|
8
|
+
createLegendElementWithPatterns,
|
|
9
|
+
createLegendElementWithCheckbox,
|
|
10
|
+
createHtmlLegendItemText,
|
|
11
|
+
createLegendElementWithSquareArea,
|
|
12
|
+
type ChartItem,
|
|
13
|
+
} from './ChartsCommonLegend';
|
|
14
|
+
|
|
15
|
+
const { getPatternIndexWithShift } = PatternFunctions();
|
|
16
|
+
|
|
17
|
+
export default function () {
|
|
18
|
+
const borderWidth = ref(2);
|
|
19
|
+
const onHoverIndex: { dataSetIndex: number; columnIndex: number } = reactive({
|
|
20
|
+
dataSetIndex: -1,
|
|
21
|
+
columnIndex: -1,
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
interface Dataset {
|
|
25
|
+
data: any;
|
|
26
|
+
label: string;
|
|
27
|
+
type: any;
|
|
28
|
+
fill?: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function getHtmlLegendPlugin(
|
|
32
|
+
legendContainer: Ref,
|
|
33
|
+
selectMode: Ref<boolean>,
|
|
34
|
+
onHoverIndex: any,
|
|
35
|
+
disableAccessibility: Ref<boolean>,
|
|
36
|
+
patternsColors: Ref<string[]>,
|
|
37
|
+
patternsList: Ref<
|
|
38
|
+
((
|
|
39
|
+
hover: boolean,
|
|
40
|
+
color: string,
|
|
41
|
+
disableAccessibility: boolean
|
|
42
|
+
) => CanvasPattern)[]
|
|
43
|
+
>
|
|
44
|
+
): HTMLLegendPlugin[] {
|
|
45
|
+
return [
|
|
46
|
+
{
|
|
47
|
+
id: 'htmlLegend',
|
|
48
|
+
afterUpdate(chart: any) {
|
|
49
|
+
const ul: HTMLLIElement = getOrCreateLegendList(
|
|
50
|
+
legendContainer,
|
|
51
|
+
'column'
|
|
52
|
+
);
|
|
53
|
+
ul.style.display = 'flex';
|
|
54
|
+
ul.style.margin = '1.375rem 1.0625rem';
|
|
55
|
+
ul.style.flexDirection = 'row-reverse';
|
|
56
|
+
ul.style.justifyContent = 'flex-end';
|
|
57
|
+
while (ul.firstChild) {
|
|
58
|
+
ul.firstChild.remove();
|
|
59
|
+
}
|
|
60
|
+
const items: ChartItem[] =
|
|
61
|
+
chart.options.plugins.legend.labels.generateLabels(chart);
|
|
62
|
+
items.sort((a,b) => b.datasetIndex - a.datasetIndex).forEach((item: ChartItem): void => {
|
|
63
|
+
const li: HTMLElement = createHtmlLegendListElement(
|
|
64
|
+
chart,
|
|
65
|
+
selectMode,
|
|
66
|
+
item.datasetIndex
|
|
67
|
+
);
|
|
68
|
+
let liContent: HTMLElement;
|
|
69
|
+
if (!selectMode.value) {
|
|
70
|
+
if (item?.lineCap) {
|
|
71
|
+
liContent = createLegendElementWithSquareArea(item);
|
|
72
|
+
} else {
|
|
73
|
+
liContent = createLegendElementWithPatterns(
|
|
74
|
+
item,
|
|
75
|
+
chart,
|
|
76
|
+
{ datasetIndex: -1 },
|
|
77
|
+
disableAccessibility.value,
|
|
78
|
+
patternsColors.value,
|
|
79
|
+
patternsList.value,
|
|
80
|
+
false
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
} else {
|
|
84
|
+
liContent = createLegendElementWithCheckbox(
|
|
85
|
+
chart,
|
|
86
|
+
item,
|
|
87
|
+
selectMode,
|
|
88
|
+
{ datasetIndex: -1 },
|
|
89
|
+
patternsColors.value,
|
|
90
|
+
false
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
liContent.style.boxSizing = 'border-box';
|
|
94
|
+
li.style.marginRight = '10px';
|
|
95
|
+
li.appendChild(liContent);
|
|
96
|
+
li.appendChild(createHtmlLegendItemText(item));
|
|
97
|
+
ul.appendChild(li);
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function privateGetHtmlLegendPlugin(
|
|
105
|
+
legendContainer: Ref,
|
|
106
|
+
selectMode: Ref<boolean>,
|
|
107
|
+
disableAccessibility: Ref<boolean>,
|
|
108
|
+
patternsColors: Ref<string[]>,
|
|
109
|
+
patternsList: Ref<
|
|
110
|
+
((
|
|
111
|
+
hover: boolean,
|
|
112
|
+
color: string,
|
|
113
|
+
disableAccessibility: boolean
|
|
114
|
+
) => CanvasPattern)[]
|
|
115
|
+
>
|
|
116
|
+
) {
|
|
117
|
+
return getHtmlLegendPlugin(
|
|
118
|
+
legendContainer,
|
|
119
|
+
selectMode,
|
|
120
|
+
onHoverIndex,
|
|
121
|
+
disableAccessibility,
|
|
122
|
+
patternsColors,
|
|
123
|
+
patternsList
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function getMixedDatasets(
|
|
128
|
+
datasets: Dataset[],
|
|
129
|
+
disableAccessibility: boolean,
|
|
130
|
+
patternsColors: string[],
|
|
131
|
+
patternsList: ((
|
|
132
|
+
hover: boolean,
|
|
133
|
+
color: string,
|
|
134
|
+
disableAccessibility: boolean
|
|
135
|
+
) => CanvasPattern)[],
|
|
136
|
+
patternShifting?: number
|
|
137
|
+
) {
|
|
138
|
+
// Hack to force refresh
|
|
139
|
+
const borderWithValue = borderWidth.value;
|
|
140
|
+
return datasets.map((dataset, index) => {
|
|
141
|
+
const isBarChart = dataset.type === 'bar';
|
|
142
|
+
return {
|
|
143
|
+
type: dataset.type,
|
|
144
|
+
fill: isBarChart ? null : false,
|
|
145
|
+
borderWidth: function () {
|
|
146
|
+
return disableAccessibility && isBarChart ? 1 : borderWithValue;
|
|
147
|
+
},
|
|
148
|
+
borderColor: function (context: any) {
|
|
149
|
+
return disableAccessibility && isBarChart
|
|
150
|
+
? '#00000000'
|
|
151
|
+
: isBarChart
|
|
152
|
+
? getBorderColor(
|
|
153
|
+
index,
|
|
154
|
+
context.index,
|
|
155
|
+
patternsColors,
|
|
156
|
+
patternShifting
|
|
157
|
+
)
|
|
158
|
+
: patternsColors[index];
|
|
159
|
+
},
|
|
160
|
+
backgroundColor: function (context: any) {
|
|
161
|
+
return getPattern(
|
|
162
|
+
index,
|
|
163
|
+
context.index,
|
|
164
|
+
disableAccessibility,
|
|
165
|
+
patternsColors,
|
|
166
|
+
patternsList,
|
|
167
|
+
patternShifting
|
|
168
|
+
);
|
|
169
|
+
},
|
|
170
|
+
yAxisID: isBarChart ? 'A' : 'B',
|
|
171
|
+
pointStyle: index % 2 === 0 ? 'rectRot' : 'circle',
|
|
172
|
+
data: dataset.data,
|
|
173
|
+
label: dataset.label,
|
|
174
|
+
pointBackgroundColor: '#FFFFFF',
|
|
175
|
+
pointRadius: 5,
|
|
176
|
+
order: dataset.type === 'line' ? 0 : 1,
|
|
177
|
+
};
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function getBorderColor(
|
|
182
|
+
dataSetIndex: number,
|
|
183
|
+
contextIndex: number,
|
|
184
|
+
patternsColors: string[],
|
|
185
|
+
patternShifting?: number
|
|
186
|
+
) {
|
|
187
|
+
const index = getPatternIndexWithShift(dataSetIndex, patternShifting);
|
|
188
|
+
if (displayFullOpacity(dataSetIndex, contextIndex)) {
|
|
189
|
+
return patternsColors[index];
|
|
190
|
+
} else {
|
|
191
|
+
return addAlpha(patternsColors[index], 0.2);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function getPattern(
|
|
196
|
+
dataSetIndex: number,
|
|
197
|
+
contextIndex: number,
|
|
198
|
+
disableAccessibility: boolean,
|
|
199
|
+
patternsColors: string[],
|
|
200
|
+
patternsList: ((
|
|
201
|
+
hover: boolean,
|
|
202
|
+
color: string,
|
|
203
|
+
disableAccessibility: boolean
|
|
204
|
+
) => CanvasPattern)[],
|
|
205
|
+
patternShifting?: number
|
|
206
|
+
) {
|
|
207
|
+
const index = getPatternIndexWithShift(dataSetIndex, patternShifting);
|
|
208
|
+
if (displayFullOpacity(dataSetIndex, contextIndex)) {
|
|
209
|
+
return patternsList[index](
|
|
210
|
+
false,
|
|
211
|
+
patternsColors[index],
|
|
212
|
+
disableAccessibility
|
|
213
|
+
);
|
|
214
|
+
} else {
|
|
215
|
+
return patternsList[index](
|
|
216
|
+
true,
|
|
217
|
+
patternsColors[index],
|
|
218
|
+
disableAccessibility
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function displayFullOpacity(
|
|
224
|
+
dataSetIndex: number,
|
|
225
|
+
contextIndex: number
|
|
226
|
+
): boolean {
|
|
227
|
+
return (
|
|
228
|
+
nothingHovered() ||
|
|
229
|
+
columnHovered(dataSetIndex, contextIndex) ||
|
|
230
|
+
legendHovered(dataSetIndex)
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function nothingHovered(): boolean {
|
|
235
|
+
return onHoverIndex.dataSetIndex < 0;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function columnHovered(dataSetIndex: number, contextIndex: number): boolean {
|
|
239
|
+
return (
|
|
240
|
+
onHoverIndex.dataSetIndex === dataSetIndex &&
|
|
241
|
+
onHoverIndex.columnIndex === contextIndex
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function legendHovered(dataSetIndex: number): boolean {
|
|
246
|
+
return (
|
|
247
|
+
onHoverIndex.dataSetIndex === dataSetIndex && onHoverIndex.columnIndex < 0
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return {
|
|
252
|
+
privateGetHtmlLegendPlugin,
|
|
253
|
+
getMixedDatasets,
|
|
254
|
+
getBorderColor,
|
|
255
|
+
getPattern,
|
|
256
|
+
onHoverIndex,
|
|
257
|
+
};
|
|
258
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Chart, RadialLinearScale } from 'chart.js';
|
|
2
2
|
|
|
3
|
-
export function drawLabels
|
|
3
|
+
export function drawLabels(chart: Chart, props: any) {
|
|
4
4
|
const ctx = chart.ctx;
|
|
5
5
|
const scale = chart.scales.r as RadialLinearScale;
|
|
6
6
|
const labels = chart.data.labels as string[][];
|
|
@@ -14,37 +14,39 @@ export function drawLabels (chart: Chart, props: any) {
|
|
|
14
14
|
const angle = (scale.getIndexAngle(index) - Math.PI / 2) % (2 * Math.PI);
|
|
15
15
|
const position = scale.getPointPositionForValue(index, scale.max);
|
|
16
16
|
|
|
17
|
-
ctx.textAlign =
|
|
18
|
-
|
|
17
|
+
ctx.textAlign =
|
|
18
|
+
angle <= Math.PI / 2 || angle > (3 * Math.PI) / 2 ? 'left' : 'right';
|
|
19
|
+
let xOffset = angle <= Math.PI / 2 || angle > (3 * Math.PI) / 2 ? 15 : -15;
|
|
19
20
|
|
|
20
21
|
let yOffset;
|
|
21
22
|
//top or bottom labels
|
|
22
|
-
if (
|
|
23
|
+
if (angle < 0 || angle > Math.PI) {
|
|
23
24
|
yOffset = -15;
|
|
24
25
|
} else {
|
|
25
26
|
yOffset = 15;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
//bottom labels
|
|
29
|
-
if (
|
|
30
|
+
if (angle > Math.PI / 4 && angle < (3 * Math.PI) / 4) {
|
|
30
31
|
yOffset *= 3;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
//top labels left and right
|
|
34
|
-
if (
|
|
35
|
+
if (angle < -Math.PI / 4 || angle > (5 * Math.PI) / 4) {
|
|
35
36
|
yOffset *= 3;
|
|
36
37
|
xOffset = 0;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
// full top label
|
|
40
|
-
if (
|
|
41
|
+
if (angle > (11 * Math.PI) / 8 || angle < (-3 * Math.PI) / 8) {
|
|
41
42
|
ctx.textAlign = 'center';
|
|
42
43
|
}
|
|
43
|
-
const yPos = position.y + yOffset * (label.length - 1) / 2;
|
|
44
|
-
ctx.font = '
|
|
44
|
+
const yPos = position.y + (yOffset * (label.length - 1)) / 2;
|
|
45
|
+
ctx.font = '12px Arial';
|
|
45
46
|
|
|
46
47
|
label.forEach((text, i) => {
|
|
47
|
-
const color =
|
|
48
|
+
const color =
|
|
49
|
+
i === label.length - 1 ? buildColorArray(props)[index] : '#000000';
|
|
48
50
|
ctx.fillStyle = color;
|
|
49
51
|
|
|
50
52
|
const x = position.x + xOffset;
|
|
@@ -56,8 +58,8 @@ export function drawLabels (chart: Chart, props: any) {
|
|
|
56
58
|
ctx.restore();
|
|
57
59
|
}
|
|
58
60
|
|
|
59
|
-
const buildColorArray = (props: any): string[]=> {
|
|
60
|
-
return props.
|
|
61
|
+
const buildColorArray = (props: any): string[] => {
|
|
62
|
+
return props.datasets[0].areaData.map((x: { color: string }) => {
|
|
61
63
|
switch (x.color) {
|
|
62
64
|
case 'red':
|
|
63
65
|
return '#C61112';
|
|
@@ -68,3 +70,22 @@ const buildColorArray = (props: any): string[]=> {
|
|
|
68
70
|
}
|
|
69
71
|
});
|
|
70
72
|
};
|
|
73
|
+
|
|
74
|
+
export function splitLabelIfTooLong(axisLabel: string, buildValue: string) {
|
|
75
|
+
const radarLimitLabelLength = 7;
|
|
76
|
+
if (
|
|
77
|
+
axisLabel.length > radarLimitLabelLength &&
|
|
78
|
+
axisLabel.includes(' ', radarLimitLabelLength)
|
|
79
|
+
) {
|
|
80
|
+
const indexOfFirstSpaceAfterLimit: number = axisLabel.indexOf(
|
|
81
|
+
' ',
|
|
82
|
+
radarLimitLabelLength
|
|
83
|
+
);
|
|
84
|
+
return [
|
|
85
|
+
axisLabel.substring(0, indexOfFirstSpaceAfterLimit),
|
|
86
|
+
axisLabel.substring(indexOfFirstSpaceAfterLimit),
|
|
87
|
+
buildValue,
|
|
88
|
+
];
|
|
89
|
+
}
|
|
90
|
+
return [axisLabel, buildValue];
|
|
91
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { Meta } from "@storybook/blocks";
|
|
2
|
+
import { Mermaid } from "mdx-mermaid/Mermaid";
|
|
3
|
+
|
|
4
|
+
<Meta title="Contributing" />
|
|
5
|
+
|
|
6
|
+
# Be part of something bigger!
|
|
7
|
+
|
|
8
|
+
**Mozaic-Chart** is made possible by an incredible community that finds issues and creates pull requests.<br/>
|
|
9
|
+
It is our job to enable you to create amazing applications.
|
|
10
|
+
|
|
11
|
+
Most of the time, you find something that can be made better. You could find a bug, or you have an idea for additional functionality.<br/>
|
|
12
|
+
That's great! It's as easy as cloning the [mozaic-chart repository](https://github.com/adeo/mozaic-chart) to get started working in the development environment.
|
|
13
|
+
|
|
14
|
+
Hopefully this document makes the process for contributing clear and answers some questions that you may have.<br/>
|
|
15
|
+
If you have any questions, please reach out to us on our [slack channel](https://adeo-tech-community.slack.com/archives/CN4K3A99R).
|
|
16
|
+
|
|
17
|
+
## Contribution model
|
|
18
|
+
|
|
19
|
+
The contribution process can be summarized as follows:
|
|
20
|
+
|
|
21
|
+
<Mermaid
|
|
22
|
+
chart={`flowchart TD;
|
|
23
|
+
A((I have a need <br/>fix or new feature));
|
|
24
|
+
A --> B{An issue already exists?};
|
|
25
|
+
B --> |YES| I;
|
|
26
|
+
I([The issue corresponds to my needs <br/>or I complete it]);
|
|
27
|
+
I --> D;
|
|
28
|
+
B --> |NO| C;
|
|
29
|
+
C([I create an issue <br/>]);
|
|
30
|
+
C --> D;
|
|
31
|
+
D{I can contribute?};
|
|
32
|
+
D --> |YES| E;
|
|
33
|
+
D --> |NO| J;
|
|
34
|
+
E([I clone the repo <br/>& create a PR associated to the issue]);
|
|
35
|
+
E --> F;
|
|
36
|
+
F([The PR is ready <br/>and I assign it to reviewers]);
|
|
37
|
+
F --> G;
|
|
38
|
+
G{The proofreading is OK <br/>and the PR is validated?};
|
|
39
|
+
G --> |YES| H;
|
|
40
|
+
G --> |NO| K;
|
|
41
|
+
H([The PR is merged and will be released soon]);
|
|
42
|
+
H;
|
|
43
|
+
J([In this case, I wait for the issue <br/>to be traited and delivered.]);
|
|
44
|
+
K([I make the requested changes]);
|
|
45
|
+
K --> F;
|
|
46
|
+
click B "https://github.com/adeo/mozaic-chart/issues" _blank;
|
|
47
|
+
click C "https://github.com/adeo/mozaic-chart/issues/new/choose" _blank;
|
|
48
|
+
`}
|
|
49
|
+
/>
|
|
50
|
+
|
|
51
|
+
You can now discover the details of each of these steps below.
|
|
52
|
+
|
|
53
|
+
## Reporting issues
|
|
54
|
+
|
|
55
|
+
### Where to find known issues
|
|
56
|
+
|
|
57
|
+
We are using [GitHub Issues](https://github.com/adeo/mozaic-chart/issues) for our bugs.<br/>
|
|
58
|
+
We keep a close eye on this and try to make it clear when we have an internal fix in progress.<br/>
|
|
59
|
+
|
|
60
|
+
**Before filing a new task, try to make sure your problem doesn't already exist.**
|
|
61
|
+
|
|
62
|
+
### Reporting new issue
|
|
63
|
+
|
|
64
|
+
The best way to get your bug fixed is to provide a reduced test case.
|
|
65
|
+
|
|
66
|
+
Once you've gathered all information, please fill out an issue [here](https://github.com/adeo/mozaic-chart/issues/new/choose).
|
|
67
|
+
|
|
68
|
+
## Proposing a change
|
|
69
|
+
|
|
70
|
+
If you intend to add a new component, or make any non-trivial changes, we recommend filing an issue.
|
|
71
|
+
|
|
72
|
+
This will lets us prepare an agreement on your proposal before you put significant effort into it.
|
|
73
|
+
|
|
74
|
+
If you’re only fixing a bug, it should be fine to submit a pull request but we still recommend to submit an issue detailing what you’re looking to fix.
|
|
75
|
+
|
|
76
|
+
## Setup Dev Environment
|
|
77
|
+
|
|
78
|
+
### Project setup
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
// Clone mozaic-chart repo
|
|
82
|
+
git clone git@github.com:adeo/mozaic-chart.git
|
|
83
|
+
|
|
84
|
+
// Go to the cloned directory
|
|
85
|
+
cd mozaic-chart
|
|
86
|
+
|
|
87
|
+
// Checkout the branch you are working on
|
|
88
|
+
git checkout <branch name>
|
|
89
|
+
|
|
90
|
+
// Install dependencies
|
|
91
|
+
npm install
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Submitting Changes/ Pull Requests
|
|
95
|
+
|
|
96
|
+
Working on your first Pull Request?<br/>
|
|
97
|
+
You can learn how from this video series:
|
|
98
|
+
[How to contribute to an open source project on Github](https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github).
|
|
99
|
+
|
|
100
|
+
Mozaic's team is keeping an eye on pull requests.<br/>
|
|
101
|
+
We will check your pull request, either merge it, request changes or close it with explanation.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { Meta } from "@storybook/blocks";
|
|
2
|
+
import { Badge, OutlineCTA, Link } from "@storybook/design-system";
|
|
3
|
+
import pkg from "../../package.json";
|
|
4
|
+
|
|
5
|
+
<Meta title="Getting Started" />
|
|
6
|
+
|
|
7
|
+
<style>
|
|
8
|
+
{`
|
|
9
|
+
.outlineCTA {
|
|
10
|
+
margin: 16px auto;
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
gap: 4px;
|
|
14
|
+
}
|
|
15
|
+
.outlineCTA span {
|
|
16
|
+
font-size: 14px;
|
|
17
|
+
}
|
|
18
|
+
.outlineCTA p {
|
|
19
|
+
margin: 0;
|
|
20
|
+
}
|
|
21
|
+
`}
|
|
22
|
+
</style>
|
|
23
|
+
|
|
24
|
+
# Getting Started
|
|
25
|
+
|
|
26
|
+
**Mozaic-Chart** is the [Chart.js](https://vuejs.org/) implementation for [Vue.js](https://vuejs.org/) of [Mozaic Design System Dataviz](https://mozaic.adeo.cloud/)
|
|
27
|
+
|
|
28
|
+
<OutlineCTA
|
|
29
|
+
className="outlineCTA"
|
|
30
|
+
badge={<Badge status="positive">Vue.js 3</Badge>}
|
|
31
|
+
>
|
|
32
|
+
Note that this package is built to be used only with <strong>Vue.js 3</strong>
|
|
33
|
+
</OutlineCTA>
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
> **PREREQUISITES:**<br/>
|
|
38
|
+
> To allow you to include and use our package, we assume that you are using a module bundlers like [Webpack](https://webpack.js.org/), [Parcel](https://parceljs.org/) or [rollup.js](https://rollupjs.org/guide/en/), or that your project has been initiated with [Vue CLI >= 5](https://cli.vuejs.org/) or [Vite](https://vitejs.dev/guide/). Otherwise, the package might not work.<br/>
|
|
39
|
+
> Minimum Vue.js version required: **{pkg.dependencies.vue.slice(1)}**
|
|
40
|
+
|
|
41
|
+
In order to use **Mozaic-Chart** in your **Vue.js** project, you must first install the [npm package](https://www.npmjs.com/package/@mozaic-ds/chart):
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm install @mozaic-ds/chart --save --save-exact
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Or with **Yarn**:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
yarn add @mozaic-ds/chart -E
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Set up
|
|
54
|
+
|
|
55
|
+
After installing **Mozaic-Chart**, you need to set up the library.
|
|
56
|
+
|
|
57
|
+
The easiest way to do this is to import all components and make them globally available in your application.
|
|
58
|
+
|
|
59
|
+
In your entry point file, insert the following code:
|
|
60
|
+
|
|
61
|
+
```javascript
|
|
62
|
+
// In the entry point file of your application - usually src/main.js
|
|
63
|
+
|
|
64
|
+
import MozaicChart from "@mozaic-ds/chart";
|
|
65
|
+
import "@mozaic-ds/chart/dist/style.css";
|
|
66
|
+
|
|
67
|
+
Vue.use(MozaicChart);
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
<br />
|
|
71
|
+
|
|
72
|
+
### Global/local component registration
|
|
73
|
+
|
|
74
|
+
As indicated in [its documentation](https://vuejs.org/guide/components/registration.html), **Vue.js** proposes to register/import the components in a global or local way:
|
|
75
|
+
|
|
76
|
+
- The global import allows you to make your components accessible throughout your application
|
|
77
|
+
- The local import, on the other hand, makes a component accessible only in the part of the application that uses it
|
|
78
|
+
|
|
79
|
+
> Learn more about the notion of global/local registration on [the associated Vue.js documentation](https://vuejs.org/guide/components/registration.html).
|
|
80
|
+
|
|
81
|
+
{/* > Learn more about how to import globally or locally the components of **Mozaic-Chart** into your project, by visiting [the dedicated documentation](?path=/docs/importing-components--docs). */}
|
|
82
|
+
|
|
83
|
+
## Usage
|
|
84
|
+
|
|
85
|
+
That's it! You’re all set! ✅ <br/>
|
|
86
|
+
You are now able to use the **Mozaic-Chart** components in your **Vue.js** project.
|
|
87
|
+
|
|
88
|
+
Simply call the component as follows:
|
|
89
|
+
|
|
90
|
+
```vue-html
|
|
91
|
+
<BarChart :labels="labels" :datasets="datasets" />
|
|
92
|
+
```
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Meta } from "@storybook/blocks";
|
|
2
|
+
import { Button } from "@storybook/design-system";
|
|
3
|
+
|
|
4
|
+
<Meta
|
|
5
|
+
title="Support & Onboarding"
|
|
6
|
+
parameters={{
|
|
7
|
+
layout: "fullscreen",
|
|
8
|
+
viewMode: "docs",
|
|
9
|
+
previewTabs: {
|
|
10
|
+
canvas: { hidden: true },
|
|
11
|
+
},
|
|
12
|
+
}}
|
|
13
|
+
/>
|
|
14
|
+
|
|
15
|
+
# Need help?
|
|
16
|
+
|
|
17
|
+
## Support
|
|
18
|
+
|
|
19
|
+
Any feedback, ideas or questions?
|
|
20
|
+
|
|
21
|
+
The **Mozaic Design System team** would welcome any feedback, ideas, or requirements that you have.<br/>
|
|
22
|
+
Our goal is to make your lives easier.
|
|
23
|
+
|
|
24
|
+
If you want to get more detailed information on the components or any other topic related to **Mozaic-Vue**, you can contact us through the channels below:
|
|
25
|
+
|
|
26
|
+
- Join the [#ads-charts](https://app.slack.com/client/T4R6RCZFA/C04DE3DN8LD) channel on **Slack**
|
|
27
|
+
- Join the [#mozaic-support](https://app.slack.com/client/T4R6RCZFA/CKQJZL7C4/) channel on **Slack**
|
|
28
|
+
|
|
29
|
+
## Onboarding Sessions
|
|
30
|
+
|
|
31
|
+
Are you new to using a design system, and in particular Mozaic?<br/>
|
|
32
|
+
Do you want to know more about how **Mozaic** works, and more specifically how to use **Mozaic-Vue**?<br/>
|
|
33
|
+
You need a personalized support to install or configure your project?
|
|
34
|
+
|
|
35
|
+
The **Mozaic Design System team** is at your disposal for that.
|
|
36
|
+
|
|
37
|
+
Do not hesitate to book a slot for **an onboarding session**, by going to this url:
|
|
38
|
+
|
|
39
|
+
<Button
|
|
40
|
+
appearance="secondary"
|
|
41
|
+
isLink
|
|
42
|
+
href="https://calendar.app.google/Tk9JkMdKTzM2DeX36"
|
|
43
|
+
target="_blank"
|
|
44
|
+
>{`I book an Onboarding Session`}</Button>
|
package/src/types/BarData.ts
CHANGED