vccs 1.0.0-beta.1 → 1.0.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/README.md +11 -0
- package/dist/es/cartesian/bar/components/BarRectangles.mjs +1 -1
- package/dist/es/cartesian/brush/Brush.mjs +4 -0
- package/dist/es/cartesian/funnel/Funnel.mjs +1 -1
- package/dist/es/cartesian/scatter/Scatter.mjs +1 -1
- package/dist/es/chart/CellGridLayer.mjs +1 -1
- package/dist/es/chart/JourneySankey.mjs +1 -1
- package/dist/es/chart/Sankey.mjs +2 -2
- package/dist/es/chart/Sparkline.mjs +1 -1
- package/dist/es/chart/SunburstChart.mjs +1 -1
- package/dist/es/chart/Treemap.mjs +1 -1
- package/dist/es/events/sync.mjs +1 -2
- package/dist/es/events/usePointEvents.mjs +1 -1
- package/dist/es/model/tooltip.mjs +3 -5
- package/dist/es/polar/pie/Pie.mjs +1 -1
- package/dist/es/polar/radial-bar/RadialBar.mjs +1 -1
- package/dist/model/tooltip.d.ts +4 -18
- package/package.json +6 -2
- package/usage/catalog.json +235 -0
- package/usage/guides/charts/area-chart.md +56 -0
- package/usage/guides/charts/bar-chart.md +60 -0
- package/usage/guides/charts/bar-list.md +46 -0
- package/usage/guides/charts/calendar-heatmap.md +55 -0
- package/usage/guides/charts/cohort-chart.md +47 -0
- package/usage/guides/charts/composed-chart.md +70 -0
- package/usage/guides/charts/funnel-chart.md +58 -0
- package/usage/guides/charts/heatmap.md +51 -0
- package/usage/guides/charts/journey-sankey.md +49 -0
- package/usage/guides/charts/line-chart.md +60 -0
- package/usage/guides/charts/pie-chart.md +59 -0
- package/usage/guides/charts/radar-chart.md +69 -0
- package/usage/guides/charts/radial-bar-chart.md +54 -0
- package/usage/guides/charts/sankey.md +59 -0
- package/usage/guides/charts/scatter-chart.md +62 -0
- package/usage/guides/charts/sparkline.md +51 -0
- package/usage/guides/charts/sunburst-chart.md +66 -0
- package/usage/guides/charts/tracker.md +49 -0
- package/usage/guides/charts/treemap.md +68 -0
- package/usage/guides/core/installation.md +68 -0
- package/usage/guides/core/ssr-testing.md +50 -0
- package/usage/guides/core/typed-rows.md +47 -0
- package/usage/guides/core/vue-api.md +72 -0
- package/usage/vccs-usage.mjs +191 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# BarList
|
|
2
|
+
|
|
3
|
+
Use `BarList` for a compact ranked list with labels and inline magnitude bars. It is plain HTML, not an SVG chart; use `BarChart` when you need axes, stacked values, or multiple series.
|
|
4
|
+
|
|
5
|
+
## Data shape
|
|
6
|
+
|
|
7
|
+
- `data` contains one row per item.
|
|
8
|
+
- `name-key` selects the label and row identity; it defaults to `name`.
|
|
9
|
+
- `data-key` selects the numeric value; it defaults to `value`.
|
|
10
|
+
- Add `href-key` when a row field should turn its label into a link.
|
|
11
|
+
- Bar length is the value divided by the largest value, not the share of the total.
|
|
12
|
+
|
|
13
|
+
## Minimal example
|
|
14
|
+
|
|
15
|
+
```vue
|
|
16
|
+
<script setup lang="ts">
|
|
17
|
+
import { BarList } from 'vccs'
|
|
18
|
+
|
|
19
|
+
const data = [
|
|
20
|
+
{ name: '/', value: 1240, url: '/' },
|
|
21
|
+
{ name: '/pricing', value: 820, url: '/pricing' },
|
|
22
|
+
{ name: '/docs', value: 610, url: '/docs' },
|
|
23
|
+
{ name: '/blog', value: 330, url: '/blog' },
|
|
24
|
+
]
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<BarList
|
|
29
|
+
:data="data"
|
|
30
|
+
href-key="url"
|
|
31
|
+
color="#f97316"
|
|
32
|
+
/>
|
|
33
|
+
</template>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Chart-specific rules
|
|
37
|
+
|
|
38
|
+
- Rows sort by descending value by default; use `sort="none"` to preserve input order.
|
|
39
|
+
- Keep `name-key` stable across updates so a row keeps its identity when its rank changes.
|
|
40
|
+
- Use `value-formatter` for display text and `locale` for the default number format.
|
|
41
|
+
- Customize labels or values with the `#name` and `#value` slots, not function-valued render props.
|
|
42
|
+
- Adjust the HTML rows with `row-height` and `gap`; do not add Cartesian axes or series children.
|
|
43
|
+
|
|
44
|
+
## Related guides
|
|
45
|
+
|
|
46
|
+
`installation`, `vue-api`, `typed-rows`, `ssr-testing`, `bar-chart`, `tracker`.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# CalendarHeatmap
|
|
2
|
+
|
|
3
|
+
Use `CalendarHeatmap` for daily activity arranged into weekdays and weeks, such as contributions or practice minutes. Use `Heatmap` for arbitrary categories and `Sparkline` when only the overall trend matters.
|
|
4
|
+
|
|
5
|
+
## Data shape
|
|
6
|
+
|
|
7
|
+
- `data` is a flat array of daily rows.
|
|
8
|
+
- `date-key` defaults to `date` and accepts a valid `YYYY-MM-DD` string or a `Date` object.
|
|
9
|
+
- `data-key` defaults to `value` and selects the numeric intensity.
|
|
10
|
+
- Rows for the same day are summed; invalid dates are skipped.
|
|
11
|
+
- Days without a source row are empty cells; do not pad the range with zero rows.
|
|
12
|
+
- Set `start` and `end` for an explicit range. Otherwise the range ends on the latest data date and covers about 52 weeks.
|
|
13
|
+
|
|
14
|
+
## Minimal example
|
|
15
|
+
|
|
16
|
+
```vue
|
|
17
|
+
<script setup lang="ts">
|
|
18
|
+
import { CalendarHeatmap, Tooltip } from 'vccs'
|
|
19
|
+
|
|
20
|
+
const data = [
|
|
21
|
+
{ date: '2025-01-02', value: 3 },
|
|
22
|
+
{ date: '2025-01-04', value: 5 },
|
|
23
|
+
{ date: '2025-01-07', value: 2 },
|
|
24
|
+
{ date: '2025-01-10', value: 8 },
|
|
25
|
+
{ date: '2025-01-13', value: 4 },
|
|
26
|
+
{ date: '2025-01-16', value: 1 },
|
|
27
|
+
{ date: '2025-01-20', value: 9 },
|
|
28
|
+
{ date: '2025-01-24', value: 6 },
|
|
29
|
+
]
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<CalendarHeatmap
|
|
34
|
+
:data="data"
|
|
35
|
+
start="2025-01-01"
|
|
36
|
+
end="2025-01-31"
|
|
37
|
+
:week-start="1"
|
|
38
|
+
color="#14b8a6"
|
|
39
|
+
>
|
|
40
|
+
<Tooltip :cursor="false" />
|
|
41
|
+
</CalendarHeatmap>
|
|
42
|
+
</template>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Chart-specific rules
|
|
46
|
+
|
|
47
|
+
- Prefer `YYYY-MM-DD` strings for unambiguous calendar days; a `Date` uses its local calendar date.
|
|
48
|
+
- Explicit `start` and `end` keep a fixed example or server-rendered range independent of the current day.
|
|
49
|
+
- `colors` is the complete scale from empty to full, so include the empty color as its first entry.
|
|
50
|
+
- Use `:week-start="0"` for Sunday or `:week-start="1"` for Monday; `max` controls the value at full intensity.
|
|
51
|
+
- Tooltip and cell-event payloads are `CalendarDay` objects with `date`, `value`, `level`, and source `rows`.
|
|
52
|
+
|
|
53
|
+
## Related guides
|
|
54
|
+
|
|
55
|
+
`installation`, `vue-api`, `typed-rows`, `ssr-testing`, `heatmap`, `tracker`, `sparkline`.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# CohortChart
|
|
2
|
+
|
|
3
|
+
Use `CohortChart` for retention or another count by acquisition cohort and elapsed period. Use `Heatmap` for an arbitrary matrix and `LineChart` for one overall trend without cohort breakdown.
|
|
4
|
+
|
|
5
|
+
## Data shape
|
|
6
|
+
|
|
7
|
+
- `data` contains one row per cohort, ordered oldest first.
|
|
8
|
+
- `cohort-key` selects the cohort name and defaults to `cohort`.
|
|
9
|
+
- `values-key` selects a numeric array and defaults to `values`.
|
|
10
|
+
- `values[0]` is the initial cohort size; `values[n]` is the count still active at period `n`.
|
|
11
|
+
- Supply raw counts even in the default percentage mode. Omit periods a cohort has not reached instead of padding them with zero.
|
|
12
|
+
|
|
13
|
+
## Minimal example
|
|
14
|
+
|
|
15
|
+
```vue
|
|
16
|
+
<script setup lang="ts">
|
|
17
|
+
import { CohortChart, Tooltip } from 'vccs'
|
|
18
|
+
|
|
19
|
+
const data = [
|
|
20
|
+
{ cohort: 'Jan', values: [1200, 610, 480, 410] },
|
|
21
|
+
{ cohort: 'Feb', values: [940, 470, 370] },
|
|
22
|
+
{ cohort: 'Mar', values: [1180, 650] },
|
|
23
|
+
{ cohort: 'Apr', values: [860] },
|
|
24
|
+
]
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<CohortChart
|
|
29
|
+
:data="data"
|
|
30
|
+
color="#f97316"
|
|
31
|
+
>
|
|
32
|
+
<Tooltip :cursor="false" />
|
|
33
|
+
</CohortChart>
|
|
34
|
+
</template>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Chart-specific rules
|
|
38
|
+
|
|
39
|
+
- The default `mode="percent"` calculates each cell from the raw count divided by `values[0]`; use `mode="count"` for raw counts.
|
|
40
|
+
- Keep `values[0]` positive. A non-positive or invalid initial size cannot produce percentage cells.
|
|
41
|
+
- Different cohorts may have different array lengths; shorter arrays leave unelapsed periods blank and form the expected triangle.
|
|
42
|
+
- Use `period-formatter` for column headings. `value-formatter` receives the calculated percentage or the raw count according to `mode`.
|
|
43
|
+
- Tooltip and cell-event payloads include the cohort source `row`, contributing `rows`, and elapsed `period`.
|
|
44
|
+
|
|
45
|
+
## Related guides
|
|
46
|
+
|
|
47
|
+
`installation`, `vue-api`, `typed-rows`, `ssr-testing`, `heatmap`, `line-chart`.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# ComposedChart
|
|
2
|
+
|
|
3
|
+
Use `ComposedChart` when different series need different marks on shared Cartesian axes. Use a specific chart root when every series has the same mark; do not combine incomparable units on one value axis.
|
|
4
|
+
|
|
5
|
+
## Data shape
|
|
6
|
+
|
|
7
|
+
- `data` is an array of flat rows on the chart root.
|
|
8
|
+
- `XAxis data-key` names the shared ordered category or time value.
|
|
9
|
+
- Each `Area`, `Bar`, or `Line` uses `data-key` to select a numeric field from the same row.
|
|
10
|
+
- Set `name` on each series when the legend or tooltip needs a label different from the key.
|
|
11
|
+
|
|
12
|
+
## Minimal example
|
|
13
|
+
|
|
14
|
+
```vue
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
import { Area, Bar, CartesianGrid, ComposedChart, Legend, Line, Tooltip, XAxis, YAxis } from 'vccs'
|
|
17
|
+
|
|
18
|
+
const data = [
|
|
19
|
+
{ month: 'Jan', desktop: 186, mobile: 80, total: 266 },
|
|
20
|
+
{ month: 'Feb', desktop: 305, mobile: 120, total: 425 },
|
|
21
|
+
{ month: 'Mar', desktop: 237, mobile: 160, total: 397 },
|
|
22
|
+
]
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<ComposedChart
|
|
27
|
+
:data="data"
|
|
28
|
+
:height="300"
|
|
29
|
+
>
|
|
30
|
+
<CartesianGrid />
|
|
31
|
+
<XAxis data-key="month" />
|
|
32
|
+
<YAxis />
|
|
33
|
+
<Tooltip :cursor="false" />
|
|
34
|
+
<Legend />
|
|
35
|
+
<Area
|
|
36
|
+
type="monotone"
|
|
37
|
+
data-key="total"
|
|
38
|
+
name="Total"
|
|
39
|
+
stroke="#f97316"
|
|
40
|
+
fill="#f97316"
|
|
41
|
+
:fill-opacity="0.3"
|
|
42
|
+
/>
|
|
43
|
+
<Bar
|
|
44
|
+
data-key="desktop"
|
|
45
|
+
name="Desktop"
|
|
46
|
+
fill="#14b8a6"
|
|
47
|
+
:bar-size="20"
|
|
48
|
+
/>
|
|
49
|
+
<Line
|
|
50
|
+
type="monotone"
|
|
51
|
+
data-key="mobile"
|
|
52
|
+
name="Mobile"
|
|
53
|
+
stroke="#f59e0b"
|
|
54
|
+
/>
|
|
55
|
+
</ComposedChart>
|
|
56
|
+
</template>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Animation is enabled by default; retrieve `ssr-testing` before taking screenshots or asserting exact geometry.
|
|
60
|
+
|
|
61
|
+
## Chart-specific rules
|
|
62
|
+
|
|
63
|
+
- Combine `Area`, `Bar`, `Line`, and `Scatter` children; retrieve their chart guides for series-specific props.
|
|
64
|
+
- Keep `Area`, `Bar`, and `Line` series on the shared root `data` array; retrieve `scatter-chart` for scatter data and numeric axes.
|
|
65
|
+
- Series paint in template order, so a later series can cover an earlier one.
|
|
66
|
+
- The tooltip follows the category axis; add `Legend` when multiple series need visible labels.
|
|
67
|
+
|
|
68
|
+
## Related guides
|
|
69
|
+
|
|
70
|
+
`installation`, `vue-api`, `typed-rows`, `ssr-testing`, `area-chart`, `bar-chart`, `line-chart`, `scatter-chart`.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# FunnelChart
|
|
2
|
+
|
|
3
|
+
Use `FunnelChart` for values and drop-off across ordered conversion stages. Use `BarChart` for unordered categories; use `JourneySankey` when users can take branching paths instead of one shared sequence.
|
|
4
|
+
|
|
5
|
+
## Data shape
|
|
6
|
+
|
|
7
|
+
- Pass an array of flat rows to `Funnel data`; the chart root's `data` is the fallback when it is omitted.
|
|
8
|
+
- Keep rows in process order, with one row per stage.
|
|
9
|
+
- `data-key` selects the numeric stage value.
|
|
10
|
+
- `name-key` selects the stage label and defaults to `name`.
|
|
11
|
+
|
|
12
|
+
## Minimal example
|
|
13
|
+
|
|
14
|
+
```vue
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
import { Cell, Funnel, FunnelChart, Tooltip } from 'vccs'
|
|
17
|
+
|
|
18
|
+
const data = [
|
|
19
|
+
{ stage: 'Visited', users: 1000 },
|
|
20
|
+
{ stage: 'Added to cart', users: 680 },
|
|
21
|
+
{ stage: 'Reached checkout', users: 420 },
|
|
22
|
+
{ stage: 'Purchased', users: 260 },
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
const colors = ['#f97316', '#14b8a6', '#f59e0b', '#06b6d4']
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<template>
|
|
29
|
+
<FunnelChart :height="300">
|
|
30
|
+
<Tooltip :cursor="false" />
|
|
31
|
+
<Funnel
|
|
32
|
+
:data="data"
|
|
33
|
+
data-key="users"
|
|
34
|
+
name-key="stage"
|
|
35
|
+
>
|
|
36
|
+
<Cell
|
|
37
|
+
v-for="(entry, index) in data"
|
|
38
|
+
:key="entry.stage"
|
|
39
|
+
:fill="colors[index]"
|
|
40
|
+
/>
|
|
41
|
+
</Funnel>
|
|
42
|
+
</FunnelChart>
|
|
43
|
+
</template>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Animation is enabled by default; retrieve `ssr-testing` before taking screenshots or asserting exact geometry.
|
|
47
|
+
|
|
48
|
+
## Chart-specific rules
|
|
49
|
+
|
|
50
|
+
- Use one `Cell` per row for explicit segment colors; otherwise `fill` supplies the series color.
|
|
51
|
+
- Place `LabelList` inside `Funnel` for stage values or custom labels.
|
|
52
|
+
- Set `last-shape-type="rectangle"` to keep the final segment's width instead of narrowing to a point.
|
|
53
|
+
- Set `:reversed="true"` to flip the funnel vertically; keep the source rows in process order.
|
|
54
|
+
- Use `width` and the chart's `margin` for sizing. `Funnel` has no public `x` or `y` props; custom `#shape` geometry already applies the left offset to `x` and the top offset to `y`, so do not swap or re-add them.
|
|
55
|
+
|
|
56
|
+
## Related guides
|
|
57
|
+
|
|
58
|
+
`installation`, `vue-api`, `typed-rows`, `ssr-testing`, `pie-chart`, `bar-chart`, `journey-sankey`.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Heatmap
|
|
2
|
+
|
|
3
|
+
Use `Heatmap` to compare magnitude across two categorical dimensions, such as visits by weekday and hour. Use `CalendarHeatmap` for calendar dates and `CohortChart` for retention by elapsed cohort period.
|
|
4
|
+
|
|
5
|
+
## Data shape
|
|
6
|
+
|
|
7
|
+
- `data` is a flat array with one column key, one row key, and one numeric value per row.
|
|
8
|
+
- The default fields are `x`, `y`, and `value`; override them with `x-key`, `y-key`, and `data-key`.
|
|
9
|
+
- Rows with the same x/y pair are summed into one cell.
|
|
10
|
+
- Columns and rows follow first appearance by default; use `x-domain` and `y-domain` for explicit order or empty categories.
|
|
11
|
+
|
|
12
|
+
## Minimal example
|
|
13
|
+
|
|
14
|
+
```vue
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
import { Heatmap, Tooltip } from 'vccs'
|
|
17
|
+
|
|
18
|
+
const data = [
|
|
19
|
+
{ x: '09:00', y: 'Mon', value: 42 },
|
|
20
|
+
{ x: '12:00', y: 'Mon', value: 68 },
|
|
21
|
+
{ x: '18:00', y: 'Mon', value: 51 },
|
|
22
|
+
{ x: '09:00', y: 'Tue', value: 38 },
|
|
23
|
+
{ x: '12:00', y: 'Tue', value: 74 },
|
|
24
|
+
{ x: '18:00', y: 'Tue', value: 49 },
|
|
25
|
+
{ x: '09:00', y: 'Wed', value: 45 },
|
|
26
|
+
{ x: '12:00', y: 'Wed', value: 79 },
|
|
27
|
+
{ x: '18:00', y: 'Wed', value: 56 },
|
|
28
|
+
]
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<template>
|
|
32
|
+
<Heatmap
|
|
33
|
+
:data="data"
|
|
34
|
+
color="#14b8a6"
|
|
35
|
+
>
|
|
36
|
+
<Tooltip :cursor="false" />
|
|
37
|
+
</Heatmap>
|
|
38
|
+
</template>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Chart-specific rules
|
|
42
|
+
|
|
43
|
+
- Use `color` for the full-intensity color and `empty-color` for empty cells; `max` sets the value that reaches full intensity.
|
|
44
|
+
- Use `colors` only as a complete scale from empty to full; it overrides `color`, `empty-color`, and `levels`.
|
|
45
|
+
- Keep `fill-missing` enabled for a complete matrix, or disable it when absent x/y pairs should remain holes.
|
|
46
|
+
- Tooltip and cell-event payloads are aggregated cells with `{ x, y, value, rows }`; read source rows from `rows`.
|
|
47
|
+
- `active-index` identifies a rendered cell position, not an input row index.
|
|
48
|
+
|
|
49
|
+
## Related guides
|
|
50
|
+
|
|
51
|
+
`installation`, `vue-api`, `typed-rows`, `ssr-testing`, `calendar-heatmap`, `cohort-chart`, `tracker`.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# JourneySankey
|
|
2
|
+
|
|
3
|
+
Use `JourneySankey` for whole journeys through ordered steps, including path highlighting and drop-off. Use `Sankey` instead for an arbitrary flow graph; use `FunnelChart` when only stage totals matter and individual paths do not.
|
|
4
|
+
|
|
5
|
+
## Data shape
|
|
6
|
+
|
|
7
|
+
- `data` is an array with one row per observed journey.
|
|
8
|
+
- `path` is an ordered array of page or event names; `count` is the number of sessions that took that path.
|
|
9
|
+
- `path-key` and `data-key` select different row fields when your names differ.
|
|
10
|
+
- The same name at different steps represents different nodes.
|
|
11
|
+
|
|
12
|
+
## Minimal example
|
|
13
|
+
|
|
14
|
+
```vue
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
import { JourneySankey, Tooltip } from 'vccs'
|
|
17
|
+
|
|
18
|
+
const journeys = [
|
|
19
|
+
{ path: ['/', '/pricing'], count: 6 },
|
|
20
|
+
{ path: ['/', '/pricing', '/signup'], count: 4 },
|
|
21
|
+
{ path: ['/', '/docs'], count: 3 },
|
|
22
|
+
{ path: ['/blog/launch', '/pricing', '/signup'], count: 2 },
|
|
23
|
+
]
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<JourneySankey
|
|
28
|
+
:data="journeys"
|
|
29
|
+
:height="320"
|
|
30
|
+
color="#f97316"
|
|
31
|
+
>
|
|
32
|
+
<Tooltip :cursor="false" />
|
|
33
|
+
</JourneySankey>
|
|
34
|
+
</template>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Animation is enabled by default; retrieve `ssr-testing` before taking screenshots or asserting exact geometry.
|
|
38
|
+
|
|
39
|
+
## Chart-specific rules
|
|
40
|
+
|
|
41
|
+
- Keep complete paths as input. Do not pre-convert them into Sankey `nodes` and `links`; whole paths are what preserve drop-off and exact-journey pinning.
|
|
42
|
+
- Set `steps` to limit the displayed columns. Longer journeys are cut to that many steps.
|
|
43
|
+
- Set `:exits-known="false"` when journeys were truncated before you received them, so their endpoints are not presented as session exits.
|
|
44
|
+
- Click a node or band to pin the largest journey through it. Use `v-model:pinned` with a `string[] | null` ref to read or control the pinned path.
|
|
45
|
+
- Set `:headers="false"` to hide step headers; use `color` and `exit-color` to distinguish continuing sessions from exits.
|
|
46
|
+
|
|
47
|
+
## Related guides
|
|
48
|
+
|
|
49
|
+
`installation`, `vue-api`, `typed-rows`, `ssr-testing`, `sankey`, `funnel-chart`.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# LineChart
|
|
2
|
+
|
|
3
|
+
Use `LineChart` for one or more trends over an ordered axis. Use `Sparkline` instead when the chart must be tiny and axes would add noise; use `AreaChart` when filled magnitude matters.
|
|
4
|
+
|
|
5
|
+
## Data shape
|
|
6
|
+
|
|
7
|
+
- `data` is an array of flat rows on the chart root.
|
|
8
|
+
- `XAxis data-key` names the ordered category or time value.
|
|
9
|
+
- Each `Line data-key` selects one numeric series from the same row.
|
|
10
|
+
- Use one `Line` per series and set `name` when the legend or tooltip needs a label different from the key.
|
|
11
|
+
|
|
12
|
+
## Minimal example
|
|
13
|
+
|
|
14
|
+
```vue
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
import { CartesianGrid, Legend, Line, LineChart, Tooltip, XAxis, YAxis } from 'vccs'
|
|
17
|
+
|
|
18
|
+
const data = [
|
|
19
|
+
{ month: 'Jan', desktop: 186, mobile: 80 },
|
|
20
|
+
{ month: 'Feb', desktop: 305, mobile: 120 },
|
|
21
|
+
{ month: 'Mar', desktop: 237, mobile: 160 },
|
|
22
|
+
]
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<LineChart
|
|
27
|
+
:data="data"
|
|
28
|
+
:height="300"
|
|
29
|
+
>
|
|
30
|
+
<CartesianGrid stroke-dasharray="3 3" />
|
|
31
|
+
<XAxis data-key="month" />
|
|
32
|
+
<YAxis />
|
|
33
|
+
<Tooltip :cursor="false" />
|
|
34
|
+
<Legend />
|
|
35
|
+
<Line
|
|
36
|
+
type="monotone"
|
|
37
|
+
data-key="desktop"
|
|
38
|
+
stroke="#f97316"
|
|
39
|
+
/>
|
|
40
|
+
<Line
|
|
41
|
+
type="monotone"
|
|
42
|
+
data-key="mobile"
|
|
43
|
+
stroke="#14b8a6"
|
|
44
|
+
/>
|
|
45
|
+
</LineChart>
|
|
46
|
+
</template>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Animation is enabled by default; retrieve `ssr-testing` before taking screenshots or asserting exact geometry.
|
|
50
|
+
|
|
51
|
+
## Chart-specific rules
|
|
52
|
+
|
|
53
|
+
- Keep all series on the shared root `data` array; do not put a separate array on each `Line`.
|
|
54
|
+
- Customize points with the `dot` or `activeDot` slot on `Line`, not a function-valued `dot` prop.
|
|
55
|
+
- Use `connect-nulls` only when a gap should be bridged; otherwise missing values stay visible as gaps.
|
|
56
|
+
- Retrieve `composed-chart` when bars, areas, or scatter points must share the same axes.
|
|
57
|
+
|
|
58
|
+
## Related guides
|
|
59
|
+
|
|
60
|
+
`installation`, `vue-api`, `typed-rows`, `ssr-testing`, `area-chart`, `sparkline`, `composed-chart`.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# PieChart
|
|
2
|
+
|
|
3
|
+
Use `PieChart` for a small number of part-to-whole proportions. Use `BarChart` instead when precise comparison matters or there are many categories; use `Treemap` or `SunburstChart` for hierarchical parts.
|
|
4
|
+
|
|
5
|
+
## Data shape
|
|
6
|
+
|
|
7
|
+
- Pass an array of flat rows to `Pie data`; the chart root's `data` is the fallback when it is omitted.
|
|
8
|
+
- `data-key` selects the numeric value for each sector.
|
|
9
|
+
- `name-key` selects the sector label and defaults to `name`.
|
|
10
|
+
- Render one `Cell` per row when each sector needs an explicit color.
|
|
11
|
+
|
|
12
|
+
## Minimal example
|
|
13
|
+
|
|
14
|
+
```vue
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
import { Cell, Pie, PieChart, Tooltip } from 'vccs'
|
|
17
|
+
|
|
18
|
+
const data = [
|
|
19
|
+
{ source: 'Organic search', visitors: 420 },
|
|
20
|
+
{ source: 'Direct', visitors: 280 },
|
|
21
|
+
{ source: 'Referral', visitors: 190 },
|
|
22
|
+
{ source: 'Social', visitors: 110 },
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
const colors = ['#f97316', '#14b8a6', '#f59e0b', '#06b6d4']
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<template>
|
|
29
|
+
<PieChart :height="300">
|
|
30
|
+
<Tooltip :cursor="false" />
|
|
31
|
+
<Pie
|
|
32
|
+
:data="data"
|
|
33
|
+
data-key="visitors"
|
|
34
|
+
name-key="source"
|
|
35
|
+
:outer-radius="100"
|
|
36
|
+
>
|
|
37
|
+
<Cell
|
|
38
|
+
v-for="(entry, index) in data"
|
|
39
|
+
:key="entry.source"
|
|
40
|
+
:fill="colors[index]"
|
|
41
|
+
/>
|
|
42
|
+
</Pie>
|
|
43
|
+
</PieChart>
|
|
44
|
+
</template>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Animation is enabled by default; retrieve `ssr-testing` before taking screenshots or asserting exact geometry.
|
|
48
|
+
|
|
49
|
+
## Chart-specific rules
|
|
50
|
+
|
|
51
|
+
- Set `inner-radius` above `0` for a donut; keep `outer-radius` larger than the inner radius.
|
|
52
|
+
- Use `start-angle` and `end-angle` for partial pies such as semicircles.
|
|
53
|
+
- Set `:label="true"` for default sector labels and `label-line` to control their connectors.
|
|
54
|
+
- `PieChart` uses item tooltips, so hovering a sector shows that sector rather than an axis-wide payload.
|
|
55
|
+
- Use `v-model:active-index` with a `number | null` when the active sector is controlled externally.
|
|
56
|
+
|
|
57
|
+
## Related guides
|
|
58
|
+
|
|
59
|
+
`installation`, `vue-api`, `typed-rows`, `ssr-testing`, `bar-chart`, `funnel-chart`, `treemap`, `sunburst-chart`.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# RadarChart
|
|
2
|
+
|
|
3
|
+
Use `RadarChart` to compare multivariate profiles across a shared set of dimensions. Use `LineChart` for ordered trends and `BarChart` when dimensions have incompatible units or precise magnitude comparison is the main task.
|
|
4
|
+
|
|
5
|
+
## Data shape
|
|
6
|
+
|
|
7
|
+
- Put a flat array on the chart root's `data`, with one row per dimension.
|
|
8
|
+
- `PolarAngleAxis data-key` selects the dimension label.
|
|
9
|
+
- Each `Radar data-key` selects one numeric profile from those same rows.
|
|
10
|
+
- Use one `Radar` per profile and set `name` when its legend or tooltip label should differ from the key.
|
|
11
|
+
|
|
12
|
+
## Minimal example
|
|
13
|
+
|
|
14
|
+
```vue
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
import { Legend, PolarAngleAxis, PolarGrid, Radar, RadarChart, Tooltip } from 'vccs'
|
|
17
|
+
|
|
18
|
+
const data = [
|
|
19
|
+
{ dimension: 'Ease of use', current: 82, previous: 74 },
|
|
20
|
+
{ dimension: 'Performance', current: 88, previous: 80 },
|
|
21
|
+
{ dimension: 'Support', current: 76, previous: 72 },
|
|
22
|
+
{ dimension: 'Reliability', current: 91, previous: 85 },
|
|
23
|
+
{ dimension: 'Value', current: 79, previous: 75 },
|
|
24
|
+
]
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<RadarChart
|
|
29
|
+
:data="data"
|
|
30
|
+
cx="50%"
|
|
31
|
+
cy="50%"
|
|
32
|
+
:outer-radius="100"
|
|
33
|
+
:height="300"
|
|
34
|
+
>
|
|
35
|
+
<PolarGrid />
|
|
36
|
+
<PolarAngleAxis data-key="dimension" />
|
|
37
|
+
<Tooltip :cursor="false" />
|
|
38
|
+
<Legend />
|
|
39
|
+
<Radar
|
|
40
|
+
data-key="current"
|
|
41
|
+
name="Current"
|
|
42
|
+
stroke="#f97316"
|
|
43
|
+
fill="#f97316"
|
|
44
|
+
:fill-opacity="0.3"
|
|
45
|
+
/>
|
|
46
|
+
<Radar
|
|
47
|
+
data-key="previous"
|
|
48
|
+
name="Previous"
|
|
49
|
+
stroke="#14b8a6"
|
|
50
|
+
fill="#14b8a6"
|
|
51
|
+
:fill-opacity="0.3"
|
|
52
|
+
/>
|
|
53
|
+
</RadarChart>
|
|
54
|
+
</template>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Animation is enabled by default; retrieve `ssr-testing` before taking screenshots or asserting exact geometry.
|
|
58
|
+
|
|
59
|
+
## Chart-specific rules
|
|
60
|
+
|
|
61
|
+
- Keep every profile on the same scale across all dimensions; the example uses scores from 0 to 100.
|
|
62
|
+
- Set `grid-type="circle"` on `PolarGrid` for circular rings instead of the default polygon grid.
|
|
63
|
+
- Set `:dot="true"` for default vertex dots; use the `dot` or `activeDot` slot for custom content.
|
|
64
|
+
- Use `connect-nulls` only when missing vertices should be bridged.
|
|
65
|
+
- The `dot`, `active-dot`, and `label` props accept booleans or presentation objects, not render functions.
|
|
66
|
+
|
|
67
|
+
## Related guides
|
|
68
|
+
|
|
69
|
+
`installation`, `vue-api`, `typed-rows`, `ssr-testing`, `line-chart`, `bar-chart`, `radial-bar-chart`.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# RadialBarChart
|
|
2
|
+
|
|
3
|
+
Use `RadialBarChart` for circular progress or category values on concentric tracks. Use `BarChart` for precise comparisons across many categories; use `PieChart` when part-to-whole angle is more important than individual tracks.
|
|
4
|
+
|
|
5
|
+
## Data shape
|
|
6
|
+
|
|
7
|
+
- Put a flat array on the chart root's `data`; with one `RadialBar`, each row produces one bar.
|
|
8
|
+
- `RadialBar data-key` selects the numeric value from each row.
|
|
9
|
+
- A row can carry a `fill` color for its bar, as in the example.
|
|
10
|
+
- Set the chart's `inner-radius` and `outer-radius` to bound the tracks.
|
|
11
|
+
|
|
12
|
+
## Minimal example
|
|
13
|
+
|
|
14
|
+
```vue
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
import { RadialBar, RadialBarChart, Tooltip } from 'vccs'
|
|
17
|
+
|
|
18
|
+
const data = [
|
|
19
|
+
{ name: 'Chrome', visitors: 275, fill: '#f97316' },
|
|
20
|
+
{ name: 'Safari', visitors: 200, fill: '#14b8a6' },
|
|
21
|
+
{ name: 'Firefox', visitors: 187, fill: '#f59e0b' },
|
|
22
|
+
{ name: 'Edge', visitors: 173, fill: '#06b6d4' },
|
|
23
|
+
]
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<RadialBarChart
|
|
28
|
+
:data="data"
|
|
29
|
+
:inner-radius="30"
|
|
30
|
+
:outer-radius="120"
|
|
31
|
+
:height="300"
|
|
32
|
+
>
|
|
33
|
+
<RadialBar
|
|
34
|
+
data-key="visitors"
|
|
35
|
+
:background="true"
|
|
36
|
+
/>
|
|
37
|
+
<Tooltip :cursor="false" />
|
|
38
|
+
</RadialBarChart>
|
|
39
|
+
</template>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Animation is enabled by default; retrieve `ssr-testing` before taking screenshots or asserting exact geometry.
|
|
43
|
+
|
|
44
|
+
## Chart-specific rules
|
|
45
|
+
|
|
46
|
+
- Set `:background="true"` for default background arcs, or pass a presentation object to customize them.
|
|
47
|
+
- Use the chart's `start-angle` and `end-angle` to control the sweep of every bar.
|
|
48
|
+
- Give multiple `RadialBar` components the same `stack-id` to stack their values; each one still needs its own `data-key`.
|
|
49
|
+
- Use `bar-size` for bar thickness and `corner-radius` for rounded arc ends.
|
|
50
|
+
- Place `LabelList` inside `RadialBar` for default labels, or use `RadialBar`'s `#label` slot for custom content.
|
|
51
|
+
|
|
52
|
+
## Related guides
|
|
53
|
+
|
|
54
|
+
`installation`, `vue-api`, `typed-rows`, `ssr-testing`, `bar-chart`, `pie-chart`, `radar-chart`.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Sankey
|
|
2
|
+
|
|
3
|
+
Use `Sankey` for weighted flows between arbitrary nodes, such as energy distribution or budget transfers. Use `JourneySankey` instead for ordered session paths and drop-off; use `Treemap` for a part-to-whole hierarchy.
|
|
4
|
+
|
|
5
|
+
## Data shape
|
|
6
|
+
|
|
7
|
+
- `data` is one object containing `nodes` and `links` arrays.
|
|
8
|
+
- Each node normally has a `name`; `name-key` selects another field for tooltip names.
|
|
9
|
+
- Each link has numeric `source` and `target` indices into `nodes`, plus a numeric `value`.
|
|
10
|
+
- Link width comes from `value`. Keep values positive and the graph acyclic.
|
|
11
|
+
|
|
12
|
+
## Minimal example
|
|
13
|
+
|
|
14
|
+
```vue
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
import { Sankey, Tooltip } from 'vccs'
|
|
17
|
+
|
|
18
|
+
const data = {
|
|
19
|
+
nodes: [
|
|
20
|
+
{ name: 'Coal' },
|
|
21
|
+
{ name: 'Gas' },
|
|
22
|
+
{ name: 'Electricity' },
|
|
23
|
+
{ name: 'Industry' },
|
|
24
|
+
{ name: 'Homes' },
|
|
25
|
+
],
|
|
26
|
+
links: [
|
|
27
|
+
{ source: 0, target: 2, value: 30 },
|
|
28
|
+
{ source: 1, target: 2, value: 20 },
|
|
29
|
+
{ source: 2, target: 3, value: 28 },
|
|
30
|
+
{ source: 2, target: 4, value: 22 },
|
|
31
|
+
],
|
|
32
|
+
}
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<template>
|
|
36
|
+
<Sankey
|
|
37
|
+
:data="data"
|
|
38
|
+
:height="320"
|
|
39
|
+
node-fill="#f97316"
|
|
40
|
+
link-fill="#14b8a6"
|
|
41
|
+
>
|
|
42
|
+
<Tooltip :cursor="false" />
|
|
43
|
+
</Sankey>
|
|
44
|
+
</template>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Animation is enabled by default; retrieve `ssr-testing` before taking screenshots or asserting exact geometry.
|
|
48
|
+
|
|
49
|
+
## Chart-specific rules
|
|
50
|
+
|
|
51
|
+
- Use numeric indices for `source` and `target`, not node names or object references.
|
|
52
|
+
- Link widths always use `value`; `data-key` changes the tooltip data key, not the layout.
|
|
53
|
+
- Invalid endpoints, non-positive values, and cyclic links are not rendered.
|
|
54
|
+
- Customize nodes and links with the `#node` and `#link` slots, not function-valued props.
|
|
55
|
+
- Adjust spacing with `node-width` and `node-padding`; use `margin` when labels need more room.
|
|
56
|
+
|
|
57
|
+
## Related guides
|
|
58
|
+
|
|
59
|
+
`installation`, `vue-api`, `ssr-testing`, `journey-sankey`, `treemap`.
|