vccs 1.0.0-beta.2 → 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.
@@ -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`.
@@ -0,0 +1,62 @@
1
+ # ScatterChart
2
+
3
+ Use `ScatterChart` to show relationships or distributions across numeric variables, optionally with bubble size. Use `LineChart` for an ordered trend and `BarChart` for category comparisons.
4
+
5
+ ## Data shape
6
+
7
+ - Give each `Scatter` its own `data` array when the series contain different points.
8
+ - `XAxis data-key` and `YAxis data-key` select the numeric coordinates from each flat row.
9
+ - Set `type="number"` on both axes for numeric positioning.
10
+ - Add `ZAxis data-key` only when a third numeric field should control point size.
11
+
12
+ ## Minimal example
13
+
14
+ ```vue
15
+ <script setup lang="ts">
16
+ import { CartesianGrid, Scatter, ScatterChart, Tooltip, XAxis, YAxis, ZAxis } from 'vccs'
17
+
18
+ const data = [
19
+ { hours: 2, score: 62, students: 12 },
20
+ { hours: 4, score: 70, students: 18 },
21
+ { hours: 6, score: 79, students: 16 },
22
+ { hours: 8, score: 85, students: 22 },
23
+ ]
24
+ </script>
25
+
26
+ <template>
27
+ <ScatterChart :height="300">
28
+ <CartesianGrid />
29
+ <XAxis
30
+ data-key="hours"
31
+ type="number"
32
+ />
33
+ <YAxis
34
+ data-key="score"
35
+ type="number"
36
+ />
37
+ <ZAxis
38
+ data-key="students"
39
+ :range="[60, 400]"
40
+ />
41
+ <Tooltip :cursor="false" />
42
+ <Scatter
43
+ name="Classes"
44
+ :data="data"
45
+ fill="#f97316"
46
+ />
47
+ </ScatterChart>
48
+ </template>
49
+ ```
50
+
51
+ Animation is enabled by default; retrieve `ssr-testing` before taking screenshots or asserting exact geometry.
52
+
53
+ ## Chart-specific rules
54
+
55
+ - Put `data` on each `Scatter` for multiple series; set `name` and add `Legend` to distinguish them.
56
+ - `ZAxis range` sets the minimum and maximum dot size; omit `ZAxis` for uniform points.
57
+ - The tooltip shows one point at a time rather than all series at a category.
58
+ - Retrieve `composed-chart` when scatter points must share axes with bars, areas, or lines.
59
+
60
+ ## Related guides
61
+
62
+ `installation`, `vue-api`, `typed-rows`, `ssr-testing`, `line-chart`, `composed-chart`.
@@ -0,0 +1,51 @@
1
+ # Sparkline
2
+
3
+ Use `Sparkline` for a tiny trend inside a KPI tile, table row, or dense dashboard. Use `LineChart` when axes, multiple series, or a larger analytical view matter.
4
+
5
+ ## Data shape
6
+
7
+ - `data` is an ordered array of numbers or object rows.
8
+ - Object rows use `data-key="value"` by default; choose another numeric field with `data-key`.
9
+ - Use `null` for a missing point that should remain a gap.
10
+ - Set `name-key` to a date or another stable identifier when points must keep their identity across updates.
11
+
12
+ ## Minimal example
13
+
14
+ ```vue
15
+ <script setup lang="ts">
16
+ import { Sparkline, Tooltip } from 'vccs'
17
+
18
+ const data = [
19
+ { day: 'Mon', value: 820 },
20
+ { day: 'Tue', value: 932 },
21
+ { day: 'Wed', value: 901 },
22
+ { day: 'Thu', value: 934 },
23
+ { day: 'Fri', value: 1090 },
24
+ { day: 'Sat', value: 1180 },
25
+ ]
26
+ </script>
27
+
28
+ <template>
29
+ <Sparkline
30
+ :data="data"
31
+ name-key="day"
32
+ type="area"
33
+ color="#f97316"
34
+ :height="40"
35
+ >
36
+ <Tooltip :cursor="false" />
37
+ </Sparkline>
38
+ </template>
39
+ ```
40
+
41
+ ## Chart-specific rules
42
+
43
+ - Use `type="line"`, `type="area"`, or `type="bar"`; `gap` and `radius` apply only to bars.
44
+ - Give multiple sparklines the same `min` and `max` when their shapes must be comparable.
45
+ - Use `name-key` for a moving time window; without it, points match by array position.
46
+ - Place `Tooltip` in the default slot, or bind `v-model:active-index` to show the hovered point in your own markup.
47
+ - The component fills its container width and defaults to 32px tall unless you set `height` or `aspect`.
48
+
49
+ ## Related guides
50
+
51
+ `installation`, `vue-api`, `typed-rows`, `ssr-testing`, `line-chart`, `area-chart`.
@@ -0,0 +1,66 @@
1
+ # SunburstChart
2
+
3
+ Use `SunburstChart` for two or three levels of a part-to-whole hierarchy as concentric rings. Use `PieChart` for one flat level and `Treemap` when many leaves need more readable areas and labels.
4
+
5
+ ## Data shape
6
+
7
+ - `data` is one root object, not an array. The root is not drawn; its `children` form the inner ring.
8
+ - Each node has a `name` by default and may have nested `children`.
9
+ - Leaves need a numeric `value`; `data-key` and `name-key` select different fields.
10
+ - Parent values are the sum of their children. A node may also provide `fill`.
11
+
12
+ ## Minimal example
13
+
14
+ ```vue
15
+ <script setup lang="ts">
16
+ import { SunburstChart, Tooltip } from 'vccs'
17
+
18
+ const data = {
19
+ name: 'Traffic',
20
+ children: [
21
+ {
22
+ name: 'Search',
23
+ fill: '#f97316',
24
+ children: [
25
+ { name: 'Google', value: 420 },
26
+ { name: 'Bing', value: 90 },
27
+ ],
28
+ },
29
+ {
30
+ name: 'Social',
31
+ fill: '#14b8a6',
32
+ children: [
33
+ { name: 'LinkedIn', value: 150 },
34
+ { name: 'Mastodon', value: 80 },
35
+ ],
36
+ },
37
+ { name: 'Direct', value: 160, fill: '#f59e0b' },
38
+ ],
39
+ }
40
+ </script>
41
+
42
+ <template>
43
+ <SunburstChart
44
+ :data="data"
45
+ :height="320"
46
+ :inner-radius="40"
47
+ title="Traffic by source"
48
+ >
49
+ <Tooltip :cursor="false" />
50
+ </SunburstChart>
51
+ </template>
52
+ ```
53
+
54
+ Animation is enabled by default; retrieve `ssr-testing` before taking screenshots or asserting exact geometry.
55
+
56
+ ## Chart-specific rules
57
+
58
+ - Give the root at least one child; a root without `children` renders no sectors.
59
+ - Set `fill` on a top-level group to color its branch. A child's own `fill` overrides its branch color.
60
+ - Use `inner-radius` for the center hole and `outer-radius` when the automatic radius does not fit your layout.
61
+ - Use `ring-padding` to separate rings and `padding` to separate sectors by angle.
62
+ - Customize sectors with the `#content` slot, not a function-valued `content` prop.
63
+
64
+ ## Related guides
65
+
66
+ `installation`, `vue-api`, `ssr-testing`, `treemap`, `pie-chart`.