@bridge-ui/vue 0.17.2 → 0.18.0
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/ai/skills/bridge-ui-components/SKILL.md +33 -33
- package/dist/Components/CalendarMonth/composables/useCalendarMonth.d.ts +1 -1
- package/dist/Components/CalendarRange/composables/useCalendarRange.js +1 -1
- package/dist/Components/ChartAxis/ChartAxis.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/Components/ChartAxis/chartAxis.types.d.ts +17 -7
- package/dist/Components/ChartAxis/composables/useChartAxis.d.ts +2 -2
- package/dist/Components/ChartAxis/composables/useChartAxis.js +15 -10
- package/dist/Components/ChartBar/ChartBar.js +5 -0
- package/dist/Components/ChartBar/ChartBar.vue.d.ts +16 -0
- package/dist/Components/ChartBar/ChartBar.vue_vue_type_script_setup_true_lang.js +59 -0
- package/dist/Components/ChartBar/chartBar.types.d.ts +56 -0
- package/dist/Components/ChartBar/composables/useChartBar.d.ts +26 -0
- package/dist/Components/ChartBar/composables/useChartBar.js +13 -0
- package/dist/Components/ChartBar/index.d.ts +4 -0
- package/dist/Components/ChartBar/index.js +4 -0
- package/dist/Components/ChartBarSeries/ChartBarSeries.js +5 -0
- package/dist/Components/ChartBarSeries/ChartBarSeries.vue.d.ts +6 -0
- package/dist/Components/ChartBarSeries/ChartBarSeries.vue_vue_type_script_setup_true_lang.js +25 -0
- package/dist/Components/ChartBarSeries/chartBarSeries.types.d.ts +45 -0
- package/dist/Components/ChartBarSeries/composables/useChartBarSeries.d.ts +5 -0
- package/dist/Components/ChartBarSeries/composables/useChartBarSeries.js +20 -0
- package/dist/Components/ChartBarSeries/index.d.ts +3 -0
- package/dist/Components/ChartBarSeries/index.js +3 -0
- package/dist/Components/ChartFunnel/ChartFunnel.js +5 -0
- package/dist/Components/ChartFunnel/ChartFunnel.vue.d.ts +16 -0
- package/dist/Components/ChartFunnel/ChartFunnel.vue_vue_type_script_setup_true_lang.js +59 -0
- package/dist/Components/ChartFunnel/chartFunnel.types.d.ts +54 -0
- package/dist/Components/ChartFunnel/composables/useChartFunnel.d.ts +29 -0
- package/dist/Components/ChartFunnel/composables/useChartFunnel.js +68 -0
- package/dist/Components/ChartFunnel/index.d.ts +4 -0
- package/dist/Components/ChartFunnel/index.js +4 -0
- package/dist/Components/ChartLegend/ChartLegend.vue.d.ts +2 -0
- package/dist/Components/ChartLegend/ChartLegend.vue_vue_type_script_setup_true_lang.js +33 -13
- package/dist/Components/ChartLegend/chartLegend.types.d.ts +41 -5
- package/dist/Components/ChartLegend/composables/useChartLegend.d.ts +9 -5
- package/dist/Components/ChartLegend/composables/useChartLegend.js +88 -54
- package/dist/Components/ChartLine/ChartLine.js +5 -0
- package/dist/Components/ChartLine/ChartLine.vue.d.ts +20 -0
- package/dist/Components/ChartLine/ChartLine.vue_vue_type_script_setup_true_lang.js +76 -0
- package/dist/Components/ChartLine/chartLine.types.d.ts +72 -0
- package/dist/Components/ChartLine/composables/useChartLine.d.ts +26 -0
- package/dist/Components/ChartLine/composables/useChartLine.js +13 -0
- package/dist/Components/ChartLine/index.d.ts +4 -0
- package/dist/Components/ChartLine/index.js +4 -0
- package/dist/Components/ChartLineSeries/ChartLineSeries.js +5 -0
- package/dist/Components/ChartLineSeries/ChartLineSeries.vue.d.ts +10 -0
- package/dist/Components/ChartLineSeries/ChartLineSeries.vue_vue_type_script_setup_true_lang.js +42 -0
- package/dist/Components/ChartLineSeries/chartLineSeries.types.d.ts +75 -0
- package/dist/Components/ChartLineSeries/composables/useChartLineSeries.d.ts +5 -0
- package/dist/Components/ChartLineSeries/composables/useChartLineSeries.js +25 -0
- package/dist/Components/ChartLineSeries/index.d.ts +3 -0
- package/dist/Components/ChartLineSeries/index.js +3 -0
- package/dist/Components/ChartPie/ChartPie.js +5 -0
- package/dist/Components/ChartPie/ChartPie.vue.d.ts +15 -0
- package/dist/Components/ChartPie/ChartPie.vue_vue_type_script_setup_true_lang.js +73 -0
- package/dist/Components/ChartPie/chartPie.types.d.ts +73 -0
- package/dist/Components/ChartPie/composables/useChartPie.d.ts +30 -0
- package/dist/Components/ChartPie/composables/useChartPie.js +71 -0
- package/dist/Components/ChartPie/index.d.ts +4 -0
- package/dist/Components/ChartPie/index.js +4 -0
- package/dist/Components/ChartScatter/ChartScatter.js +5 -0
- package/dist/Components/{Chart/Chart.vue.d.ts → ChartScatter/ChartScatter.vue.d.ts} +3 -2
- package/dist/Components/ChartScatter/ChartScatter.vue_vue_type_script_setup_true_lang.js +49 -0
- package/dist/Components/ChartScatter/chartScatter.types.d.ts +23 -0
- package/dist/Components/ChartScatter/composables/useChartScatter.d.ts +29 -0
- package/dist/Components/ChartScatter/composables/useChartScatter.js +103 -0
- package/dist/Components/ChartScatter/index.d.ts +4 -0
- package/dist/Components/ChartScatter/index.js +4 -0
- package/dist/Components/ChartScatterSeries/ChartScatterSeries.js +5 -0
- package/dist/Components/ChartScatterSeries/ChartScatterSeries.vue.d.ts +4 -0
- package/dist/Components/ChartScatterSeries/ChartScatterSeries.vue_vue_type_script_setup_true_lang.js +21 -0
- package/dist/Components/ChartScatterSeries/chartScatterSeries.types.d.ts +38 -0
- package/dist/Components/ChartScatterSeries/composables/useChartScatterSeries.d.ts +4 -0
- package/dist/Components/ChartScatterSeries/composables/useChartScatterSeries.js +18 -0
- package/dist/Components/ChartScatterSeries/index.d.ts +3 -0
- package/dist/Components/ChartScatterSeries/index.js +3 -0
- package/dist/Components/ChartTooltip/ChartTooltip.vue_vue_type_script_setup_true_lang.js +18 -10
- package/dist/Components/ChartTooltip/chartTooltip.types.d.ts +24 -9
- package/dist/Components/ChartTooltip/composables/useChartTooltip.d.ts +3 -1
- package/dist/Components/ChartTooltip/composables/useChartTooltip.js +79 -65
- package/dist/Components/ColorPicker/composables/useColorPicker.js +1 -1
- package/dist/Components/DatePicker/composables/useDatePicker.js +1 -1
- package/dist/Components/DateRangePicker/composables/useDateRangePicker.js +1 -1
- package/dist/Components/DateTimePicker/composables/useDateTimePicker.js +1 -1
- package/dist/Components/DateTimeRangePicker/composables/useDateTimeRangePicker.js +1 -1
- package/dist/Components/FormField/composables/useFormField.js +3 -1
- package/dist/Components/OtpField/composables/useOtpField.js +90 -89
- package/dist/Components/ResizablePanel/composables/useResizablePanel.d.ts +1 -1
- package/dist/Components/Spinner/composables/useSpinner.d.ts +1 -1
- package/dist/Components/TimePicker/composables/useTimePicker.js +1 -1
- package/dist/Components/TimeRangePicker/composables/useTimeRangePicker.js +1 -1
- package/dist/Utils/Charts/ChartFrame.js +5 -0
- package/dist/Utils/Charts/ChartFrame.vue.d.ts +24 -0
- package/dist/Utils/Charts/ChartFrame.vue_vue_type_script_setup_true_lang.js +41 -0
- package/dist/{Components/Chart → Utils/Charts}/chart.types.d.ts +16 -18
- package/dist/Utils/Charts/chartInjectionKey.d.ts +151 -0
- package/dist/{Components/Chart → Utils/Charts}/chartInjectionKey.js +2 -2
- package/dist/Utils/Charts/echarts/bar.d.ts +6 -0
- package/dist/Utils/Charts/echarts/bar.js +22 -0
- package/dist/Utils/Charts/echarts/cartesian.d.ts +15 -0
- package/dist/Utils/Charts/echarts/cartesian.js +255 -0
- package/dist/Utils/Charts/echarts/funnel.d.ts +15 -0
- package/dist/Utils/Charts/echarts/funnel.js +79 -0
- package/dist/Utils/Charts/echarts/line.d.ts +5 -0
- package/dist/Utils/Charts/echarts/line.js +19 -0
- package/dist/Utils/Charts/echarts/part.d.ts +19 -0
- package/dist/Utils/Charts/echarts/part.js +45 -0
- package/dist/Utils/Charts/echarts/pie.d.ts +14 -0
- package/dist/Utils/Charts/echarts/pie.js +75 -0
- package/dist/Utils/Charts/echarts/plot.d.ts +44 -0
- package/dist/Utils/Charts/echarts/plot.js +52 -0
- package/dist/Utils/Charts/echarts/scatter.d.ts +14 -0
- package/dist/Utils/Charts/echarts/scatter.js +152 -0
- package/dist/Utils/Charts/index.d.ts +6 -0
- package/dist/Utils/Charts/index.js +6 -0
- package/dist/Utils/Charts/useChartCartesian.d.ts +57 -0
- package/dist/Utils/Charts/useChartCartesian.js +155 -0
- package/dist/Utils/Charts/useChartPart.d.ts +45 -0
- package/dist/Utils/Charts/useChartPart.js +97 -0
- package/dist/Utils/Charts/useChartRegistry.d.ts +13 -0
- package/dist/Utils/Charts/useChartRegistry.js +40 -0
- package/dist/Utils/Charts/useChartRoot.d.ts +156 -0
- package/dist/Utils/Charts/useChartRoot.js +342 -0
- package/dist/Utils/Charts/useChartSeries.d.ts +10 -0
- package/dist/Utils/Charts/useChartSeries.js +22 -0
- package/dist/augments.d.ts +23 -7
- package/docs/README.md +6 -1
- package/docs/components/Chart.md +114 -154
- package/docs/components/ChartBar.md +137 -0
- package/docs/components/ChartFunnel.md +62 -0
- package/docs/components/ChartLine.md +151 -0
- package/docs/components/ChartPie.md +115 -0
- package/docs/components/ChartScatter.md +84 -0
- package/package.json +2 -2
- package/dist/Components/Chart/Chart.js +0 -5
- package/dist/Components/Chart/Chart.vue_vue_type_script_setup_true_lang.js +0 -52
- package/dist/Components/Chart/chartInjectionKey.d.ts +0 -94
- package/dist/Components/Chart/composables/useChart.d.ts +0 -40
- package/dist/Components/Chart/composables/useChart.js +0 -346
- package/dist/Components/Chart/echartsChart.d.ts +0 -14
- package/dist/Components/Chart/echartsChart.js +0 -199
- package/dist/Components/Chart/index.d.ts +0 -4
- package/dist/Components/Chart/index.js +0 -4
- package/dist/Components/ChartSeries/ChartSeries.js +0 -5
- package/dist/Components/ChartSeries/ChartSeries.vue.d.ts +0 -4
- package/dist/Components/ChartSeries/ChartSeries.vue_vue_type_script_setup_true_lang.js +0 -24
- package/dist/Components/ChartSeries/chartSeries.types.d.ts +0 -37
- package/dist/Components/ChartSeries/composables/useChartSeries.d.ts +0 -10
- package/dist/Components/ChartSeries/composables/useChartSeries.js +0 -29
- package/dist/Components/ChartSeries/index.d.ts +0 -3
- package/dist/Components/ChartSeries/index.js +0 -3
package/docs/components/Chart.md
CHANGED
|
@@ -1,174 +1,149 @@
|
|
|
1
1
|
# Chart
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Charts for dashboards and reports. Pick the root for the shape of your data; every root shares the same legend, tooltip, tokens, dark mode, and a11y (summary, keyboard navigation, data table). The plot engine is ECharts.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
| Root | Use for | Data |
|
|
6
|
+
| ----------------------------------- | -------------------------------------------------------------- | ----------------------------------------- |
|
|
7
|
+
| [`ChartLine`](./ChartLine.md) | Trends, areas, stacked areas, steps, sparklines | `ChartLineSeries`, one value per category |
|
|
8
|
+
| [`ChartBar`](./ChartBar.md) | Comparisons, rankings (horizontal), stacked totals, bar + line | `ChartBarSeries` (+ `ChartLineSeries`) |
|
|
9
|
+
| [`ChartScatter`](./ChartScatter.md) | Correlation between two numbers, bubbles | `ChartScatterSeries`, `[x, y]` points |
|
|
10
|
+
| [`ChartPie`](./ChartPie.md) | Share of a whole (pie, donut) | `data` on the root |
|
|
11
|
+
| [`ChartFunnel`](./ChartFunnel.md) | Conversion through ordered stages | `data` on the root |
|
|
12
|
+
|
|
13
|
+
Shared parts:
|
|
14
|
+
|
|
15
|
+
| Part | Line | Bar | Scatter | Pie | Funnel |
|
|
16
|
+
| -------------- | :--: | :-: | :-----: | :-: | :----: |
|
|
17
|
+
| `ChartLegend` | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
18
|
+
| `ChartTooltip` | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
19
|
+
| `ChartAxis` | ✅ | ✅ | ✅ | — | — |
|
|
6
20
|
|
|
7
21
|
## Import
|
|
8
22
|
|
|
9
23
|
```ts
|
|
10
|
-
import { Chart } from "@bridge-ui/vue/Components/Chart";
|
|
11
24
|
import { ChartAxis } from "@bridge-ui/vue/Components/ChartAxis";
|
|
12
25
|
import { ChartLegend } from "@bridge-ui/vue/Components/ChartLegend";
|
|
13
|
-
import { ChartSeries } from "@bridge-ui/vue/Components/ChartSeries";
|
|
14
26
|
import { ChartTooltip } from "@bridge-ui/vue/Components/ChartTooltip";
|
|
15
27
|
```
|
|
16
28
|
|
|
17
|
-
Install `echarts` next to `@bridge-ui/vue` when you use
|
|
29
|
+
Install `echarts` next to `@bridge-ui/vue` when you use a chart. Each root imports only its own series (line, bar, scatter, pie, or funnel) and the SVG renderer. Charts stay off the `@bridge-ui/vue` root so apps that never chart do not load `echarts`.
|
|
18
30
|
|
|
19
31
|
## Examples
|
|
20
32
|
|
|
21
|
-
###
|
|
33
|
+
### Axes
|
|
34
|
+
|
|
35
|
+
`position="x"` is the horizontal axis and `position="y"` the vertical one. On a horizontal `ChartBar` the categories sit on `y` and the values on `x`.
|
|
22
36
|
|
|
23
37
|
```vue
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
</Chart>
|
|
34
|
-
</template>
|
|
38
|
+
<ChartLine :categories="months">
|
|
39
|
+
<ChartLineSeries name="Revenue" :data="revenue" />
|
|
40
|
+
<ChartAxis
|
|
41
|
+
position="x"
|
|
42
|
+
label="Month"
|
|
43
|
+
:format-category="(month) => month.toUpperCase()"
|
|
44
|
+
/>
|
|
45
|
+
<ChartAxis :min="0" position="y" :format-tick="(value) => `$${value}`" />
|
|
46
|
+
</ChartLine>
|
|
35
47
|
```
|
|
36
48
|
|
|
37
|
-
|
|
49
|
+
`format-category` formats category labels (`string`). `format-tick` formats numbers: the value on a value axis, or the timestamp (ms) on a time axis. Grid lines are on for the value axis and off for the category axis by default.
|
|
38
50
|
|
|
39
|
-
|
|
40
|
-
<Chart :height="320" :categories="months">
|
|
41
|
-
<ChartSeries type="bar" name="Online" :data="online" />
|
|
42
|
-
<ChartSeries type="bar" name="Retail" :data="retail" />
|
|
43
|
-
<ChartLegend align="start" position="top" />
|
|
44
|
-
<ChartTooltip />
|
|
45
|
-
</Chart>
|
|
46
|
-
```
|
|
51
|
+
### Legend
|
|
47
52
|
|
|
48
|
-
|
|
53
|
+
Legend entries are toggle buttons: click to hide or show a series or slice, hover or focus to emphasize it.
|
|
49
54
|
|
|
50
55
|
```vue
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
<ChartTooltip />
|
|
54
|
-
</Chart>
|
|
56
|
+
<ChartLegend :interactive="false" />
|
|
57
|
+
<ChartLegend align="end" position="top" />
|
|
55
58
|
```
|
|
56
59
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
Bars and lines share the value axis.
|
|
60
|
+
`left` and `right` stack the entries beside the plot. With slices (pie, funnel), `show-value` and `show-percent` add value and share columns.
|
|
60
61
|
|
|
61
62
|
```vue
|
|
62
|
-
<
|
|
63
|
-
<
|
|
64
|
-
|
|
65
|
-
<ChartLegend />
|
|
66
|
-
<ChartTooltip />
|
|
67
|
-
</Chart>
|
|
63
|
+
<ChartPie :data="tags" variant="donut">
|
|
64
|
+
<ChartLegend show-percent position="right" />
|
|
65
|
+
</ChartPie>
|
|
68
66
|
```
|
|
69
67
|
|
|
70
|
-
###
|
|
71
|
-
|
|
72
|
-
`null` values leave a gap in lines and areas and are skipped in the tooltip.
|
|
68
|
+
### Tooltip
|
|
73
69
|
|
|
74
70
|
```vue
|
|
75
|
-
<
|
|
71
|
+
<ChartTooltip :format-value="(value) => currency.format(value)" />
|
|
76
72
|
```
|
|
77
73
|
|
|
78
|
-
### Axes
|
|
79
|
-
|
|
80
74
|
```vue
|
|
81
|
-
<
|
|
82
|
-
<
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
</
|
|
75
|
+
<ChartTooltip>
|
|
76
|
+
<template #content="{ title, items }">
|
|
77
|
+
<span>{{ title }}: {{ items.length }} series</span>
|
|
78
|
+
</template>
|
|
79
|
+
</ChartTooltip>
|
|
86
80
|
```
|
|
87
81
|
|
|
88
|
-
|
|
82
|
+
The tooltip title is the category (line, bar) or the series name (scatter). Slices show one row with the value and the share; format the share with `format-percent`.
|
|
89
83
|
|
|
90
84
|
### Colors
|
|
91
85
|
|
|
92
|
-
Series take palette colors in order. Override the palette on
|
|
86
|
+
Series and slices take palette colors in order. Override the palette on the root, or pass a token key or any CSS color.
|
|
93
87
|
|
|
94
88
|
```vue
|
|
95
|
-
<
|
|
96
|
-
<
|
|
97
|
-
<
|
|
98
|
-
</
|
|
89
|
+
<ChartLine :categories="months" :palette="['info', 'warning']">
|
|
90
|
+
<ChartLineSeries name="Plan" :data="plan" />
|
|
91
|
+
<ChartLineSeries name="Actual" :data="actual" color="#8b5cf6" />
|
|
92
|
+
</ChartLine>
|
|
99
93
|
```
|
|
100
94
|
|
|
101
95
|
Token keys (`primary`, `info`, `success`, `warning`, `error`, `secondary`, `dark`, `black`) follow light and dark mode automatically.
|
|
102
96
|
|
|
103
|
-
### Legend
|
|
104
|
-
|
|
105
|
-
Legend entries are toggle buttons: click to hide or show a series, hover or focus to emphasize it.
|
|
106
|
-
|
|
107
|
-
```vue
|
|
108
|
-
<ChartLegend :interactive="false" />
|
|
109
|
-
<ChartLegend align="end" position="top" />
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
### Tooltip
|
|
113
|
-
|
|
114
|
-
```vue
|
|
115
|
-
<ChartTooltip :format-value="(value) => currency.format(value)" />
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
```vue
|
|
119
|
-
<ChartTooltip>
|
|
120
|
-
<template #content="{ category, items }">
|
|
121
|
-
<span>{{ category }}: {{ items.length }} series</span>
|
|
122
|
-
</template>
|
|
123
|
-
</ChartTooltip>
|
|
124
|
-
```
|
|
125
|
-
|
|
126
97
|
### Loading and empty
|
|
127
98
|
|
|
128
99
|
While `loading` is true, the plot stays visible behind a translucent overlay with a spinner, and the root gets `aria-busy`. Use the `loading` slot to replace the spinner.
|
|
129
100
|
|
|
130
101
|
```vue
|
|
131
|
-
<
|
|
132
|
-
<
|
|
133
|
-
</
|
|
102
|
+
<ChartBar :loading="isLoading" :categories="months">
|
|
103
|
+
<ChartBarSeries name="Orders" :data="orders" />
|
|
104
|
+
</ChartBar>
|
|
134
105
|
```
|
|
135
106
|
|
|
136
107
|
```vue
|
|
137
|
-
<
|
|
138
|
-
<template #empty>No
|
|
139
|
-
</
|
|
108
|
+
<ChartPie :data="[]">
|
|
109
|
+
<template #empty>No outflows this month</template>
|
|
110
|
+
</ChartPie>
|
|
140
111
|
```
|
|
141
112
|
|
|
142
113
|
### Summary
|
|
143
114
|
|
|
144
|
-
|
|
115
|
+
Each root generates a text summary for screen readers. Pass `summary` to describe the takeaway instead.
|
|
145
116
|
|
|
146
117
|
```vue
|
|
147
|
-
<
|
|
148
|
-
<
|
|
149
|
-
</
|
|
118
|
+
<ChartLine :categories="months" summary="Revenue doubled from January to June.">
|
|
119
|
+
<ChartLineSeries name="Revenue" :data="revenue" />
|
|
120
|
+
</ChartLine>
|
|
150
121
|
```
|
|
151
122
|
|
|
152
123
|
### Registry defaults
|
|
153
124
|
|
|
125
|
+
Each root has its own registry entry (`ChartLine`, `ChartBar`, `ChartScatter`, `ChartPie`, `ChartFunnel`).
|
|
126
|
+
|
|
154
127
|
```vue
|
|
155
128
|
<BridgeUIProvider
|
|
156
129
|
:components="{
|
|
157
|
-
ChartSeries: { defaultProps: { curve: 'smooth' } },
|
|
158
130
|
ChartLegend: { defaultProps: { position: 'top' } },
|
|
159
|
-
|
|
131
|
+
ChartLine: { defaultProps: { curve: 'smooth', height: 320 } },
|
|
132
|
+
ChartBar: { defaultProps: { palette: ['primary', 'success'] } },
|
|
160
133
|
}"
|
|
161
134
|
>
|
|
162
135
|
<App />
|
|
163
136
|
</BridgeUIProvider>
|
|
164
137
|
```
|
|
165
138
|
|
|
166
|
-
Theme tokens (`
|
|
139
|
+
Theme tokens (`tokens.theme`) set the grid, axis, and label colors as Tailwind text-color classes:
|
|
167
140
|
|
|
168
141
|
```vue
|
|
169
142
|
<BridgeUIProvider
|
|
170
143
|
:components="{
|
|
171
|
-
|
|
144
|
+
ChartLine: {
|
|
145
|
+
tokens: { theme: { grid: 'text-dark-100 dark:text-dark-800' } },
|
|
146
|
+
},
|
|
172
147
|
}"
|
|
173
148
|
>
|
|
174
149
|
<App />
|
|
@@ -178,77 +153,62 @@ Theme tokens (`Chart.tokens.theme`) set the grid, axis, and label colors as Tail
|
|
|
178
153
|
## Accessibility
|
|
179
154
|
|
|
180
155
|
- The root is a `figure`; the plot is a focusable `img` labelled by `summary` (or the generated summary).
|
|
181
|
-
- Arrow keys move between categories, `Home` / `End` jump to the edges, `Escape` clears. The tooltip follows the keyboard, and the values are announced through a live region.
|
|
156
|
+
- Arrow keys move between items (categories, points, slices, or stages), `Home` / `End` jump to the edges, `Escape` clears. The tooltip follows the keyboard, and the values are announced through a live region.
|
|
182
157
|
- A data table with every value is always rendered, visually hidden.
|
|
183
158
|
- The tooltip is decorative (`aria-hidden`); the same information is in the table and announcements.
|
|
184
159
|
- Engine animation is off under `prefers-reduced-motion`.
|
|
185
160
|
|
|
186
|
-
## Props (
|
|
187
|
-
|
|
188
|
-
| Prop
|
|
189
|
-
|
|
|
190
|
-
| `animation`
|
|
191
|
-
| `
|
|
192
|
-
| `
|
|
193
|
-
| `
|
|
194
|
-
| `
|
|
195
|
-
| `
|
|
196
|
-
| `
|
|
197
|
-
| `
|
|
198
|
-
| `
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
### Slots (`Chart`)
|
|
202
|
-
|
|
203
|
-
| Slot | Description |
|
|
204
|
-
| --------- | ---------------------------------------------------------- |
|
|
205
|
-
| `default` | `ChartSeries`, `ChartAxis`, `ChartLegend`, `ChartTooltip`. |
|
|
206
|
-
| `empty` | Content shown when there is nothing to plot. |
|
|
207
|
-
| `loading` | Content shown while `loading` is true. |
|
|
208
|
-
|
|
209
|
-
## Props (`ChartSeries`)
|
|
210
|
-
|
|
211
|
-
| Prop | Type | Default | Description |
|
|
212
|
-
| ------- | --------------------------- | ---------- | ---------------------------------------- |
|
|
213
|
-
| `color` | `ChartSeriesColor` | palette | Token key or CSS color. |
|
|
214
|
-
| `curve` | `"linear" \| "smooth"` | `"linear"` | Line interpolation for `line` / `area`. |
|
|
215
|
-
| `data` | `(number \| null)[]` | required | One value per category; `null` is a gap. |
|
|
216
|
-
| `name` | `string` | required | Legend, tooltip, and table label. |
|
|
217
|
-
| `type` | `"line" \| "bar" \| "area"` | `"line"` | Series family. |
|
|
161
|
+
## Props (every root)
|
|
162
|
+
|
|
163
|
+
| Prop | Type | Default | Description |
|
|
164
|
+
| -------------- | ------------------- | ------------------------ | ------------------------------------------------------ |
|
|
165
|
+
| `animation` | `boolean` | `true` | Engine transitions (always off for reduced motion). |
|
|
166
|
+
| `classes` | `ChartClasses` | — | `root`, `plot`, `center`, `loading`, `empty`, `table`. |
|
|
167
|
+
| `height` | `number \| string` | `280` | Plot height. |
|
|
168
|
+
| `loading` | `boolean` | `false` | Shows the spinner overlay. |
|
|
169
|
+
| `palette` | `ChartColorValue[]` | primary, info, success … | Colors in order. |
|
|
170
|
+
| `size` | `ChartSize` | `"md"` | Density of labels, legend, and tooltip. |
|
|
171
|
+
| `summary` | `string` | generated | Accessible description of the plot. |
|
|
172
|
+
| `width` | `number \| string` | `"100%"` | Root width. |
|
|
173
|
+
| `custom-props` | `ChartCustomProps` | — | Extra props for `root` and `plot`. |
|
|
174
|
+
|
|
175
|
+
Slots: `default` (series, `ChartAxis`, `ChartLegend`, `ChartTooltip`), `empty`, `loading`.
|
|
218
176
|
|
|
219
177
|
## Props (`ChartAxis`)
|
|
220
178
|
|
|
221
|
-
| Prop
|
|
222
|
-
|
|
|
223
|
-
| `
|
|
224
|
-
| `
|
|
225
|
-
| `
|
|
226
|
-
| `
|
|
227
|
-
| `
|
|
228
|
-
| `
|
|
229
|
-
| `
|
|
230
|
-
| `
|
|
179
|
+
| Prop | Type | Default | Description |
|
|
180
|
+
| ----------------- | ------------------------------ | --------------------------- | ----------------------------------- |
|
|
181
|
+
| `position` | `"x" \| "y"` | required | Horizontal (`x`) or vertical (`y`). |
|
|
182
|
+
| `label` | `string` | — | Axis title. |
|
|
183
|
+
| `grid` | `boolean` | value axis on, category off | Grid lines. |
|
|
184
|
+
| `hidden` | `boolean` | `false` | Hides the axis line and labels. |
|
|
185
|
+
| `min` | `number` | — | Lower bound (value or time axis). |
|
|
186
|
+
| `max` | `number` | — | Upper bound (value or time axis). |
|
|
187
|
+
| `tick-count` | `number` | — | Preferred number of ticks. |
|
|
188
|
+
| `format-tick` | `(value: number) => string` | — | Value or time (ms) tick formatter. |
|
|
189
|
+
| `format-category` | `(category: string) => string` | — | Category tick formatter. |
|
|
231
190
|
|
|
232
191
|
## Props (`ChartLegend`)
|
|
233
192
|
|
|
234
|
-
| Prop
|
|
235
|
-
|
|
|
236
|
-
| `align`
|
|
237
|
-
| `
|
|
238
|
-
| `interactive`
|
|
239
|
-
| `
|
|
240
|
-
| `
|
|
193
|
+
| Prop | Type | Default | Description |
|
|
194
|
+
| ---------------- | ---------------------------------------- | ---------- | ------------------------------------------------------ |
|
|
195
|
+
| `align` | `"start" \| "center" \| "end"` | `"center"` | Entry alignment. |
|
|
196
|
+
| `position` | `"top" \| "bottom" \| "left" \| "right"` | `"bottom"` | Where the legend sits. |
|
|
197
|
+
| `interactive` | `boolean` | `true` | Entries toggle and emphasize items. |
|
|
198
|
+
| `show-value` | `boolean` | `false` | Value column (pie, funnel). |
|
|
199
|
+
| `show-percent` | `boolean` | `false` | Share column (pie, funnel). |
|
|
200
|
+
| `format-value` | `(value: number) => string` | — | Value column formatter. |
|
|
201
|
+
| `format-percent` | `(percent: number) => string` | — | Share column formatter. |
|
|
202
|
+
| `classes` | `ChartLegendClasses` | — | `root`, `item`, `swatch`, `label`, `value`, `percent`. |
|
|
203
|
+
| `custom-props` | `ChartLegendCustomProps` | — | Extra props for `root` and `item`. |
|
|
241
204
|
|
|
242
205
|
## Props (`ChartTooltip`)
|
|
243
206
|
|
|
244
|
-
| Prop
|
|
245
|
-
|
|
|
246
|
-
| `
|
|
247
|
-
| `
|
|
248
|
-
| `
|
|
249
|
-
|
|
250
|
-
### Slots (`ChartTooltip`)
|
|
207
|
+
| Prop | Type | Default | Description |
|
|
208
|
+
| ---------------- | --------------------------- | ------- | --------------------------------------------------------------- |
|
|
209
|
+
| `format-value` | `(value, item) => string` | — | Value formatter. |
|
|
210
|
+
| `format-percent` | `(percent, item) => string` | — | Share formatter (pie, funnel). |
|
|
211
|
+
| `classes` | `ChartTooltipClasses` | — | `root`, `title`, `item`, `swatch`, `label`, `value`, `percent`. |
|
|
212
|
+
| `custom-props` | `ChartTooltipCustomProps` | — | Extra props for `root`. |
|
|
251
213
|
|
|
252
|
-
|
|
253
|
-
| --------- | ---------------------------- | ---------------------------- |
|
|
254
|
-
| `content` | `{ category, index, items }` | Replaces the title and rows. |
|
|
214
|
+
Slot: `content` (`{ index, title, color, items }`) replaces the title and rows.
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# ChartBar
|
|
2
|
+
|
|
3
|
+
Bar charts: comparisons, rankings, stacked totals, negative values, and time axes. Compose with `ChartBarSeries`, `ChartAxis`, `ChartLegend`, and `ChartTooltip`. Shared parts, colors, and a11y are in [Chart](./Chart.md).
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { ChartBar } from "@bridge-ui/vue/Components/ChartBar";
|
|
9
|
+
import { ChartBarSeries } from "@bridge-ui/vue/Components/ChartBarSeries";
|
|
10
|
+
import { ChartLineSeries } from "@bridge-ui/vue/Components/ChartLineSeries";
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Examples
|
|
14
|
+
|
|
15
|
+
### Usage
|
|
16
|
+
|
|
17
|
+
```vue
|
|
18
|
+
<ChartBar :height="320" :categories="months">
|
|
19
|
+
<ChartBarSeries name="Online" :data="online" />
|
|
20
|
+
<ChartBarSeries name="Retail" :data="retail" />
|
|
21
|
+
<ChartLegend align="start" position="top" />
|
|
22
|
+
<ChartTooltip />
|
|
23
|
+
</ChartBar>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Horizontal
|
|
27
|
+
|
|
28
|
+
`orientation="horizontal"` lists the categories top to bottom on the `y` axis. Value formatting moves to `x`.
|
|
29
|
+
|
|
30
|
+
```vue
|
|
31
|
+
<ChartBar :categories="tags" orientation="horizontal">
|
|
32
|
+
<ChartBarSeries :data="spent" name="October" />
|
|
33
|
+
<ChartAxis position="x" :format-tick="(value) => currency.format(value)" />
|
|
34
|
+
</ChartBar>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Stacked
|
|
38
|
+
|
|
39
|
+
Series with the same `stack` key stack. Only the outermost bar of each stack is rounded.
|
|
40
|
+
|
|
41
|
+
```vue
|
|
42
|
+
<ChartBar labels stack="total" :categories="months">
|
|
43
|
+
<ChartBarSeries name="Online" :data="online" />
|
|
44
|
+
<ChartBarSeries name="Retail" :data="retail" />
|
|
45
|
+
<ChartLegend />
|
|
46
|
+
</ChartBar>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Inside labels that do not fit their segment are hidden.
|
|
50
|
+
|
|
51
|
+
### Bar + line
|
|
52
|
+
|
|
53
|
+
`ChartLineSeries` inside `ChartBar` draws a line over the bars on the same value axis, with the points centered on each category. Line options (`dashed`, `show-points`, `curve`, `area`, `reference`) work as in `ChartLine`.
|
|
54
|
+
|
|
55
|
+
```vue
|
|
56
|
+
<ChartBar :categories="months">
|
|
57
|
+
<ChartBarSeries name="Orders" :data="orders" />
|
|
58
|
+
<ChartLineSeries dashed name="Returns" :data="returns" />
|
|
59
|
+
<ChartLegend />
|
|
60
|
+
<ChartTooltip />
|
|
61
|
+
</ChartBar>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The `ChartBar` `stack` applies to bars only: a line stays on its own values (a target, an average) unless you give it a `stack`.
|
|
65
|
+
|
|
66
|
+
`ChartBar` loads the ECharts line series too, so bar + line charts need no extra import.
|
|
67
|
+
|
|
68
|
+
### Negative values
|
|
69
|
+
|
|
70
|
+
Bars round the end that points away from zero.
|
|
71
|
+
|
|
72
|
+
```vue
|
|
73
|
+
<ChartBar :categories="months">
|
|
74
|
+
<ChartBarSeries name="Balance" :data="[1200, -400, 800, -150]" />
|
|
75
|
+
</ChartBar>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Reference lines
|
|
79
|
+
|
|
80
|
+
```vue
|
|
81
|
+
<ChartBar :categories="months">
|
|
82
|
+
<ChartBarSeries name="Orders" :data="orders" :reference="{ type: 'average' }" />
|
|
83
|
+
</ChartBar>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Value labels
|
|
87
|
+
|
|
88
|
+
```vue
|
|
89
|
+
<ChartBar labels :categories="months" :format-label="(value) => `${value}%`">
|
|
90
|
+
<ChartBarSeries name="Share" :data="share" />
|
|
91
|
+
</ChartBar>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Time axis
|
|
95
|
+
|
|
96
|
+
Dates as `categories` place bars by time. See [ChartLine](./ChartLine.md#time-axis).
|
|
97
|
+
|
|
98
|
+
```vue
|
|
99
|
+
<ChartBar :categories="days">
|
|
100
|
+
<ChartBarSeries name="Spent" :data="spentPerDay" />
|
|
101
|
+
</ChartBar>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Square corners
|
|
105
|
+
|
|
106
|
+
```vue
|
|
107
|
+
<ChartBar :radius="0" :categories="months">
|
|
108
|
+
<ChartBarSeries name="Orders" :data="orders" />
|
|
109
|
+
</ChartBar>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Props (`ChartBar`)
|
|
113
|
+
|
|
114
|
+
Shared root props (`height`, `palette`, `loading`, `summary`, …) are listed in [Chart](./Chart.md#props-every-root).
|
|
115
|
+
|
|
116
|
+
| Prop | Type | Default | Description |
|
|
117
|
+
| -------------- | ---------------------------- | ------------ | ----------------------------------------------- |
|
|
118
|
+
| `categories` | `string[] \| Date[]` | required | Category labels, or dates for a time axis. |
|
|
119
|
+
| `orientation` | `"vertical" \| "horizontal"` | `"vertical"` | `horizontal` puts categories on `y`. |
|
|
120
|
+
| `stack` | `string` | — | Stack every bar series under this key. |
|
|
121
|
+
| `labels` | `boolean` | `false` | Value labels on every series. |
|
|
122
|
+
| `radius` | `number` | `4` | Corner radius (px) on the value end. |
|
|
123
|
+
| `format-date` | `(date: Date) => string` | — | Date labels in the tooltip, table, and summary. |
|
|
124
|
+
| `format-label` | `(value: number) => string` | — | Value labels and reference line labels. |
|
|
125
|
+
|
|
126
|
+
## Props (`ChartBarSeries`)
|
|
127
|
+
|
|
128
|
+
Unset options fall back to the `ChartBar` props.
|
|
129
|
+
|
|
130
|
+
| Prop | Type | Default | Description |
|
|
131
|
+
| ----------- | ------------------------------------ | -------- | -------------------------------------------------------------------------------------- |
|
|
132
|
+
| `name` | `string` | required | Legend, tooltip, and table name. |
|
|
133
|
+
| `data` | `(number \| null)[]` | required | One value per category. |
|
|
134
|
+
| `color` | `ChartColorValue` | palette | Token key or CSS color. |
|
|
135
|
+
| `stack` | `string` | root | Stack key. |
|
|
136
|
+
| `labels` | `boolean` | root | Value labels. |
|
|
137
|
+
| `reference` | `ChartReference \| ChartReference[]` | — | `{ type: "average" \| "min" \| "max" }` or `{ value }`, each with an optional `label`. |
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# ChartFunnel
|
|
2
|
+
|
|
3
|
+
Funnel charts: conversion through ordered stages. Stages come from `data`; compose with `ChartLegend` and `ChartTooltip`. Shared parts, colors, and a11y are in [Chart](./Chart.md).
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { ChartFunnel } from "@bridge-ui/vue/Components/ChartFunnel";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Examples
|
|
12
|
+
|
|
13
|
+
### Usage
|
|
14
|
+
|
|
15
|
+
```vue
|
|
16
|
+
<ChartFunnel
|
|
17
|
+
:data="[
|
|
18
|
+
{ label: 'Visited', value: 1200 },
|
|
19
|
+
{ label: 'Signed up', value: 420 },
|
|
20
|
+
{ label: 'Paid', value: 96 },
|
|
21
|
+
]"
|
|
22
|
+
>
|
|
23
|
+
<ChartTooltip />
|
|
24
|
+
</ChartFunnel>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Stages are sorted from the largest by default. Shares compare each stage to the largest one, whatever the order: with `sort="none"`, a stage after a smaller one can show a higher share.
|
|
28
|
+
|
|
29
|
+
### Order
|
|
30
|
+
|
|
31
|
+
```vue
|
|
32
|
+
<ChartFunnel sort="none" :data="steps" />
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Labels and legend
|
|
36
|
+
|
|
37
|
+
Stage labels are on and sit inside the shape by default. `label-position="outside"` moves them next to it, `:labels="false"` hides them, and `label-content` picks the text.
|
|
38
|
+
|
|
39
|
+
```vue
|
|
40
|
+
<ChartFunnel :data="steps" label-content="percent" label-position="outside">
|
|
41
|
+
<ChartLegend show-value show-percent />
|
|
42
|
+
</ChartFunnel>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Alignment
|
|
46
|
+
|
|
47
|
+
```vue
|
|
48
|
+
<ChartFunnel align="left" :data="steps" />
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Props (`ChartFunnel`)
|
|
52
|
+
|
|
53
|
+
Shared root props (`height`, `palette`, `loading`, `summary`, …) are listed in [Chart](./Chart.md#props-every-root).
|
|
54
|
+
|
|
55
|
+
| Prop | Type | Default | Description |
|
|
56
|
+
| ---------------- | ------------------------------------------------------ | -------------- | --------------------------- |
|
|
57
|
+
| `data` | `{ label, value, color? }[]` | required | Stages. |
|
|
58
|
+
| `sort` | `"descending" \| "ascending" \| "none"` | `"descending"` | Stage order, top to bottom. |
|
|
59
|
+
| `align` | `"center" \| "left" \| "right"` | `"center"` | Shape alignment. |
|
|
60
|
+
| `labels` | `boolean` | `true` | Stage labels on the plot. |
|
|
61
|
+
| `label-position` | `"inside" \| "outside"` | `"inside"` | Where plot labels sit. |
|
|
62
|
+
| `label-content` | `"label" \| "value" \| "percent" \| (stage) => string` | `"label"` | What plot labels show. |
|