nuxt-charts 3.0.0-beta.2 → 3.0.0-beta.4
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 +99 -8
- package/dist/module.json +1 -1
- package/dist/module.mjs +20 -2
- package/dist/runtime/assets/components.css +1 -1
- package/dist/runtime/assets/theme.css +1 -1
- package/dist/runtime/components/AreaChart.vue +91 -10
- package/dist/runtime/components/AreaChart.vue.d.ts +5 -1
- package/dist/runtime/components/BarChart.vue +132 -9
- package/dist/runtime/components/BarChart.vue.d.ts +5 -1
- package/dist/runtime/components/BubbleChart.vue +114 -27
- package/dist/runtime/components/BubbleChart.vue.d.ts +5 -1
- package/dist/runtime/components/CandlestickChart.vue +60 -18
- package/dist/runtime/components/DonutChart.vue +88 -17
- package/dist/runtime/components/FunnelChart.vue +156 -41
- package/dist/runtime/components/FunnelChart.vue.d.ts +8 -1
- package/dist/runtime/components/LineChart.vue +79 -8
- package/dist/runtime/components/LineChart.vue.d.ts +5 -1
- package/dist/runtime/components/RadarChart.vue +116 -14
- package/dist/runtime/components/RadialBarChart.vue +63 -13
- package/dist/runtime/components/SankeyChart.vue +169 -0
- package/dist/runtime/components/SankeyChart.vue.d.ts +36 -0
- package/dist/runtime/components/StatusTrackerChart.vue +33 -7
- package/dist/runtime/components/internal/AreaVariantDefs.d.ts +68 -0
- package/dist/runtime/components/internal/AreaVariantDefs.js +165 -0
- package/dist/runtime/components/internal/BarVariantDefs.d.ts +74 -0
- package/dist/runtime/components/internal/BarVariantDefs.js +200 -0
- package/dist/runtime/components/internal/CandlestickTooltip.vue +6 -4
- package/dist/runtime/components/internal/CandlestickTooltip.vue.d.ts +1 -0
- package/dist/runtime/components/internal/CartesianFrame.vue +98 -20
- package/dist/runtime/components/internal/CartesianFrame.vue.d.ts +18 -1
- package/dist/runtime/components/internal/ChartAccessibility.vue +20 -0
- package/dist/runtime/components/internal/ChartAccessibility.vue.d.ts +21 -0
- package/dist/runtime/components/internal/ChartBackground.d.ts +44 -0
- package/dist/runtime/components/internal/ChartBackground.js +53 -0
- package/dist/runtime/components/internal/ChartDot.d.ts +85 -0
- package/dist/runtime/components/internal/ChartDot.js +59 -0
- package/dist/runtime/components/internal/ChartEmptyState.vue +12 -0
- package/dist/runtime/components/internal/{ChartLegend.d.vue.ts → ChartEmptyState.vue.d.ts} +2 -6
- package/dist/runtime/components/internal/ChartLegend.vue +11 -3
- package/dist/runtime/components/internal/ChartLegend.vue.d.ts +24 -1
- package/dist/runtime/components/internal/ChartSkeleton.vue +64 -0
- package/dist/runtime/components/internal/ChartSkeleton.vue.d.ts +18 -0
- package/dist/runtime/components/internal/ChartTooltip.vue +10 -3
- package/dist/runtime/components/internal/CubeBarShape.vue +8 -8
- package/dist/runtime/components/internal/CubeBarShape.vue.d.ts +10 -2
- package/dist/runtime/components/internal/FunnelClassicShape.vue +98 -0
- package/dist/runtime/components/internal/FunnelClassicShape.vue.d.ts +81 -0
- package/dist/runtime/components/internal/FunnelLayeredShape.vue +72 -37
- package/dist/runtime/components/internal/FunnelLayeredShape.vue.d.ts +21 -0
- package/dist/runtime/components/internal/FunnelTooltip.vue +27 -0
- package/dist/runtime/components/internal/{CandlestickTooltip.d.vue.ts → FunnelTooltip.vue.d.ts} +11 -12
- package/dist/runtime/components/internal/PolarCenterSync.d.ts +38 -0
- package/dist/runtime/components/internal/PolarCenterSync.js +27 -0
- package/dist/runtime/components/internal/RadarGradientDefs.d.ts +46 -0
- package/dist/runtime/components/internal/RadarGradientDefs.js +46 -0
- package/dist/runtime/components/internal/SegmentVariantDefs.d.ts +67 -0
- package/dist/runtime/components/internal/SegmentVariantDefs.js +51 -0
- package/dist/runtime/components/internal/StrokeGradientDefs.d.ts +36 -0
- package/dist/runtime/components/internal/StrokeGradientDefs.js +35 -0
- package/dist/runtime/components/internal/VariantBarShape.vue +53 -0
- package/dist/runtime/components/internal/VariantBarShape.vue.d.ts +36 -0
- package/dist/runtime/components/internal/tooltipContent.d.ts +13 -0
- package/dist/runtime/components/internal/tooltipContent.js +9 -0
- package/dist/runtime/types/charts.d.ts +236 -46
- package/dist/runtime/types/shared.d.ts +37 -11
- package/dist/runtime/types.d.ts +3 -0
- package/dist/runtime/utils/axis.d.ts +12 -1
- package/dist/runtime/utils/axis.js +23 -0
- package/dist/runtime/utils/background.d.ts +36 -0
- package/dist/runtime/utils/background.js +140 -0
- package/dist/runtime/utils/data.d.ts +19 -0
- package/dist/runtime/utils/data.js +50 -0
- package/dist/runtime/utils/format.d.ts +5 -0
- package/dist/runtime/utils/format.js +12 -0
- package/dist/runtime/utils/gradient.d.ts +8 -0
- package/dist/runtime/utils/gradient.js +3 -0
- package/dist/runtime/utils/index.d.ts +2 -0
- package/dist/runtime/utils/index.js +2 -0
- package/dist/runtime/utils/theme.js +14 -0
- package/dist/runtime/utils/variants.d.ts +101 -0
- package/dist/runtime/utils/variants.js +48 -0
- package/package.json +16 -28
- package/dist/runtime/components/AreaChart.d.vue.ts +0 -19
- package/dist/runtime/components/BarChart.d.vue.ts +0 -19
- package/dist/runtime/components/BubbleChart.d.vue.ts +0 -19
- package/dist/runtime/components/CandlestickChart.d.vue.ts +0 -19
- package/dist/runtime/components/DonutChart.d.vue.ts +0 -21
- package/dist/runtime/components/FunnelChart.d.vue.ts +0 -19
- package/dist/runtime/components/LineChart.d.vue.ts +0 -19
- package/dist/runtime/components/RadarChart.d.vue.ts +0 -19
- package/dist/runtime/components/RadialBarChart.d.vue.ts +0 -19
- package/dist/runtime/components/StatusTrackerChart.d.vue.ts +0 -19
- package/dist/runtime/components/internal/CartesianFrame.d.vue.ts +0 -40
- package/dist/runtime/components/internal/ChartTooltip.d.vue.ts +0 -3
- package/dist/runtime/components/internal/CubeBarShape.d.vue.ts +0 -28
- package/dist/runtime/components/internal/FunnelLayeredShape.d.vue.ts +0 -42
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# nuxt-charts
|
|
2
2
|
|
|
3
|
-
Beautiful chart components for Nuxt — Area, Bar, Line, Donut, Bubble, Radar, Radial Bar, Funnel, Candlestick and Status Tracker.
|
|
3
|
+
Beautiful chart components for Nuxt — Area, Bar, Line, Donut, Bubble, Radar, Radial Bar, Funnel, Sankey, Candlestick and Status Tracker.
|
|
4
4
|
|
|
5
5
|
Powered by [vccs](https://vue-charts.com) (Vue port of Recharts). Drop-in config-prop API from nuxt-charts v2.
|
|
6
6
|
|
|
@@ -21,14 +21,15 @@ export default defineNuxtConfig({
|
|
|
21
21
|
|
|
22
22
|
| Component | Notes |
|
|
23
23
|
|---|---|
|
|
24
|
-
| `AreaChart` | Gradients, dither fills, stacked |
|
|
25
|
-
| `BarChart` | Grouped, stacked, horizontal, cube bars |
|
|
26
|
-
| `LineChart` | Multi-series, curve types |
|
|
24
|
+
| `AreaChart` | Gradients, dither fills, textured fills, stacked |
|
|
25
|
+
| `BarChart` | Grouped, stacked, horizontal, cube bars, patterned fills |
|
|
26
|
+
| `LineChart` | Multi-series, curve types, dashed / animated strokes |
|
|
27
27
|
| `DonutChart` | Center slot for labels |
|
|
28
28
|
| `BubbleChart` | Scatter with size encoding |
|
|
29
29
|
| `RadarChart` | New in v3 |
|
|
30
30
|
| `RadialBarChart` | New in v3 |
|
|
31
31
|
| `FunnelChart` | New in v3 |
|
|
32
|
+
| `SankeyChart` | New in v3 |
|
|
32
33
|
| `CandlestickChart` | New in v3 |
|
|
33
34
|
| `StatusTrackerChart` | New in v3 |
|
|
34
35
|
|
|
@@ -71,10 +72,74 @@ Each axis accepts `orientation`, `label`, `domain`, `numTicks`, `formatter`,
|
|
|
71
72
|
the top-level `yLabel` / `yDomain` / `yAxisConfig` props. Supported on
|
|
72
73
|
`LineChart`, `AreaChart` and `BarChart` (vertical orientation).
|
|
73
74
|
|
|
75
|
+
## Style variants
|
|
76
|
+
|
|
77
|
+
Every treatment below is opt-in — a chart that sets none of them renders exactly
|
|
78
|
+
as it did before. The playground's `/variants` page shows them side by side.
|
|
79
|
+
|
|
80
|
+
### Series fills
|
|
81
|
+
|
|
82
|
+
| Prop | Chart | Values |
|
|
83
|
+
|---|---|---|
|
|
84
|
+
| `variant` | `BarChart` | `solid` (default), `cubes`, `hatched`, `duotone`, `duotone-reverse`, `gradient`, `stripped` |
|
|
85
|
+
| `variant` | `AreaChart` | `gradient`, `gradient-reverse`, `solid`, `dotted`, `lines`, `hatched` |
|
|
86
|
+
| `variant` | `RadarChart` | `filled` (default), `lines`, `gradient` (inside to outside), `gradient-reverse` (outside to inside) |
|
|
87
|
+
| `variant` | `RadialBarChart` | `full` (default), `semi` |
|
|
88
|
+
| `variant` | `DonutChart` | `flat` (default), `gradient` |
|
|
89
|
+
|
|
90
|
+
On `AreaChart` the fill treatments layer over the v2 `gradient` fade and yield to
|
|
91
|
+
`dither`, which is a texture of its own.
|
|
92
|
+
|
|
93
|
+
### Series detail
|
|
94
|
+
|
|
95
|
+
- `strokeVariant` — `solid`, `dashed`, `animated-dashed` (line + area).
|
|
96
|
+
- `dotVariant` — `default`, `border`, `colored-border`, `ping` (line, area,
|
|
97
|
+
radar), sized by `dotSize`.
|
|
98
|
+
- `glow` — a soft outer glow (bar, line, area, donut).
|
|
99
|
+
- `bufferBar` — renders the final bar as a projection: a hollow hatch with an
|
|
100
|
+
outline, for a period that is still accruing.
|
|
101
|
+
- `hoverHighlight` / `maxHighlight` — dim every bar but the hovered one, or the
|
|
102
|
+
tallest.
|
|
103
|
+
- `percent` — with `stacked`, normalise each category to 100% and label the
|
|
104
|
+
value axis as percentages.
|
|
105
|
+
|
|
106
|
+
### Chart chrome
|
|
107
|
+
|
|
108
|
+
- `backgroundPattern` — one of eleven textures painted behind the plot area and
|
|
109
|
+
faded out at the edges: `dots`, `grid`, `cross-hatch`, `diagonal-lines`,
|
|
110
|
+
`plus`, `falling-triangles`, `4-pointed-star`, `tiny-checkers`,
|
|
111
|
+
`overlapping-circles`, `wiggle-lines`, `bubbles`.
|
|
112
|
+
- `legendVariant` — `square`, `circle`, `circle-outline`, `rounded-square`
|
|
113
|
+
(default), `rounded-square-outline`, `vertical-bar`, `horizontal-bar`.
|
|
114
|
+
- `tooltipVariant` (`default`, `frosted-glass`) and `tooltipRoundness`
|
|
115
|
+
(`sm`, `md`, `lg`, `xl`).
|
|
116
|
+
- `loading` — a shimmering placeholder in place of the chart, with the
|
|
117
|
+
silhouette matched to the chart type; `loadingLabel` names or hides its pill.
|
|
118
|
+
- `gridType` on `RadarChart` — `polygon` (default) or `circle`.
|
|
119
|
+
|
|
120
|
+
```vue
|
|
121
|
+
<template>
|
|
122
|
+
<BarChart
|
|
123
|
+
:data="data"
|
|
124
|
+
:categories="categories"
|
|
125
|
+
:y-axis="['desktop']"
|
|
126
|
+
x-axis="month"
|
|
127
|
+
:height="320"
|
|
128
|
+
variant="duotone"
|
|
129
|
+
background-pattern="dots"
|
|
130
|
+
legend-variant="circle"
|
|
131
|
+
tooltip-variant="frosted-glass"
|
|
132
|
+
max-highlight
|
|
133
|
+
/>
|
|
134
|
+
</template>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
The animated stroke and the loading shimmer both stop when the viewer's system
|
|
138
|
+
asks for reduced motion. Every generated SVG paint is scoped to its chart, so
|
|
139
|
+
several charts on one page never collide.
|
|
140
|
+
|
|
74
141
|
### Deferred / removed
|
|
75
142
|
|
|
76
|
-
- **`SankeyChart`** — deferred: the published `vccs` release does not yet export
|
|
77
|
-
a Sankey chart. Returns once `vccs` ships it.
|
|
78
143
|
- **`DualChart`** — planned for v3.1 (maps onto the `vccs` `ComposedChart`).
|
|
79
144
|
- **`GanttChart`, `DagreGraph`, `Maps`** — removed in v3. They were Unovis /
|
|
80
145
|
d3-geo specific and have no `vccs` equivalent.
|
|
@@ -93,17 +158,43 @@ export default defineNuxtConfig({
|
|
|
93
158
|
})
|
|
94
159
|
```
|
|
95
160
|
|
|
161
|
+
## Data safety, accessibility, and limits
|
|
162
|
+
|
|
163
|
+
This package is Nuxt-only. Vue/Vite applications should use the separate
|
|
164
|
+
`vue-chrts` package.
|
|
165
|
+
|
|
166
|
+
All numeric chart input is validated before it reaches a scale or SVG
|
|
167
|
+
attribute. `null`, missing values, `NaN`, and positive/negative infinity are
|
|
168
|
+
treated as gaps; a chart with no valid values shows `emptyLabel` (default:
|
|
169
|
+
`"No valid data"`). Donut, Radial Bar, and Funnel accept record data with
|
|
170
|
+
`nameKey` and `valueKey`; positional numeric arrays remain supported for v2
|
|
171
|
+
compatibility.
|
|
172
|
+
|
|
173
|
+
Every chart accepts `ariaLabel`, `ariaDescription`, and
|
|
174
|
+
`accessibleDataTable`. The visually hidden table is enabled by default and is
|
|
175
|
+
the keyboard/screen-reader equivalent of pointer-only SVG tooltips.
|
|
176
|
+
|
|
177
|
+
SVG charts render at most 2,000 data rows by default. Larger inputs are sampled
|
|
178
|
+
evenly (preserving both endpoints) and emit one development warning. Override
|
|
179
|
+
this with `maxDataPoints`, but use pre-aggregation for genuinely dense data:
|
|
180
|
+
SVG creates DOM work per mark, so raising the limit can block the UI.
|
|
181
|
+
|
|
96
182
|
## Auto-imported enums & types
|
|
97
183
|
|
|
98
184
|
- Enums: `CurveType`, `LegendPosition`, `Orientation`, `DonutType`
|
|
99
185
|
- Types: `AreaChartProps`, `BarChartProps`, `LineChartProps`, `BubbleChartProps`,
|
|
100
186
|
`DonutChartProps`, `RadarChartProps`, `RadialBarChartProps`, `FunnelChartProps`,
|
|
187
|
+
`CandlestickChartProps`,
|
|
188
|
+
`SankeyChartProps`, `SankeyInputNode`, `SankeyInputLink`,
|
|
101
189
|
`StatusTrackerChartProps`, `StatusTrackerDatum`, `BulletLegendItemInterface`,
|
|
102
|
-
`AxisConfig`, `
|
|
190
|
+
`AxisConfig`, `ValueLabel`, `ReferenceLineConfig`, `NumericKeys`
|
|
191
|
+
- Style variant unions: `BarVariant`, `AreaFillVariant`, `StrokeVariant`,
|
|
192
|
+
`DotVariant`, `DitherVariant`, `BackgroundVariant`, `LegendIndicatorVariant`,
|
|
193
|
+
`TooltipVariant`, `TooltipRoundness`, `RadarVariant`, `RadialVariant`
|
|
103
194
|
|
|
104
195
|
## Migrating from v2
|
|
105
196
|
|
|
106
|
-
See the [Upgrade to v3](https://nuxtcharts.com/docs/getting-started/upgrade-to-v3) guide. Specialty charts (maps, gantt, dual,
|
|
197
|
+
See the [Upgrade to v3](https://nuxtcharts.com/docs/getting-started/upgrade-to-v3) guide. Specialty charts (maps, gantt, dual, dagre) are not in v3 yet — stay on `nuxt-charts@2` if you need them.
|
|
107
198
|
|
|
108
199
|
## License
|
|
109
200
|
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -9,6 +9,7 @@ const COMPONENTS = {
|
|
|
9
9
|
RadarChart: "RadarChart",
|
|
10
10
|
RadialBarChart: "RadialBarChart",
|
|
11
11
|
FunnelChart: "FunnelChart",
|
|
12
|
+
SankeyChart: "SankeyChart",
|
|
12
13
|
CandlestickChart: "CandlestickChart",
|
|
13
14
|
StatusTrackerChart: "StatusTrackerChart"
|
|
14
15
|
};
|
|
@@ -47,19 +48,36 @@ const resolveImports = (config, resolverUrl) => {
|
|
|
47
48
|
"RadarChartProps",
|
|
48
49
|
"RadialBarChartProps",
|
|
49
50
|
"FunnelChartProps",
|
|
51
|
+
"FunnelLabelSizes",
|
|
52
|
+
"SankeyChartProps",
|
|
53
|
+
"SankeyInputNode",
|
|
54
|
+
"SankeyInputLink",
|
|
55
|
+
"SankeyNodeAlign",
|
|
50
56
|
"CandlestickChartProps",
|
|
51
57
|
"StatusTrackerChartProps",
|
|
52
58
|
"StatusTrackerDatum",
|
|
53
59
|
"BulletLegendItemInterface",
|
|
54
60
|
"AxisConfig",
|
|
55
|
-
"TooltipConfig",
|
|
56
61
|
"ValueLabel",
|
|
57
62
|
"ReferenceLineConfig",
|
|
58
63
|
// v2 parity: these auto-imported in nuxt-charts v2. The types still exist
|
|
59
64
|
// (MarkerConfig drives line/area dot rendering; CrosshairConfig is inert
|
|
60
65
|
// but kept so old templates type-check), so keep them auto-importable.
|
|
61
66
|
"MarkerConfig",
|
|
62
|
-
"CrosshairConfig"
|
|
67
|
+
"CrosshairConfig",
|
|
68
|
+
// Style variant unions, so a consumer can annotate a variant it stores or
|
|
69
|
+
// passes around instead of widening it to `string`.
|
|
70
|
+
"BarVariant",
|
|
71
|
+
"AreaFillVariant",
|
|
72
|
+
"StrokeVariant",
|
|
73
|
+
"DotVariant",
|
|
74
|
+
"DitherVariant",
|
|
75
|
+
"BackgroundVariant",
|
|
76
|
+
"LegendIndicatorVariant",
|
|
77
|
+
"TooltipVariant",
|
|
78
|
+
"TooltipRoundness",
|
|
79
|
+
"RadarVariant",
|
|
80
|
+
"RadialVariant"
|
|
63
81
|
]
|
|
64
82
|
});
|
|
65
83
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer vue-chrts{.vc-tooltip{background:var(--vc-tooltip-bg,oklch(1 0 0));border:1px solid var(--vc-tooltip-border,oklch(.922 0 0));border-radius:var(--vc-tooltip-radius,.5rem);box-shadow:var(--vc-tooltip-shadow,0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1));font-size:var(--vc-legend-size,.75rem);line-height:1.5;min-width:8rem;padding:var(--vc-tooltip-padding,.375rem .625rem);pointer-events:none}.vc-tooltip
|
|
1
|
+
@layer vue-chrts{.vc-tooltip{background:var(--vc-tooltip-bg,oklch(1 0 0));border:1px solid var(--vc-tooltip-border,oklch(.922 0 0));border-radius:var(--vc-tooltip-radius,.5rem);box-shadow:var(--vc-tooltip-shadow,0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1));color:var(--vc-tooltip-fg,oklch(.205 0 0));font-size:var(--vc-legend-size,.75rem);line-height:1.5;min-width:8rem;padding:var(--vc-tooltip-padding,.375rem .625rem);pointer-events:none}.vc-tooltip--frosted-glass{backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);background:color-mix(in oklab,var(--vc-tooltip-bg,oklch(1 0 0)) 70%,transparent)}.vc-tooltip--sm{border-radius:.125rem}.vc-tooltip--md{border-radius:.375rem}.vc-tooltip--lg{border-radius:.5rem}.vc-tooltip--xl{border-radius:.75rem}.vc-tooltip__label{color:var(--vc-tooltip-fg,oklch(.205 0 0));font-weight:500;margin:0 0 .25rem}.vc-tooltip__list{display:flex;flex-direction:column;gap:.125rem;list-style:none;margin:0;padding:0}.vc-tooltip__item{align-items:center;display:flex;gap:.375rem}.vc-tooltip__dot{border-radius:9999px;display:inline-block;flex-shrink:0;height:.5rem;width:.5rem}.vc-tooltip__name{color:var(--vc-tooltip-muted,oklch(.556 0 0))}.vc-tooltip__value{color:var(--vc-tooltip-fg,oklch(.205 0 0));font-variant-numeric:tabular-nums;font-weight:500;margin-left:auto}.vc-legend{flex-wrap:wrap;font-size:var(--vc-legend-size,.75rem);font-weight:var(--vc-legend-weight,400);gap:var(--vc-legend-gap,.75rem);justify-content:center;line-height:1.5;list-style:none;margin:0;padding:0}.vc-legend,.vc-legend__item{align-items:center;display:flex}.vc-legend__item{gap:.375rem}.vc-legend__item--inactive{opacity:.4}.vc-legend__dot{border-radius:9999px;display:inline-block;flex-shrink:0;height:var(--vc-legend-dot-size,.5rem);width:var(--vc-legend-dot-size,.5rem)}.vc-legend__dot--square{border-radius:0}.vc-legend__dot--rounded-square{border-radius:2px}.vc-legend__dot--circle{border-radius:9999px}.vc-legend__dot--vertical-bar{border-radius:2px;height:calc(var(--vc-legend-dot-size, .5rem)*1.5);width:calc(var(--vc-legend-dot-size, .5rem)*.5)}.vc-legend__dot--horizontal-bar{border-radius:2px;height:calc(var(--vc-legend-dot-size, .5rem)*.5);width:calc(var(--vc-legend-dot-size, .5rem)*1.5)}.vc-legend__dot--circle-outline,.vc-legend__dot--rounded-square-outline{box-sizing:border-box;height:calc(var(--vc-legend-dot-size, .5rem)*1.25);-webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);-webkit-mask-composite:xor;mask-composite:exclude;padding:1.5px;width:calc(var(--vc-legend-dot-size, .5rem)*1.25)}.vc-legend__dot--circle-outline{border-radius:9999px}.vc-legend__dot--rounded-square-outline{border-radius:3px}.vc-legend__label{color:var(--vc-legend-color,oklch(.556 0 0))}.vc-skeleton{align-items:stretch;box-sizing:border-box;color:var(--vc-tick-color,oklch(.556 0 0));display:flex;overflow:hidden;padding:8% 4%;position:relative;width:100%}.vc-skeleton__bars{align-items:flex-end;display:flex;gap:2%;height:100%;width:100%}.vc-skeleton__bar{background:currentColor;border-radius:2px 2px 0 0;flex:1;opacity:.14}.vc-skeleton__wave{height:100%;opacity:.14;width:100%}.vc-skeleton__ring{aspect-ratio:1;border:1.75rem solid;border-radius:9999px;height:100%;margin:auto;opacity:.14}.vc-skeleton__shimmer{animation:vc-skeleton-sweep 1.8s linear infinite;background:linear-gradient(105deg,transparent 35%,currentColor 50%,transparent 65%);inset:0;opacity:.1;position:absolute}@keyframes vc-skeleton-sweep{0%{transform:translateX(-100%)}to{transform:translateX(100%)}}.vc-skeleton__pill{align-items:center;background:var(--vc-surface-bg,oklch(1 0 0));border:1px solid var(--vc-tooltip-border,oklch(.922 0 0));border-radius:.375rem;color:var(--vc-tick-color,oklch(.556 0 0));display:flex;font-size:var(--vc-legend-size,.75rem);gap:.375rem;height:-moz-fit-content;height:fit-content;inset:0;line-height:1.5;margin:auto;padding:.125rem .5rem;position:absolute;width:-moz-fit-content;width:fit-content}.vc-skeleton__spinner{animation:vc-skeleton-spin .7s linear infinite;border:1px solid var(--vc-tooltip-border,oklch(.922 0 0));border-radius:9999px;border-top:1px solid;height:.75rem;width:.75rem}@keyframes vc-skeleton-spin{to{transform:rotate(1turn)}}@media (prefers-reduced-motion:reduce){.vc-skeleton__shimmer,.vc-skeleton__spinner{animation:none}}.vc-candlestick-chart{cursor:crosshair;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%}.vc-candlestick-chart__svg{display:block;overflow:visible;width:100%}.vc-funnel-layered{position:relative;width:100%}.vc-funnel{position:relative}.vc-funnel-layered__tooltip{align-items:center;background:var(--vc-tooltip-bg,oklch(1 0 0));border:1px solid var(--vc-tooltip-border,oklch(.922 0 0));border-radius:var(--vc-tooltip-radius,.5rem);box-shadow:var(--vc-tooltip-shadow,0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1));color:var(--vc-tooltip-fg,oklch(.205 0 0));display:flex;font-size:var(--vc-legend-size,.75rem);gap:.375rem;padding:var(--vc-tooltip-padding,.375rem .625rem);pointer-events:none;position:absolute;transform:translate(-50%,calc(-100% - 10px));white-space:nowrap}.vc-funnel-layered__name{color:var(--vc-tooltip-muted,oklch(.556 0 0))}.vc-funnel-layered__value{font-variant-numeric:tabular-nums;font-weight:600}.vc-funnel-layered__dot{border-radius:9999px;display:inline-block;flex-shrink:0;height:var(--vc-legend-dot-size,.5rem);width:var(--vc-legend-dot-size,.5rem)}.vc-funnel-layered-shape{opacity:.96;transition:opacity .15s}.vc-funnel-layered-shape:hover{opacity:1}.vc-funnel .v-charts-label-list .v-charts-label{fill:var(--vc-funnel-value-color,oklch(.205 0 0));font-size:var(--vc-funnel-value-size,.75rem);font-variant-numeric:tabular-nums;font-weight:var(--vc-funnel-value-weight,600)}.vc-funnel-classic-shape{cursor:default}.vc-funnel-classic-shape__shadow{opacity:var(--vc-funnel-shadow-opacity,.16)}.vc-funnel-classic-shape__body{opacity:var(--vc-funnel-shape-opacity,.92);transition:opacity .15s ease}.vc-funnel-classic-shape__highlight{fill:none;stroke:hsla(0,0%,100%,.24);stroke-width:1;vector-effect:non-scaling-stroke}.vc-funnel-classic-shape:hover .vc-funnel-classic-shape__body{opacity:var(--vc-funnel-shape-hover-opacity,1)}.vc-funnel-classic-shape__name,.vc-funnel-classic-shape__value{font-family:inherit;paint-order:stroke;pointer-events:none;stroke:rgba(0,0,0,.12);stroke-linejoin:round;stroke-width:2px;-webkit-user-select:none;-moz-user-select:none;user-select:none}.vc-funnel-classic-shape__value{fill:var(--vc-funnel-inside-value-color,#fff);font-variant-numeric:tabular-nums}.vc-funnel-classic-shape__name{fill:var(--vc-funnel-inside-label-color,#fff);opacity:.78}.vc-funnel-layered-shape__divider{stroke:var(--vc-surface-bg,oklch(1 0 0))}.vc-funnel-layered-shape__badge-text,.vc-funnel-layered-shape__name,.vc-funnel-layered-shape__value{font-family:inherit;pointer-events:none;stroke:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.vc-funnel-layered-shape__value{fill:var(--vc-funnel-value-color,var(--vc-axis-label-color,oklch(.205 0 0)));font-variant-numeric:tabular-nums;font-weight:var(--vc-funnel-value-weight,600)}.vc-funnel-layered-shape__badge{fill:var(--vc-funnel-badge-bg,var(--vc-surface-bg,oklch(1 0 0)));fill-opacity:var(--vc-funnel-badge-opacity,.82);stroke:var(--vc-funnel-badge-border,var(--vc-axis-line-color,oklch(.922 0 0)));stroke-opacity:.7}.vc-funnel-layered-shape__badge-text{fill:var(--vc-funnel-badge-color,var(--vc-tick-color,oklch(.556 0 0)));font-variant-numeric:tabular-nums;font-weight:var(--vc-funnel-badge-weight,600)}.vc-funnel-layered-shape__name{fill:var(--vc-funnel-label-color,var(--vc-tick-color,oklch(.556 0 0)));font-weight:var(--vc-funnel-label-weight,500)}.vc-status-tracker{color:var(--vc-axis-label-color,var(--ui-text-highlighted,var(--foreground,oklch(.205 0 0))));font-family:inherit;width:100%}.vc-status-tracker__header{align-items:baseline;display:flex;gap:1rem;justify-content:space-between;margin-bottom:.75rem}.vc-status-tracker__summary,.vc-status-tracker__title{font-size:.875rem;line-height:1.25rem;margin:0}.vc-status-tracker__title{font-weight:600}.vc-status-tracker__summary{color:var(--vc-tick-color,var(--ui-text-muted,var(--muted-foreground,oklch(.556 0 0))));font-variant-numeric:tabular-nums}.vc-status-tracker__track{display:flex;overflow:hidden;width:100%}.vc-status-tracker__bar{display:block;flex:0 0 auto;height:100%;min-width:1px;transition:opacity .16s ease}.vc-status-tracker__bar:hover{opacity:.78}.vc-status-tracker__bar--rounded-start{border-bottom-left-radius:.25rem;border-top-left-radius:.25rem}.vc-status-tracker__bar--rounded-end{border-bottom-right-radius:.25rem;border-top-right-radius:.25rem}.vc-status-tracker__bar--empty:hover{opacity:1}.vc-status-tracker__labels{gap:1rem;justify-content:space-between;margin-top:.5rem}.vc-status-tracker__labels,.vc-status-tracker__legend{color:var(--vc-legend-color,oklch(.556 0 0));display:flex;font-size:var(--vc-legend-size,.75rem);line-height:1rem}.vc-status-tracker__legend{flex-wrap:wrap;gap:.5rem 1rem;list-style:none;margin:var(--vc-legend-inset,.75rem) 0 0;padding:0}.vc-status-tracker__legend-item{align-items:center;display:inline-flex;gap:.375rem}.vc-status-tracker__legend-dot{border-radius:9999px;flex:0 0 auto;height:var(--vc-legend-dot-size,.5rem);width:var(--vc-legend-dot-size,.5rem)}}.vc-sr-only{height:1px!important;margin:-1px!important;overflow:hidden!important;padding:0!important;position:absolute!important;width:1px!important;clip:rect(0,0,0,0)!important;border:0!important;white-space:nowrap!important}.vc-empty-state{color:var(--vc-tick-color);display:grid;font-size:var(--vc-legend-size);place-items:center}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer vue-chrts{.vue-chrts{--vc-grid-color:var(--ui-border,var(--border,oklch(0.922 0 0)));--vc-grid-dash:3 3;--vc-grid-width:1px;--vc-axis-line-color:var(--ui-border,var(--border,oklch(0.922 0 0)));--vc-axis-line-width:1px;--vc-surface-bg:var(--ui-bg,var(--background,oklch(1 0 0)));--vc-legend-size:0.75rem;--vc-legend-weight:400;--vc-tick-color:var(--ui-text-muted,var(--muted-foreground,oklch(0.556 0 0)));--vc-tick-size:var(--vc-legend-size);--vc-tick-weight:var(--vc-legend-weight);--vc-axis-label-color:var(--ui-text-highlighted,var(--foreground,oklch(0.205 0 0)));--vc-axis-label-size:var(--vc-legend-size);--vc-axis-label-weight:500}.vue-chrts .v-charts-cartesian-axis .v-charts-label{fill:var(--vc-axis-label-color);font-size:var(--vc-axis-label-size);font-weight:var(--vc-axis-label-weight)}.vue-chrts{--vc-legend-gap:0.75rem;--vc-legend-inset:0.75rem;--vc-legend-color:var(--ui-text-muted,var(--muted-foreground,oklch(0.556 0 0)));--vc-legend-dot-size:0.5rem;--vc-hover-fill:color-mix(in oklab,var(--ui-text-highlighted,var(--foreground,oklch(0.205 0 0))) 6%,transparent);--vc-hover-stroke:transparent;--vc-hover-radius:6px;--vc-tooltip-bg:var(--ui-bg,var(--popover,oklch(1 0 0)));--vc-tooltip-fg:var(--ui-text-highlighted,var(--popover-foreground,oklch(0.205 0 0)));--vc-tooltip-muted:var(--ui-text-muted,var(--muted-foreground,oklch(0.556 0 0)));--vc-tooltip-border:var(--ui-border,var(--border,oklch(0.922 0 0)));--vc-tooltip-radius:0.5rem;--vc-tooltip-padding:0.375rem 0.625rem;--vc-tooltip-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1)}.vue-chrts .v-charts-xAxis .v-charts-cartesian-axis-tick-value{fill:var(--vc-x-tick-color,var(--vc-tick-color));font-size:var(--vc-x-tick-size,var(--vc-tick-size));font-weight:var(--vc-x-tick-weight,var(--vc-tick-weight))}.vue-chrts .v-charts-yAxis .v-charts-cartesian-axis-tick-value{fill:var(--vc-y-tick-color,var(--vc-tick-color));font-size:var(--vc-y-tick-size,var(--vc-tick-size));font-weight:var(--vc-y-tick-weight,var(--vc-tick-weight))}.vue-chrts .v-charts-polar-angle-axis-tick-value,.vue-chrts .v-charts-polar-radius-axis-tick-value{fill:var(--vc-tick-color);font-size:var(--vc-tick-size);font-weight:var(--vc-tick-weight)}.vue-chrts:is(.dark,[data-theme=dark],.dark *,[data-theme=dark] *),:is(.dark,[data-theme=dark]) .vue-chrts{--vc-grid-color:var(--ui-border,var(--border,oklch(0.269 0 0)));--vc-axis-line-color:var(--ui-border,var(--border,oklch(0.269 0 0)));--vc-surface-bg:var(--ui-bg,var(--background,oklch(0.145 0 0)));--vc-tick-color:var(--ui-text-muted,var(--muted-foreground,oklch(0.708 0 0)));--vc-axis-label-color:var(--ui-text-highlighted,var(--foreground,oklch(0.985 0 0)));--vc-legend-color:var(--ui-text-muted,var(--muted-foreground,oklch(0.708 0 0)));--vc-hover-fill:color-mix(in oklab,var(--ui-text-highlighted,oklch(0.985 0 0)) 8%,transparent);--vc-tooltip-bg:var(--ui-bg,var(--popover,oklch(0.205 0 0)));--vc-tooltip-fg:var(--ui-text-highlighted,var(--popover-foreground,oklch(0.985 0 0)));--vc-tooltip-muted:var(--ui-text-muted,var(--muted-foreground,oklch(0.708 0 0)));--vc-tooltip-border:var(--ui-border,var(--border,oklch(0.269 0 0)))}}
|
|
1
|
+
@layer vue-chrts{.vue-chrts :focus,.vue-chrts :focus-visible,.vue-chrts:focus,.vue-chrts:focus-visible{outline:none}.vue-chrts{--vc-grid-color:var(--ui-border,var(--border,oklch(0.922 0 0)));--vc-grid-dash:3 3;--vc-grid-width:1px;--vc-axis-line-color:var(--ui-border,var(--border,oklch(0.922 0 0)));--vc-axis-line-width:1px;--vc-surface-bg:var(--ui-bg,var(--background,oklch(1 0 0)));--vc-reference-line-color:var(--ui-text-muted,var(--muted-foreground,oklch(0.556 0 0)));--vc-candle-up:var(--ui-success,oklch(0.696 0.17 162.48));--vc-candle-down:var(--ui-error,oklch(0.637 0.237 25.331));--vc-bg-pattern-color:var(--vc-grid-color);--vc-legend-size:0.75rem;--vc-legend-weight:400;--vc-tick-color:var(--ui-text-muted,var(--muted-foreground,oklch(0.556 0 0)));--vc-tick-size:var(--vc-legend-size);--vc-tick-weight:var(--vc-legend-weight);--vc-axis-label-color:var(--ui-text-highlighted,var(--foreground,oklch(0.205 0 0)));--vc-axis-label-size:var(--vc-legend-size);--vc-axis-label-weight:500}.vue-chrts .v-charts-cartesian-axis .v-charts-label{fill:var(--vc-axis-label-color);font-size:var(--vc-axis-label-size);font-weight:var(--vc-axis-label-weight)}.vue-chrts{--vc-legend-gap:0.75rem;--vc-legend-inset:0.75rem;--vc-legend-color:var(--ui-text-muted,var(--muted-foreground,oklch(0.556 0 0)));--vc-legend-dot-size:0.5rem;--vc-funnel-value-size:var(--vc-legend-size);--vc-funnel-value-color:var(--vc-axis-label-color);--vc-funnel-value-weight:600;--vc-funnel-label-color:var(--vc-tick-color);--vc-funnel-label-weight:500;--vc-funnel-badge-bg:var(--vc-surface-bg);--vc-funnel-badge-color:var(--vc-tick-color);--vc-funnel-badge-border:var(--vc-axis-line-color);--vc-funnel-badge-weight:600;--vc-funnel-badge-opacity:0.82;--vc-hover-fill:color-mix(in oklab,var(--ui-text-highlighted,var(--foreground,oklch(0.205 0 0))) 6%,transparent);--vc-hover-stroke:transparent;--vc-hover-radius:6px;--vc-tooltip-bg:var(--ui-bg,var(--popover,oklch(1 0 0)));--vc-tooltip-fg:var(--ui-text-highlighted,var(--popover-foreground,oklch(0.205 0 0)));--vc-tooltip-muted:var(--ui-text-muted,var(--muted-foreground,oklch(0.556 0 0)));--vc-tooltip-border:var(--ui-border,var(--border,oklch(0.922 0 0)));--vc-tooltip-radius:0.5rem;--vc-tooltip-padding:0.375rem 0.625rem;--vc-tooltip-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1)}.vue-chrts .v-charts-xAxis .v-charts-cartesian-axis-tick-value{fill:var(--vc-x-tick-color,var(--vc-tick-color));font-size:var(--vc-x-tick-size,var(--vc-tick-size));font-weight:var(--vc-x-tick-weight,var(--vc-tick-weight))}.vue-chrts .v-charts-yAxis .v-charts-cartesian-axis-tick-value{fill:var(--vc-y-tick-color,var(--vc-tick-color));font-size:var(--vc-y-tick-size,var(--vc-tick-size));font-weight:var(--vc-y-tick-weight,var(--vc-tick-weight))}.vue-chrts .v-charts-polar-angle-axis-tick-value,.vue-chrts .v-charts-polar-radius-axis-tick-value{fill:var(--vc-tick-color);font-size:var(--vc-tick-size);font-weight:var(--vc-tick-weight)}.vue-chrts.vc-dash-animated .v-charts-area-curve,.vue-chrts.vc-dash-animated .v-charts-line-curve{animation:vc-dash-march 1s linear infinite}@keyframes vc-dash-march{to{stroke-dashoffset:-6}}@media (prefers-reduced-motion:reduce){.vue-chrts.vc-dash-animated .v-charts-area-curve,.vue-chrts.vc-dash-animated .v-charts-line-curve{animation:none}}.vue-chrts:is(.dark,[data-theme=dark],.dark *,[data-theme=dark] *),:is(.dark,[data-theme=dark]) .vue-chrts{--vc-grid-color:var(--ui-border,var(--border,oklch(0.269 0 0)));--vc-axis-line-color:var(--ui-border,var(--border,oklch(0.269 0 0)));--vc-surface-bg:var(--ui-bg,var(--background,oklch(0.145 0 0)));--vc-tick-color:var(--ui-text-muted,var(--muted-foreground,oklch(0.708 0 0)));--vc-axis-label-color:var(--ui-text-highlighted,var(--foreground,oklch(0.985 0 0)));--vc-legend-color:var(--ui-text-muted,var(--muted-foreground,oklch(0.708 0 0)));--vc-hover-fill:color-mix(in oklab,var(--ui-text-highlighted,oklch(0.985 0 0)) 8%,transparent);--vc-tooltip-bg:var(--ui-bg,var(--popover,oklch(0.205 0 0)));--vc-tooltip-fg:var(--ui-text-highlighted,var(--popover-foreground,oklch(0.985 0 0)));--vc-tooltip-muted:var(--ui-text-muted,var(--muted-foreground,oklch(0.708 0 0)));--vc-tooltip-border:var(--ui-border,var(--border,oklch(0.269 0 0)))}}
|
|
@@ -3,12 +3,16 @@ import { computed, useId } from "vue";
|
|
|
3
3
|
import { Area, AreaChart as VccsAreaChart } from "vccs";
|
|
4
4
|
import CartesianFrame from "./internal/CartesianFrame.vue";
|
|
5
5
|
import GradientDefs from "./internal/GradientDefs";
|
|
6
|
+
import StrokeGradientDefs from "./internal/StrokeGradientDefs";
|
|
6
7
|
import { categoriesToSeries } from "../utils/categories";
|
|
7
8
|
import { curveTypeToVccs } from "../utils/curve";
|
|
8
9
|
import { markerToDot, normalizeMarkerConfig, toStrokeDasharray } from "../utils/marker";
|
|
9
|
-
import { DEFAULT_GRADIENT_STOPS, gradientId } from "../utils/gradient";
|
|
10
|
+
import { DEFAULT_GRADIENT_STOPS, gradientId, strokeGradientId } from "../utils/gradient";
|
|
10
11
|
import DitherDefs from "./internal/DitherDefs";
|
|
12
|
+
import AreaVariantDefs, { areaFillId } from "./internal/AreaVariantDefs";
|
|
13
|
+
import ChartDot from "./internal/ChartDot";
|
|
11
14
|
import { ditherId } from "../utils/dither";
|
|
15
|
+
import { strokeDasharrayFor, variantId } from "../utils/variants";
|
|
12
16
|
const props = defineProps({
|
|
13
17
|
xAxis: { type: null, required: false },
|
|
14
18
|
curveType: { type: String, required: false },
|
|
@@ -19,9 +23,16 @@ const props = defineProps({
|
|
|
19
23
|
ditherTile: { type: Number, required: false },
|
|
20
24
|
ditherWash: { type: Number, required: false },
|
|
21
25
|
lineWidth: { type: Number, required: false },
|
|
26
|
+
strokeGradient: { type: Array, required: false },
|
|
22
27
|
stacked: { type: Boolean, required: false },
|
|
28
|
+
percent: { type: Boolean, required: false },
|
|
23
29
|
lineDashArray: { type: [Array, String], required: false },
|
|
24
30
|
markerConfig: { type: Object, required: false },
|
|
31
|
+
variant: { type: String, required: false },
|
|
32
|
+
strokeVariant: { type: String, required: false },
|
|
33
|
+
dotVariant: { type: String, required: false },
|
|
34
|
+
dotSize: { type: Number, required: false },
|
|
35
|
+
glow: { type: Boolean, required: false },
|
|
25
36
|
data: { type: Array, required: true },
|
|
26
37
|
height: { type: Number, required: true },
|
|
27
38
|
xLabel: { type: String, required: false },
|
|
@@ -51,14 +62,25 @@ const props = defineProps({
|
|
|
51
62
|
xAxisConfig: { type: Object, required: false },
|
|
52
63
|
yAxisConfig: { type: Object, required: false },
|
|
53
64
|
yAxes: { type: Object, required: false },
|
|
54
|
-
tooltip: { type: Object, required: false },
|
|
55
65
|
referenceLines: { type: Array, required: false },
|
|
56
66
|
syncId: { type: String, required: false },
|
|
57
67
|
minMaxTicksOnly: { type: Boolean, required: false },
|
|
58
68
|
xExplicitTicks: { type: Array, required: false },
|
|
59
69
|
yExplicitTicks: { type: Array, required: false },
|
|
60
70
|
crosshairConfig: { type: Object, required: false },
|
|
61
|
-
theme: { type: Object, required: false }
|
|
71
|
+
theme: { type: Object, required: false },
|
|
72
|
+
backgroundPattern: { type: String, required: false },
|
|
73
|
+
ariaLabel: { type: String, required: false },
|
|
74
|
+
ariaDescription: { type: String, required: false },
|
|
75
|
+
accessibleDataTable: { type: Boolean, required: false, default: true },
|
|
76
|
+
maxDataPoints: { type: Number, required: false },
|
|
77
|
+
emptyLabel: { type: String, required: false },
|
|
78
|
+
error: { type: String, required: false },
|
|
79
|
+
legendVariant: { type: String, required: false },
|
|
80
|
+
tooltipVariant: { type: String, required: false },
|
|
81
|
+
tooltipRoundness: { type: String, required: false },
|
|
82
|
+
loading: { type: Boolean, required: false },
|
|
83
|
+
loadingLabel: { type: String, required: false }
|
|
62
84
|
});
|
|
63
85
|
const gradientScope = useId();
|
|
64
86
|
const markers = computed(() => normalizeMarkerConfig(props.markerConfig));
|
|
@@ -70,16 +92,21 @@ const series = computed(
|
|
|
70
92
|
);
|
|
71
93
|
const curve = computed(() => curveTypeToVccs(props.curveType));
|
|
72
94
|
const stackId = computed(() => props.stacked ? "stack" : void 0);
|
|
95
|
+
const chartContainerProps = computed(
|
|
96
|
+
() => props.stacked && props.percent ? { stackOffset: "expand" } : {}
|
|
97
|
+
);
|
|
73
98
|
const fillOpacity = computed(() => props.hideArea ? 0 : 0.6);
|
|
74
|
-
const dashArray = computed(() => toStrokeDasharray(props.lineDashArray));
|
|
75
99
|
const useDither = computed(
|
|
76
100
|
() => !props.hideArea && props.dither !== void 0 && props.dither !== false
|
|
77
101
|
);
|
|
78
102
|
const ditherVariant = computed(
|
|
79
103
|
() => typeof props.dither === "string" ? props.dither : "bayer"
|
|
80
104
|
);
|
|
105
|
+
const useFillVariant = computed(
|
|
106
|
+
() => !props.hideArea && props.variant !== void 0 && !useDither.value
|
|
107
|
+
);
|
|
81
108
|
const useGradientFill = computed(
|
|
82
|
-
() => !props.hideArea && props.gradient !== false && !useDither.value
|
|
109
|
+
() => !props.hideArea && props.gradient !== false && !useDither.value && !useFillVariant.value
|
|
83
110
|
);
|
|
84
111
|
const useDitherFade = computed(
|
|
85
112
|
() => useDither.value && props.gradient !== false
|
|
@@ -96,16 +123,45 @@ const ditherWashStops = computed(() => {
|
|
|
96
123
|
stopOpacity: stop.stopOpacity * scale
|
|
97
124
|
}));
|
|
98
125
|
});
|
|
126
|
+
const paintedSeries = computed(
|
|
127
|
+
() => series.value.map((s) => ({ dataKey: s.dataKey, color: s.color }))
|
|
128
|
+
);
|
|
99
129
|
function fillFor(dataKey, color) {
|
|
100
130
|
if (useDither.value) return `url(#${ditherId(dataKey, gradientScope)})`;
|
|
131
|
+
if (useFillVariant.value) return `url(#${areaFillId(props.variant, dataKey, gradientScope)})`;
|
|
101
132
|
if (useGradientFill.value) return `url(#${gradientId(dataKey, gradientScope)})`;
|
|
102
133
|
return color;
|
|
103
134
|
}
|
|
135
|
+
function strokeFor(dataKey, color) {
|
|
136
|
+
return props.strokeGradient?.length ? `url(#${strokeGradientId(dataKey, gradientScope)})` : color;
|
|
137
|
+
}
|
|
138
|
+
function glowFor(dataKey) {
|
|
139
|
+
return props.glow ? `url(#${variantId("glow", dataKey, gradientScope)})` : void 0;
|
|
140
|
+
}
|
|
141
|
+
const dashArray = computed(
|
|
142
|
+
() => toStrokeDasharray(props.lineDashArray) ?? strokeDasharrayFor(props.strokeVariant)
|
|
143
|
+
);
|
|
144
|
+
const frameClass = computed(
|
|
145
|
+
() => props.strokeVariant === "animated-dashed" ? "vc-dash-animated" : void 0
|
|
146
|
+
);
|
|
147
|
+
const showDots = computed(() => props.dotVariant !== void 0);
|
|
104
148
|
const xAxisKey = computed(() => props.xAxis !== void 0 ? String(props.xAxis) : void 0);
|
|
149
|
+
defineSlots();
|
|
105
150
|
</script>
|
|
106
151
|
|
|
107
152
|
<template>
|
|
108
|
-
<CartesianFrame
|
|
153
|
+
<CartesianFrame
|
|
154
|
+
:container="VccsAreaChart"
|
|
155
|
+
:x-axis-key="xAxisKey"
|
|
156
|
+
:container-props="chartContainerProps"
|
|
157
|
+
:percent-axis="stacked === true && percent === true"
|
|
158
|
+
:frame-class="frameClass"
|
|
159
|
+
skeleton-shape="wave"
|
|
160
|
+
v-bind="props"
|
|
161
|
+
>
|
|
162
|
+
<template v-if="$slots.tooltip" #tooltip="scope">
|
|
163
|
+
<slot name="tooltip" v-bind="scope" />
|
|
164
|
+
</template>
|
|
109
165
|
<!--
|
|
110
166
|
GradientDefs builds SVG nodes with `h()` so they land in the SVG namespace
|
|
111
167
|
inside the chart surface. Do not wrap this in vccs `<Customized>`: that
|
|
@@ -118,6 +174,12 @@ const xAxisKey = computed(() => props.xAxis !== void 0 ? String(props.xAxis) : v
|
|
|
118
174
|
:stops="gradientStops"
|
|
119
175
|
:scope="gradientScope"
|
|
120
176
|
/>
|
|
177
|
+
<StrokeGradientDefs
|
|
178
|
+
v-if="strokeGradient?.length"
|
|
179
|
+
:series="paintedSeries"
|
|
180
|
+
:stops="strokeGradient"
|
|
181
|
+
:scope="gradientScope"
|
|
182
|
+
/>
|
|
121
183
|
<!-- Same namespace/`Customized` constraints as GradientDefs above. -->
|
|
122
184
|
<DitherDefs
|
|
123
185
|
v-if="useDither"
|
|
@@ -128,6 +190,13 @@ const xAxisKey = computed(() => props.xAxis !== void 0 ? String(props.xAxis) : v
|
|
|
128
190
|
:fade-stops="ditherWashStops"
|
|
129
191
|
:height="height"
|
|
130
192
|
/>
|
|
193
|
+
<AreaVariantDefs
|
|
194
|
+
v-if="useFillVariant || glow"
|
|
195
|
+
:series="paintedSeries"
|
|
196
|
+
:variant="useFillVariant ? variant : void 0"
|
|
197
|
+
:scope="gradientScope"
|
|
198
|
+
:glow="glow === true"
|
|
199
|
+
/>
|
|
131
200
|
<Area
|
|
132
201
|
v-for="s in series"
|
|
133
202
|
:key="s.dataKey"
|
|
@@ -136,14 +205,26 @@ const xAxisKey = computed(() => props.xAxis !== void 0 ? String(props.xAxis) : v
|
|
|
136
205
|
:y-axis-id="s.yAxisId"
|
|
137
206
|
:type="curve"
|
|
138
207
|
:stack-id="stackId"
|
|
139
|
-
:stroke="s.color"
|
|
208
|
+
:stroke="strokeFor(s.dataKey, s.color)"
|
|
140
209
|
:fill="fillFor(s.dataKey, s.color)"
|
|
141
|
-
:fill-opacity="useGradientFill || useDither ? 1 : fillOpacity"
|
|
210
|
+
:fill-opacity="useGradientFill || useDither || useFillVariant ? 1 : fillOpacity"
|
|
142
211
|
:stroke-width="lineWidth ?? 2"
|
|
143
212
|
:stroke-dasharray="dashArray"
|
|
144
|
-
:
|
|
213
|
+
:filter="glowFor(s.dataKey)"
|
|
214
|
+
:dot="showDots || s.dot"
|
|
145
215
|
:hide="s.hidden"
|
|
146
216
|
:is-animation-active="duration !== void 0 && duration !== 0"
|
|
147
|
-
|
|
217
|
+
:transition="{ duration: (duration ?? 800) / 1e3, ease: 'easeOut' }"
|
|
218
|
+
>
|
|
219
|
+
<template v-if="showDots" #dot="dotProps">
|
|
220
|
+
<ChartDot
|
|
221
|
+
:cx="dotProps.cx"
|
|
222
|
+
:cy="dotProps.cy"
|
|
223
|
+
:color="s.color"
|
|
224
|
+
:variant="dotVariant"
|
|
225
|
+
:size="dotSize ?? 3"
|
|
226
|
+
/>
|
|
227
|
+
</template>
|
|
228
|
+
</Area>
|
|
148
229
|
</CartesianFrame>
|
|
149
230
|
</template>
|
|
@@ -5,7 +5,11 @@ declare const __VLS_export: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_se
|
|
|
5
5
|
} ? P : {});
|
|
6
6
|
expose: (exposed: {}) => void;
|
|
7
7
|
attrs: any;
|
|
8
|
-
slots: {
|
|
8
|
+
slots: {
|
|
9
|
+
tooltip?: (props: {
|
|
10
|
+
values: T | undefined;
|
|
11
|
+
}) => unknown;
|
|
12
|
+
};
|
|
9
13
|
emit: {};
|
|
10
14
|
}>) => import("vue").VNode & {
|
|
11
15
|
__ctx?: Awaited<typeof __VLS_setup>;
|