@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
|
@@ -1,101 +1,108 @@
|
|
|
1
|
-
export default function PatternZigzag(
|
|
1
|
+
export default function PatternZigzag(
|
|
2
|
+
hover: boolean,
|
|
3
|
+
color: string = '#00A3B2',
|
|
4
|
+
disableAccessibility: boolean = false
|
|
5
|
+
): CanvasPattern {
|
|
2
6
|
const canvasPattern: HTMLCanvasElement = document.createElement('canvas');
|
|
3
7
|
const ctx: CanvasRenderingContext2D | null = canvasPattern.getContext('2d');
|
|
4
8
|
if (!ctx) {
|
|
5
|
-
return new CanvasPattern;
|
|
9
|
+
return new CanvasPattern();
|
|
6
10
|
}
|
|
7
|
-
|
|
11
|
+
|
|
8
12
|
const patternSize = 50;
|
|
9
|
-
|
|
13
|
+
|
|
10
14
|
canvasPattern.width = patternSize;
|
|
11
15
|
canvasPattern.height = patternSize;
|
|
12
16
|
|
|
13
17
|
if (disableAccessibility === true) {
|
|
14
18
|
ctx.beginPath();
|
|
15
19
|
ctx.fillStyle = color;
|
|
16
|
-
ctx.rect(0.
|
|
20
|
+
ctx.rect(0.0, 0.0, patternSize, patternSize);
|
|
17
21
|
ctx.fill();
|
|
18
22
|
} else {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
// #path4
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
// #path6
|
|
44
|
-
ctx.beginPath();
|
|
45
|
-
ctx.globalAlpha = 0.3;
|
|
46
|
-
ctx.strokeStyle = color;
|
|
47
|
-
ctx.lineWidth = 0.08 * patternSize;
|
|
48
|
-
ctx.moveTo(- patternSize / 2, patternSize);
|
|
49
|
-
ctx.lineTo(0.000000, patternSize / 2);
|
|
50
|
-
ctx.lineTo(patternSize / 2, patternSize);
|
|
51
|
-
ctx.lineTo(patternSize, patternSize / 2);
|
|
52
|
-
ctx.lineTo(patternSize + (patternSize / 2), patternSize);
|
|
53
|
-
ctx.stroke();
|
|
54
|
-
|
|
55
|
-
// #path6-6
|
|
56
|
-
ctx.beginPath();
|
|
57
|
-
ctx.globalAlpha = 0.3;
|
|
58
|
-
ctx.strokeStyle = color;
|
|
59
|
-
ctx.lineWidth = 0.08 * patternSize;
|
|
60
|
-
ctx.moveTo(- patternSize / 2, 0.000111);
|
|
61
|
-
ctx.lineTo(0.000004 * patternSize, - patternSize / 2);
|
|
62
|
-
ctx.lineTo(patternSize / 2, 0.000111);
|
|
63
|
-
ctx.lineTo(patternSize, - patternSize / 2);
|
|
64
|
-
ctx.lineTo(patternSize + (patternSize / 2), 0.000111);
|
|
65
|
-
ctx.stroke();
|
|
66
|
-
|
|
67
|
-
// #path6-5
|
|
68
|
-
ctx.beginPath();
|
|
69
|
-
ctx.globalAlpha = 0.7;
|
|
70
|
-
ctx.strokeStyle = color;
|
|
71
|
-
ctx.lineWidth = 0.08 * patternSize;
|
|
72
|
-
ctx.moveTo(- patternSize / 2, patternSize + (patternSize / 2));
|
|
73
|
-
ctx.lineTo(0.000000, patternSize);
|
|
74
|
-
ctx.lineTo(patternSize / 2, patternSize + (patternSize / 2));
|
|
75
|
-
ctx.lineTo(patternSize, patternSize);
|
|
76
|
-
ctx.lineTo(patternSize + (patternSize / 2), patternSize + (patternSize / 2));
|
|
77
|
-
ctx.stroke();
|
|
78
|
-
}
|
|
23
|
+
// background
|
|
24
|
+
ctx.beginPath();
|
|
25
|
+
ctx.fillStyle = '#FFFFFF';
|
|
26
|
+
ctx.lineWidth = 0.005 * patternSize;
|
|
27
|
+
ctx.rect(0.0, 0.0, patternSize, patternSize);
|
|
28
|
+
ctx.fill();
|
|
29
|
+
ctx.beginPath();
|
|
30
|
+
ctx.globalAlpha = 0.1;
|
|
31
|
+
ctx.fillStyle = color;
|
|
32
|
+
ctx.lineWidth = 0.005 * patternSize;
|
|
33
|
+
ctx.rect(0.0, 0.0, patternSize, patternSize);
|
|
34
|
+
ctx.fill();
|
|
35
|
+
|
|
36
|
+
// #path4
|
|
37
|
+
ctx.beginPath();
|
|
38
|
+
ctx.globalAlpha = 0.7;
|
|
39
|
+
ctx.strokeStyle = color;
|
|
40
|
+
ctx.lineWidth = 0.08 * patternSize;
|
|
41
|
+
ctx.moveTo(-patternSize / 2, patternSize / 2);
|
|
42
|
+
ctx.lineTo(0.0, 0.0);
|
|
43
|
+
ctx.lineTo(patternSize / 2, patternSize / 2);
|
|
44
|
+
ctx.lineTo(patternSize, 0.0);
|
|
45
|
+
ctx.stroke();
|
|
79
46
|
|
|
80
|
-
//
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
47
|
+
// #path6
|
|
48
|
+
ctx.beginPath();
|
|
49
|
+
ctx.globalAlpha = 0.3;
|
|
50
|
+
ctx.strokeStyle = color;
|
|
51
|
+
ctx.lineWidth = 0.08 * patternSize;
|
|
52
|
+
ctx.moveTo(-patternSize / 2, patternSize);
|
|
53
|
+
ctx.lineTo(0.0, patternSize / 2);
|
|
54
|
+
ctx.lineTo(patternSize / 2, patternSize);
|
|
55
|
+
ctx.lineTo(patternSize, patternSize / 2);
|
|
56
|
+
ctx.lineTo(patternSize + patternSize / 2, patternSize);
|
|
57
|
+
ctx.stroke();
|
|
89
58
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
59
|
+
// #path6-6
|
|
60
|
+
ctx.beginPath();
|
|
61
|
+
ctx.globalAlpha = 0.3;
|
|
62
|
+
ctx.strokeStyle = color;
|
|
63
|
+
ctx.lineWidth = 0.08 * patternSize;
|
|
64
|
+
ctx.moveTo(-patternSize / 2, 0.000111);
|
|
65
|
+
ctx.lineTo(0.000004 * patternSize, -patternSize / 2);
|
|
66
|
+
ctx.lineTo(patternSize / 2, 0.000111);
|
|
67
|
+
ctx.lineTo(patternSize, -patternSize / 2);
|
|
68
|
+
ctx.lineTo(patternSize + patternSize / 2, 0.000111);
|
|
69
|
+
ctx.stroke();
|
|
99
70
|
|
|
100
|
-
|
|
101
|
-
|
|
71
|
+
// #path6-5
|
|
72
|
+
ctx.beginPath();
|
|
73
|
+
ctx.globalAlpha = 0.7;
|
|
74
|
+
ctx.strokeStyle = color;
|
|
75
|
+
ctx.lineWidth = 0.08 * patternSize;
|
|
76
|
+
ctx.moveTo(-patternSize / 2, patternSize + patternSize / 2);
|
|
77
|
+
ctx.lineTo(0.0, patternSize);
|
|
78
|
+
ctx.lineTo(patternSize / 2, patternSize + patternSize / 2);
|
|
79
|
+
ctx.lineTo(patternSize, patternSize);
|
|
80
|
+
ctx.lineTo(patternSize + patternSize / 2, patternSize + patternSize / 2);
|
|
81
|
+
ctx.stroke();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Hover Style
|
|
85
|
+
if (hover) {
|
|
86
|
+
ctx.beginPath();
|
|
87
|
+
ctx.globalAlpha = 0.5;
|
|
88
|
+
ctx.fillStyle = '#FFFFFF';
|
|
89
|
+
ctx.lineWidth = 0.006 * patternSize;
|
|
90
|
+
ctx.rect(0.0, 0.0, patternSize, patternSize);
|
|
91
|
+
ctx.fill();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const canvas: HTMLCanvasElement = document.createElement('canvas');
|
|
95
|
+
const context: CanvasRenderingContext2D | null = canvas.getContext('2d');
|
|
96
|
+
if (!context) {
|
|
97
|
+
return new CanvasPattern();
|
|
98
|
+
}
|
|
99
|
+
const pattern: CanvasPattern | null = context.createPattern(
|
|
100
|
+
canvasPattern,
|
|
101
|
+
'repeat'
|
|
102
|
+
);
|
|
103
|
+
if (!pattern) {
|
|
104
|
+
return new CanvasPattern();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return pattern;
|
|
108
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Meta } from
|
|
2
|
-
import { Badge, OutlineCTA, Link } from
|
|
3
|
-
import pkg from
|
|
1
|
+
import { Meta } from '@storybook/blocks';
|
|
2
|
+
import { Badge, OutlineCTA, Link } from '@storybook/design-system';
|
|
3
|
+
import pkg from '../../package.json';
|
|
4
4
|
|
|
5
5
|
<Meta title="Getting Started" />
|
|
6
6
|
|
|
@@ -61,8 +61,8 @@ In your entry point file, insert the following code:
|
|
|
61
61
|
```javascript
|
|
62
62
|
// In the entry point file of your application - usually src/main.js
|
|
63
63
|
|
|
64
|
-
import MozaicChart from
|
|
65
|
-
import
|
|
64
|
+
import MozaicChart from '@mozaic-ds/chart';
|
|
65
|
+
import '@mozaic-ds/chart/dist/style.css';
|
|
66
66
|
|
|
67
67
|
Vue.use(MozaicChart);
|
|
68
68
|
```
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Meta } from
|
|
2
|
-
import { Button } from
|
|
1
|
+
import { Meta } from '@storybook/blocks';
|
|
2
|
+
import { Button } from '@storybook/design-system';
|
|
3
3
|
|
|
4
4
|
<Meta
|
|
5
5
|
title="Support & Onboarding"
|
|
6
6
|
parameters={{
|
|
7
|
-
layout:
|
|
8
|
-
viewMode:
|
|
7
|
+
layout: 'fullscreen',
|
|
8
|
+
viewMode: 'docs',
|
|
9
9
|
previewTabs: {
|
|
10
|
-
canvas: { hidden: true }
|
|
11
|
-
}
|
|
10
|
+
canvas: { hidden: true }
|
|
11
|
+
}
|
|
12
12
|
}}
|
|
13
13
|
/>
|
|
14
14
|
|
package/src/types/Chart.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { Plugin } from 'chart.js';
|
|
2
|
+
|
|
1
3
|
export interface ChartData {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
data: any;
|
|
5
|
+
loading: boolean;
|
|
6
|
+
error: boolean;
|
|
5
7
|
}
|
|
6
8
|
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
export type HTMLLegendPlugin = Plugin<
|
|
10
|
+
'bar' | 'doughnut' | 'line',
|
|
11
|
+
Record<string, any>
|
|
12
|
+
>;
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
+
import { ChartData, Plugin } from 'chart.js';
|
|
2
|
+
|
|
3
|
+
type AnyObject = Record<string, any>;
|
|
4
|
+
|
|
1
5
|
export interface DoughnutData {
|
|
2
6
|
tooltipLabel?: number;
|
|
3
7
|
value: number;
|
|
4
8
|
unit: string;
|
|
5
9
|
rate: number;
|
|
6
10
|
}
|
|
11
|
+
|
|
12
|
+
export type DoughnutPlugin = Plugin<'doughnut', AnyObject>;
|
|
13
|
+
|
|
14
|
+
export type DoughnutChartData = ChartData<'doughnut', number[]>;
|
package/src/types/GenericData.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export interface GenericData {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
value: number;
|
|
3
|
+
position?: number;
|
|
4
|
+
unit?: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
rate?: number;
|
|
7
|
+
color?: string;
|
|
8
|
+
trendValue?: number;
|
|
9
|
+
trendMetricUnit?: string;
|
|
10
|
+
tooltips?: [];
|
|
11
|
+
}
|
package/src/types/LineChart.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface LineData {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
2
|
+
label: string;
|
|
3
|
+
data: number[];
|
|
4
|
+
unit?: string;
|
|
5
|
+
}
|
package/src/types/RadarData.ts
CHANGED
|
@@ -1,36 +1,40 @@
|
|
|
1
1
|
export interface AreaData {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
value: number;
|
|
3
|
+
position: number;
|
|
4
|
+
unit: string;
|
|
5
|
+
label: string | null;
|
|
6
|
+
rate: number | null;
|
|
7
|
+
color: string | null;
|
|
8
|
+
trendValue: number | null;
|
|
9
|
+
trendUnit: string | null;
|
|
10
|
+
tooltips: string | null;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export interface Area {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
label: string;
|
|
15
|
+
areaData: AreaData[];
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export interface RadarPropsData {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
19
|
+
radarData: {
|
|
20
|
+
labels: string[];
|
|
21
|
+
areas: [
|
|
22
|
+
{
|
|
23
|
+
label: string;
|
|
24
|
+
areaData: [
|
|
25
|
+
{
|
|
26
|
+
value: number;
|
|
27
|
+
position: number;
|
|
28
|
+
unit: string;
|
|
29
|
+
label?: string;
|
|
30
|
+
rate?: null;
|
|
31
|
+
color: string;
|
|
32
|
+
trendValue?: number;
|
|
33
|
+
trendUnit?: string;
|
|
34
|
+
tooltips?: string[];
|
|
35
|
+
}
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
];
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export enum TooltipChartType {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
RADAR = 'RADAR',
|
|
3
|
+
BAR_CHART = 'BAR_CHART',
|
|
4
|
+
MIXED_BAR_LINE_CHART = 'MIXED_BAR_LINE_CHART',
|
|
5
|
+
DETAILS_BAR_CHART = 'DETAILS_BAR_CHART',
|
|
6
|
+
LINE_CHART = 'LINE_CHART',
|
|
7
|
+
DOUGHNUT = 'DOUGHNUT'
|
|
8
|
+
}
|
package/src/vite-env.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="vite/client" />
|
|
2
2
|
|
|
3
3
|
declare module '*.vue' {
|
|
4
|
-
import type { DefineComponent } from 'vue'
|
|
5
|
-
const component: DefineComponent<{}, {}, any
|
|
6
|
-
export default component
|
|
4
|
+
import type { DefineComponent } from 'vue';
|
|
5
|
+
const component: DefineComponent<{}, {}, any>;
|
|
6
|
+
export default component;
|
|
7
7
|
}
|