@wello-dev/charts 1.0.3 → 1.0.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 +155 -155
- package/dist/index.cjs +72 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -10
- package/dist/index.d.ts +14 -10
- package/dist/index.js +72 -28
- package/dist/index.js.map +1 -1
- package/dist/styles.css +62 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,155 +1,155 @@
|
|
|
1
|
-
# @wello-dev/charts
|
|
2
|
-
|
|
3
|
-
React charts built on [recharts](https://recharts.org): **AreaChart, BarChart, LineChart, PieChart, DonutChart, RadialBarChart** and a calendar **Heatmap**.
|
|
4
|
-
|
|
5
|
-
- Simple prop names (`data`, `dataKey`, `series`, `withLegend`, `withTooltip`, `type`, `curveType`, …).
|
|
6
|
-
- Colors are optional: series and slices without `color` take the next `CHART_COLORS` entry (emerald, amber, violet, orange, …). Colors use Tailwind names: `'blue-600'`, `'blue-700'`, `'emerald'` (= 500), from 50 to 950. They resolve to `var(--color-blue-600, #2563eb)`, so a Tailwind v4 theme's own values are used and the default Tailwind hex is the fallback. Any CSS color or variable also works.
|
|
7
|
-
- Dashboard look: dark inverted tooltips, dashed grid, no axis lines, rounded bars, smooth
|
|
8
|
-
- Every chart is rendered in a card by default, with theme-aware background and border, rounded corners, padding, and a subtle shadow.
|
|
9
|
-
- `loading` skeleton and `emptyLabel` state on every chart; right-to-left layout follows `dir="rtl"`.
|
|
10
|
-
- Light by default; dark inside `.dark` or `[data-theme="dark"]`.
|
|
11
|
-
- Ships with `"use client"` for the Next.js App Router.
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
pnpm add @wello-dev/charts recharts
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Styles are included automatically: importing any chart adds them to the page, so there is no CSS file to import. `@wello-dev/charts/styles.css` is still exported if you prefer to load the stylesheet yourself (for example to control its order in your CSS). To change the default card appearance, override `.wello-chart` styles or use `classNames.root`.
|
|
18
|
-
|
|
19
|
-
## Cartesian charts: Area, Bar, Line
|
|
20
|
-
|
|
21
|
-
```tsx
|
|
22
|
-
import { AreaChart, BarChart, LineChart } from "@wello-dev/charts";
|
|
23
|
-
|
|
24
|
-
const data = [
|
|
25
|
-
{ date: "Mar 22", Apples: 2890, Oranges: 2338 },
|
|
26
|
-
{ date: "Mar 23", Apples: 2756, Oranges: 2103 },
|
|
27
|
-
];
|
|
28
|
-
|
|
29
|
-
<AreaChart
|
|
30
|
-
h={300}
|
|
31
|
-
data={data}
|
|
32
|
-
dataKey="date"
|
|
33
|
-
type="stacked"
|
|
34
|
-
withLegend
|
|
35
|
-
valueFormatter={(value) => new Intl.NumberFormat("en-US").format(value)}
|
|
36
|
-
series={[
|
|
37
|
-
{ name: "Apples", color: "indigo-600" },
|
|
38
|
-
{ name: "Oranges", label: "Orange sales", color: "blue-600", strokeDasharray: "5 5" },
|
|
39
|
-
]}
|
|
40
|
-
referenceLines={[{ y: 3000, label: "Target", color: "red-600" }]}
|
|
41
|
-
/>;
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
Shared props:
|
|
45
|
-
|
|
46
|
-
| Prop | Description |
|
|
47
|
-
| --------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
|
|
48
|
-
| `data`, `dataKey`, `series` | Rows, the x-axis key, and `{ name, color, label?, yAxisId?, strokeDasharray? }[]` |
|
|
49
|
-
| `h`, `w` | Size (default `300` × `100%`) |
|
|
50
|
-
| `className`, `classNames` | Root class (backward-compatible) and per-part classes: `{ root, chart, legend }`; use `root` for card styling such as borders, padding, and shadows |
|
|
51
|
-
| `colors` | Palette for series without `color` (default `CHART_COLORS`) |
|
|
52
|
-
| `loading`, `emptyLabel` | Skeleton while loading; message when there is no data or every value is 0 (default `'No data'`) |
|
|
53
|
-
| `animationDuration` | Default `650`; `0` disables |
|
|
54
|
-
| `orientation` | `'horizontal'` (default) or `'vertical'` |
|
|
55
|
-
| `withLegend`, `legendProps` | Legend (`verticalAlign`, `align`, `highlightOnHover`); hovering an item dims the other series |
|
|
56
|
-
| `withTooltip`, `tooltipProps`, `tooltipAnimationDuration` | Tooltip (on by default); `tooltipProps` go to recharts `Tooltip` |
|
|
57
|
-
| `withXAxis`, `withYAxis`, `xAxisProps`, `yAxisProps`, `xAxisLabel`, `yAxisLabel` | Axes |
|
|
58
|
-
| `withRightYAxis`, `rightYAxisProps`, `rightYAxisLabel` | Right axis; bind series with `yAxisId: 'right'` |
|
|
59
|
-
| `gridAxis`, `gridProps`, `tickLine` (default `'none'`), `strokeDasharray`, `gridColor`, `textColor` | Grid and ticks |
|
|
60
|
-
| `unit`, `valueFormatter` | y-axis ticks and tooltip values |
|
|
61
|
-
| `referenceLines` | `{ x?, y?, label?, color?, strokeDasharray? }[]` |
|
|
62
|
-
| `children` | Extra recharts elements |
|
|
63
|
-
|
|
64
|
-
| Chart | Own props |
|
|
65
|
-
| ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
66
|
-
| `AreaChart` | `type`: `default` \| `stacked` \| `percent` \| `split`; `curveType`, `withGradient`, `fillOpacity`, `strokeWidth`, `withDots`, `dotProps`, `activeDotProps`, `connectNulls`, `withPointLabels`, `splitColors`, `splitOffset`, `areaChartProps`, `areaProps` |
|
|
67
|
-
| `BarChart` | `type`: `default` \| `stacked` \| `percent` \| `waterfall`; `fillOpacity`, `maxBarWidth`, `minBarSize`, `withBarValueLabel`, `valueLabelProps`, `getBarColor(value, series)`, `barChartProps`, `barProps` |
|
|
68
|
-
| `LineChart` | `type`: `default` \| `gradient` (with `gradientStops`); `curveType`, `strokeWidth`, `withDots`, `dotProps`, `activeDotProps`, `connectNulls`, `withPointLabels`, `lineChartProps`, `lineProps` |
|
|
69
|
-
|
|
70
|
-
Waterfall bars use the first series; rows with `standalone: true` start at 0 (totals) and `color` colors a single bar.
|
|
71
|
-
|
|
72
|
-
## PieChart and DonutChart
|
|
73
|
-
|
|
74
|
-
```tsx
|
|
75
|
-
import { DonutChart, PieChart } from "@wello-dev/charts";
|
|
76
|
-
|
|
77
|
-
const data = [
|
|
78
|
-
{ name: "USA", value: 400, color: "indigo-600" },
|
|
79
|
-
{ name: "India", value: 300, color: "yellow-600" },
|
|
80
|
-
];
|
|
81
|
-
|
|
82
|
-
<PieChart data={data} withLabels labelsType="percent" withTooltip />
|
|
83
|
-
<DonutChart data={data} chartLabel="700 users" thickness={30} paddingAngle={4} />
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
| Prop | Description |
|
|
87
|
-
| ------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
88
|
-
| `size` | Diameter (default `160`) |
|
|
89
|
-
| `withLabels`, `labelsType`, `withLabelsLine`, `labelColor` | Labels: `'value'` or `'percent'` |
|
|
90
|
-
| `labelsPosition` | Pie only: `'outside'` (default) or `'inside'` |
|
|
91
|
-
| `thickness`, `chartLabel`, `chartSubLabel`, `emptyRing` | Donut only: ring width (about a quarter of the radius), large center value, small label under it, and a muted ring instead of the empty state when every value is 0 |
|
|
92
|
-
| `colors`, `cornerRadius` | Palette for slices without `color`; slice corner radius (default `6`) |
|
|
93
|
-
| `loading`, `emptyLabel`, `animationDuration` | Same as the cartesian charts |
|
|
94
|
-
| `paddingAngle`, `startAngle`, `endAngle`, `strokeWidth` (default `3`), `strokeColor` (card background) | Shape |
|
|
95
|
-
| `withTooltip`, `tooltipDataSource` | The hovered `'segment'` with its share (default) or `'all'` slices. Off by default for Pie, on for Donut. Rendered into `document.body` outward from the center, so it neither covers the center label nor gets clipped by `overflow: hidden` cards |
|
|
96
|
-
| `withLegend`, `legendPosition` | Legend with hover highlight |
|
|
97
|
-
| `valueFormatter`, `pieProps`, `pieChartProps` | Formatting and recharts passthrough |
|
|
98
|
-
| `className`, `classNames` | Root class (backward-compatible) and per-part classes: `{ root, chart, legend }` |
|
|
99
|
-
|
|
100
|
-
## RadialBarChart
|
|
101
|
-
|
|
102
|
-
```tsx
|
|
103
|
-
<RadialBarChart
|
|
104
|
-
h={260}
|
|
105
|
-
dataKey="value"
|
|
106
|
-
withLabels
|
|
107
|
-
withLegend
|
|
108
|
-
data={[
|
|
109
|
-
{ name: "18-24", value: 31.47, color: "blue-700" },
|
|
110
|
-
{ name: "25-29", value: 26.69, color: "orange-600" },
|
|
111
|
-
]}
|
|
112
|
-
/>
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
Props: `data`, `dataKey`, `h`, `w`, `barSize` (20), `withBackground` (true), `emptyBackgroundColor`, `startAngle` (90), `endAngle` (-270), `withLabels`, `withLegend`, `legendPosition`, `withTooltip` (true), `tooltipProps`, `valueFormatter`, `radialBarProps`, `radialBarChartProps`, `className`, `classNames` (`root`, `chart`, `legend`).
|
|
116
|
-
|
|
117
|
-
## Heatmap
|
|
118
|
-
|
|
119
|
-
A contributions-style calendar (plain SVG, no recharts).
|
|
120
|
-
|
|
121
|
-
```tsx
|
|
122
|
-
<Heatmap
|
|
123
|
-
data={{ "2025-02-14": 2, "2025-02-11": 3 }}
|
|
124
|
-
startDate="2025-01-01"
|
|
125
|
-
endDate="2025-03-31"
|
|
126
|
-
withMonthLabels
|
|
127
|
-
withWeekdayLabels
|
|
128
|
-
withLegend
|
|
129
|
-
withTooltip
|
|
130
|
-
getTooltipLabel={({ date, value }) => `${date}: ${value ?? 0}`}
|
|
131
|
-
/>
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
Every chart accepts `classNames={{ root, chart, legend }}` for its wrapper, plot area, and legend. The root is a card by default; use `classNames.root` to customize that card. `className` remains available for compatibility and is applied to the root.
|
|
135
|
-
|
|
136
|
-
| Prop | Description |
|
|
137
|
-
| ----------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
|
|
138
|
-
| `data` | `{ 'YYYY-MM-DD': number }` (UTC days) |
|
|
139
|
-
| `startDate`, `endDate` | Range (default: the year up to today) |
|
|
140
|
-
| `colors`, `domain` | Low → high colors (4 greens) and the `[min, max]` they span (from the data) |
|
|
141
|
-
| `firstDayOfWeek` | `0` Sunday … `6` Saturday (default `1`) |
|
|
142
|
-
| `rectSize`, `gap`, `rectRadius`, `fontSize` | Squares (10, 1, 2) and labels (12) |
|
|
143
|
-
| `withMonthLabels`, `monthLabels`, `monthLabelsPosition`, `monthsLabelsHeight` | Month row |
|
|
144
|
-
| `withWeekdayLabels`, `weekdayLabels`, `weekdaysLabelsWidth` | Weekday column (Sunday first; default shows Mon/Wed/Fri) |
|
|
145
|
-
| `splitMonths`, `withOutsideDates` | Gap between months; show the padding days of the first/last week |
|
|
146
|
-
| `withTooltip`, `getTooltipLabel`, `getRectProps` | Hover tooltip and per-square props |
|
|
147
|
-
| `withLegend`, `legendLabels` | `Less … More` scale |
|
|
148
|
-
|
|
149
|
-
## Theming
|
|
150
|
-
|
|
151
|
-
Override any variable on `.wello-chart` (or a parent):
|
|
152
|
-
|
|
153
|
-
`--wello-chart-primary`, `--wello-chart-bg`, `--wello-chart-text-color`, `--wello-chart-bright-color`, `--wello-chart-dimmed-color`, `--wello-chart-grid-color`, `--wello-chart-cursor-fill`, `--wello-chart-tooltip-bg`, `--wello-chart-tooltip-fg`, `--wello-chart-heatmap-empty`, `--wello-chart-radial-bg`, `--wello-chart-label-line-color`, `--wello-chart-font`.
|
|
154
|
-
|
|
155
|
-
`ChartTooltip`, `ChartSliceTooltip`, `ChartLegend`, `getThemeColor`, `seriesColor`, `CHART_COLORS` and `DEFAULT_CHART_COLORS` are exported for custom tooltips and legends.
|
|
1
|
+
# @wello-dev/charts
|
|
2
|
+
|
|
3
|
+
React charts built on [recharts](https://recharts.org): **AreaChart, BarChart, LineChart, PieChart, DonutChart, RadialBarChart** and a calendar **Heatmap**.
|
|
4
|
+
|
|
5
|
+
- Simple prop names (`data`, `dataKey`, `series`, `withLegend`, `withTooltip`, `type`, `curveType`, …).
|
|
6
|
+
- Colors are optional: series and slices without `color` take the next `CHART_COLORS` entry (emerald, amber, violet, orange, …). Colors use Tailwind names: `'blue-600'`, `'blue-700'`, `'emerald'` (= 500), from 50 to 950. They resolve to `var(--color-blue-600, #2563eb)`, so a Tailwind v4 theme's own values are used and the default Tailwind hex is the fallback. Any CSS color or variable also works.
|
|
7
|
+
- Dashboard look: transparent (sits on your card, axis text and grid follow its text color), dark inverted tooltips, dashed grid, no axis lines, rounded bars, smooth 2px lines with dots, rounded donut slices that grow and glow on hover, 650ms animations.
|
|
8
|
+
- Every chart is rendered in a card by default, with theme-aware background and border, rounded corners, padding, and a subtle shadow.
|
|
9
|
+
- `loading` skeleton and `emptyLabel` state on every chart; right-to-left layout follows `dir="rtl"`.
|
|
10
|
+
- Light by default; dark inside `.dark` or `[data-theme="dark"]`.
|
|
11
|
+
- Ships with `"use client"` for the Next.js App Router.
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm add @wello-dev/charts recharts
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Styles are included automatically: importing any chart adds them to the page, so there is no CSS file to import. `@wello-dev/charts/styles.css` is still exported if you prefer to load the stylesheet yourself (for example to control its order in your CSS). To change the default card appearance, override `.wello-chart` styles or use `classNames.root`.
|
|
18
|
+
|
|
19
|
+
## Cartesian charts: Area, Bar, Line
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import { AreaChart, BarChart, LineChart } from "@wello-dev/charts";
|
|
23
|
+
|
|
24
|
+
const data = [
|
|
25
|
+
{ date: "Mar 22", Apples: 2890, Oranges: 2338 },
|
|
26
|
+
{ date: "Mar 23", Apples: 2756, Oranges: 2103 },
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
<AreaChart
|
|
30
|
+
h={300}
|
|
31
|
+
data={data}
|
|
32
|
+
dataKey="date"
|
|
33
|
+
type="stacked"
|
|
34
|
+
withLegend
|
|
35
|
+
valueFormatter={(value) => new Intl.NumberFormat("en-US").format(value)}
|
|
36
|
+
series={[
|
|
37
|
+
{ name: "Apples", color: "indigo-600" },
|
|
38
|
+
{ name: "Oranges", label: "Orange sales", color: "blue-600", strokeDasharray: "5 5" },
|
|
39
|
+
]}
|
|
40
|
+
referenceLines={[{ y: 3000, label: "Target", color: "red-600" }]}
|
|
41
|
+
/>;
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Shared props:
|
|
45
|
+
|
|
46
|
+
| Prop | Description |
|
|
47
|
+
| --------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
|
|
48
|
+
| `data`, `dataKey`, `series` | Rows, the x-axis key, and `{ name, color, label?, yAxisId?, strokeDasharray? }[]` |
|
|
49
|
+
| `h`, `w` | Size (default `300` × `100%`) |
|
|
50
|
+
| `className`, `classNames` | Root class (backward-compatible) and per-part classes: `{ root, chart, legend }`; use `root` for card styling such as borders, padding, and shadows |
|
|
51
|
+
| `colors` | Palette for series without `color` (default `CHART_COLORS`) |
|
|
52
|
+
| `loading`, `emptyLabel` | Skeleton while loading; message when there is no data or every value is 0 (default `'No data'`) |
|
|
53
|
+
| `animationDuration` | Default `650`; `0` disables |
|
|
54
|
+
| `orientation` | `'horizontal'` (default) or `'vertical'` |
|
|
55
|
+
| `withLegend`, `legendProps` | Legend (`verticalAlign`, `align`, `highlightOnHover`); hovering an item dims the other series |
|
|
56
|
+
| `withTooltip`, `tooltipProps`, `tooltipAnimationDuration` | Tooltip (on by default); `tooltipProps` go to recharts `Tooltip` |
|
|
57
|
+
| `withXAxis`, `withYAxis`, `xAxisProps`, `yAxisProps`, `xAxisLabel`, `yAxisLabel` | Axes |
|
|
58
|
+
| `withRightYAxis`, `rightYAxisProps`, `rightYAxisLabel` | Right axis; bind series with `yAxisId: 'right'` |
|
|
59
|
+
| `gridAxis`, `gridProps`, `tickLine` (default `'none'`), `strokeDasharray`, `gridColor`, `textColor` | Grid and ticks |
|
|
60
|
+
| `unit`, `valueFormatter` | y-axis ticks and tooltip values |
|
|
61
|
+
| `referenceLines` | `{ x?, y?, label?, color?, strokeDasharray? }[]` |
|
|
62
|
+
| `children` | Extra recharts elements |
|
|
63
|
+
|
|
64
|
+
| Chart | Own props |
|
|
65
|
+
| ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
66
|
+
| `AreaChart` | `type`: `default` \| `stacked` \| `percent` \| `split`; `curveType`, `withGradient`, `fillOpacity`, `strokeWidth`, `withDots`, `dotProps`, `activeDotProps`, `connectNulls`, `withPointLabels`, `splitColors`, `splitOffset`, `areaChartProps`, `areaProps` |
|
|
67
|
+
| `BarChart` | `type`: `default` \| `stacked` \| `percent` \| `waterfall`; `fillOpacity`, `maxBarWidth`, `minBarSize`, `withBarValueLabel`, `valueLabelProps`, `getBarColor(value, series)`, `barChartProps`, `barProps` |
|
|
68
|
+
| `LineChart` | `type`: `default` \| `gradient` (with `gradientStops`); `curveType`, `strokeWidth`, `withDots`, `dotProps`, `activeDotProps`, `connectNulls`, `withPointLabels`, `lineChartProps`, `lineProps` |
|
|
69
|
+
|
|
70
|
+
Waterfall bars use the first series; rows with `standalone: true` start at 0 (totals) and `color` colors a single bar.
|
|
71
|
+
|
|
72
|
+
## PieChart and DonutChart
|
|
73
|
+
|
|
74
|
+
```tsx
|
|
75
|
+
import { DonutChart, PieChart } from "@wello-dev/charts";
|
|
76
|
+
|
|
77
|
+
const data = [
|
|
78
|
+
{ name: "USA", value: 400, color: "indigo-600" },
|
|
79
|
+
{ name: "India", value: 300, color: "yellow-600" },
|
|
80
|
+
];
|
|
81
|
+
|
|
82
|
+
<PieChart data={data} withLabels labelsType="percent" withTooltip />
|
|
83
|
+
<DonutChart data={data} chartLabel="700 users" thickness={30} paddingAngle={4} />
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
| Prop | Description |
|
|
87
|
+
| ------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
88
|
+
| `size` | Diameter (default `160`) |
|
|
89
|
+
| `withLabels`, `labelsType`, `withLabelsLine`, `labelColor` | Labels: `'value'` or `'percent'` |
|
|
90
|
+
| `labelsPosition` | Pie only: `'outside'` (default) or `'inside'` |
|
|
91
|
+
| `thickness`, `chartLabel`, `chartSubLabel`, `emptyRing` | Donut only: ring width (about a quarter of the radius), large center value, small label under it, and a muted ring instead of the empty state when every value is 0 |
|
|
92
|
+
| `colors`, `cornerRadius` | Palette for slices without `color`; slice corner radius (default `6`) |
|
|
93
|
+
| `loading`, `emptyLabel`, `animationDuration` | Same as the cartesian charts |
|
|
94
|
+
| `paddingAngle`, `startAngle`, `endAngle`, `strokeWidth` (default `3`), `strokeColor` (card background) | Shape |
|
|
95
|
+
| `withTooltip`, `tooltipDataSource` | The hovered `'segment'` with its share (default) or `'all'` slices. Off by default for Pie, on for Donut. Rendered into `document.body` outward from the center, so it neither covers the center label nor gets clipped by `overflow: hidden` cards |
|
|
96
|
+
| `withLegend`, `legendPosition` | Legend with hover highlight |
|
|
97
|
+
| `valueFormatter`, `pieProps`, `pieChartProps` | Formatting and recharts passthrough |
|
|
98
|
+
| `className`, `classNames` | Root class (backward-compatible) and per-part classes: `{ root, chart, legend }` |
|
|
99
|
+
|
|
100
|
+
## RadialBarChart
|
|
101
|
+
|
|
102
|
+
```tsx
|
|
103
|
+
<RadialBarChart
|
|
104
|
+
h={260}
|
|
105
|
+
dataKey="value"
|
|
106
|
+
withLabels
|
|
107
|
+
withLegend
|
|
108
|
+
data={[
|
|
109
|
+
{ name: "18-24", value: 31.47, color: "blue-700" },
|
|
110
|
+
{ name: "25-29", value: 26.69, color: "orange-600" },
|
|
111
|
+
]}
|
|
112
|
+
/>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Props: `data`, `dataKey`, `h`, `w`, `barSize` (20), `withBackground` (true), `emptyBackgroundColor`, `startAngle` (90), `endAngle` (-270), `withLabels`, `withLegend`, `legendPosition`, `withTooltip` (true), `tooltipProps`, `valueFormatter`, `radialBarProps`, `radialBarChartProps`, `className`, `classNames` (`root`, `chart`, `legend`).
|
|
116
|
+
|
|
117
|
+
## Heatmap
|
|
118
|
+
|
|
119
|
+
A contributions-style calendar (plain SVG, no recharts).
|
|
120
|
+
|
|
121
|
+
```tsx
|
|
122
|
+
<Heatmap
|
|
123
|
+
data={{ "2025-02-14": 2, "2025-02-11": 3 }}
|
|
124
|
+
startDate="2025-01-01"
|
|
125
|
+
endDate="2025-03-31"
|
|
126
|
+
withMonthLabels
|
|
127
|
+
withWeekdayLabels
|
|
128
|
+
withLegend
|
|
129
|
+
withTooltip
|
|
130
|
+
getTooltipLabel={({ date, value }) => `${date}: ${value ?? 0}`}
|
|
131
|
+
/>
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Every chart accepts `classNames={{ root, chart, legend }}` for its wrapper, plot area, and legend. The root is a card by default; use `classNames.root` to customize that card. `className` remains available for compatibility and is applied to the root.
|
|
135
|
+
|
|
136
|
+
| Prop | Description |
|
|
137
|
+
| ----------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
|
|
138
|
+
| `data` | `{ 'YYYY-MM-DD': number }` (UTC days) |
|
|
139
|
+
| `startDate`, `endDate` | Range (default: the year up to today) |
|
|
140
|
+
| `colors`, `domain` | Low → high colors (4 greens) and the `[min, max]` they span (from the data) |
|
|
141
|
+
| `firstDayOfWeek` | `0` Sunday … `6` Saturday (default `1`) |
|
|
142
|
+
| `rectSize`, `gap`, `rectRadius`, `fontSize` | Squares (10, 1, 2) and labels (12) |
|
|
143
|
+
| `withMonthLabels`, `monthLabels`, `monthLabelsPosition`, `monthsLabelsHeight` | Month row |
|
|
144
|
+
| `withWeekdayLabels`, `weekdayLabels`, `weekdaysLabelsWidth` | Weekday column (Sunday first; default shows Mon/Wed/Fri) |
|
|
145
|
+
| `splitMonths`, `withOutsideDates` | Gap between months; show the padding days of the first/last week |
|
|
146
|
+
| `withTooltip`, `getTooltipLabel`, `getRectProps` | Hover tooltip and per-square props |
|
|
147
|
+
| `withLegend`, `legendLabels` | `Less … More` scale |
|
|
148
|
+
|
|
149
|
+
## Theming
|
|
150
|
+
|
|
151
|
+
Override any variable on `.wello-chart` (or a parent):
|
|
152
|
+
|
|
153
|
+
`--wello-chart-primary`, `--wello-chart-bg`, `--wello-chart-text-color`, `--wello-chart-bright-color`, `--wello-chart-dimmed-color`, `--wello-chart-grid-color`, `--wello-chart-cursor-fill`, `--wello-chart-tooltip-bg`, `--wello-chart-tooltip-fg`, `--wello-chart-heatmap-empty`, `--wello-chart-radial-bg`, `--wello-chart-label-line-color`, `--wello-chart-font`.
|
|
154
|
+
|
|
155
|
+
`ChartTooltip`, `ChartSliceTooltip`, `ChartLegend`, `getThemeColor`, `seriesColor`, `CHART_COLORS` and `DEFAULT_CHART_COLORS` are exported for custom tooltips and legends.
|
package/dist/index.cjs
CHANGED
|
@@ -68,7 +68,7 @@ function styleInject(css, { insertAt } = {}) {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
// src/styles.css
|
|
71
|
-
styleInject(".wello-chart {\n --wello-chart-primary: var(--wello-primary-color, var(--primary, #26372c));\n --wello-chart-bg: var(--wello-color-surface, var(--card, #ffffff));\n --wello-chart-text-color:
|
|
71
|
+
styleInject(".wello-chart {\n --wello-chart-primary: var(--wello-primary-color, var(--primary, #26372c));\n --wello-chart-bg: var(--wello-color-surface, var(--card, #ffffff));\n --wello-chart-text-color: color-mix(in srgb, currentColor 50%, transparent);\n --wello-chart-legend-color: color-mix(in srgb, currentColor 85%, transparent);\n --wello-chart-bright-color: currentColor;\n --wello-chart-dimmed-color: color-mix(in srgb, currentColor 50%, transparent);\n --wello-chart-grid-color: color-mix(in srgb, currentColor 22%, transparent);\n --wello-chart-cursor-fill: color-mix(in srgb, var(--wello-chart-primary) 8%, transparent);\n --wello-chart-label-line-color: var(--wello-color-border-strong, var(--input, #cbd5e1));\n --wello-chart-tooltip-bg: var(--wello-color-bright, var(--foreground, #0f172a));\n --wello-chart-tooltip-fg: var(--wello-color-body, var(--background, #ffffff));\n --wello-chart-heatmap-empty: color-mix(in srgb, var(--wello-chart-text-color) 15%, transparent);\n --wello-chart-radial-bg: color-mix(in srgb, var(--wello-chart-text-color) 12%, transparent);\n --wello-chart-muted: color-mix(in srgb, var(--wello-chart-text-color) 35%, transparent);\n --wello-chart-font: inherit;\n box-sizing: border-box;\n position: relative;\n font-family: var(--wello-chart-font);\n}\n.dark .wello-chart,\n[data-theme=dark] .wello-chart,\n.wello-chart[data-theme=dark] {\n --wello-chart-primary: var(--wello-primary-color, var(--primary, #9fbfa8));\n --wello-chart-bg: var(--wello-color-surface, var(--card, #0f172a));\n --wello-chart-label-line-color: var(--wello-color-border-strong, var(--input, #475569));\n --wello-chart-tooltip-bg: var(--wello-color-bright, var(--foreground, #f8fafc));\n --wello-chart-tooltip-fg: var(--wello-color-body, var(--background, #0f172a));\n}\n.wello-chart .recharts-cartesian-grid line {\n shape-rendering: crispEdges;\n}\n.wello-chart .recharts-surface,\n.wello-heatmap svg {\n direction: ltr;\n}\n.wello-chart .recharts-wrapper:focus,\n.wello-chart .recharts-surface:focus,\n.wello-chart *:focus:not(:focus-visible) {\n outline: none;\n}\n.wello-tooltip {\n min-width: 8.5rem;\n padding: 10px 12px;\n border-radius: 12px;\n background: color-mix(in srgb, var(--wello-chart-tooltip-bg) 94%, transparent);\n color: var(--wello-chart-tooltip-fg);\n box-shadow: 0 12px 32px rgb(0 0 0 / 0.24);\n font-size: 12px;\n line-height: 1.4;\n pointer-events: none;\n}\n.wello-tooltip-label {\n display: flex;\n align-items: center;\n gap: 8px;\n margin-bottom: 4px;\n opacity: 0.8;\n}\n.wello-tooltip--slice .wello-tooltip-label {\n margin-bottom: 6px;\n font-weight: 600;\n opacity: 1;\n}\n.wello-tooltip-body {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n.wello-tooltip-item {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n.wello-tooltip-swatch,\n.wello-legend-swatch {\n flex-shrink: 0;\n width: 8px;\n height: 8px;\n border-radius: 999px;\n}\n.wello-tooltip .wello-tooltip-swatch {\n box-shadow: 0 0 0 1px color-mix(in srgb, var(--wello-chart-tooltip-fg) 45%, transparent);\n}\n.wello-tooltip-item-name {\n flex: 1;\n opacity: 0.8;\n}\n.wello-tooltip-item-value {\n margin-inline-start: 16px;\n font-variant-numeric: tabular-nums;\n font-weight: 700;\n}\n.wello-legend {\n display: flex;\n flex-wrap: wrap;\n gap: 4px 12px;\n box-sizing: border-box;\n max-width: 100%;\n padding-bottom: 14px;\n font-size: 12.5px;\n font-weight: 500;\n color: var(--wello-chart-legend-color);\n}\n.wello-legend--start,\n.wello-legend--left {\n justify-content: flex-start;\n}\n.wello-legend--center {\n justify-content: center;\n}\n.wello-legend--end,\n.wello-legend--right {\n justify-content: flex-end;\n}\n[dir=rtl] .wello-legend--left {\n justify-content: flex-end;\n}\n[dir=rtl] .wello-legend--right {\n justify-content: flex-start;\n}\n.wello-legend .wello-legend-swatch {\n width: 10px;\n height: 10px;\n}\n.wello-legend-item {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 3px 8px;\n border-radius: 999px;\n cursor: default;\n transition: background-color 120ms ease;\n}\n.wello-legend-item:hover {\n background: var(--wello-chart-cursor-fill);\n}\n.wello-chart-skeleton {\n border-radius: 12px;\n background: color-mix(in srgb, var(--wello-chart-text-color) 14%, transparent);\n animation: wello-pulse 1.6s ease-in-out infinite;\n}\n.wello-chart-empty {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 16px;\n color: var(--wello-chart-text-color);\n font-size: 14px;\n font-weight: 500;\n text-align: center;\n}\n@keyframes wello-pulse {\n 50% {\n opacity: 0.5;\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .wello-chart-skeleton {\n animation: none;\n }\n}\n.wello-pie .wello-legend {\n padding: 8px 0 0;\n}\n.wello-pie-area {\n position: relative;\n}\n.wello-floating-tooltip {\n z-index: 9999;\n pointer-events: none;\n white-space: nowrap;\n font-family: var(--wello-chart-font, inherit);\n}\n.wello-donut-label {\n position: absolute;\n inset: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n pointer-events: none;\n text-align: center;\n}\n.wello-donut-label-inner {\n display: flex;\n flex-direction: column;\n align-items: center;\n line-height: 1;\n}\n.wello-donut-label-main {\n color: var(--wello-chart-bright-color);\n font-size: 24px;\n font-weight: 900;\n font-variant-numeric: tabular-nums;\n letter-spacing: -0.025em;\n}\n.wello-donut-label-sub {\n margin-top: 6px;\n color: var(--wello-chart-text-color);\n font-size: 12px;\n font-weight: 600;\n}\n.wello-radial-bar .wello-legend {\n padding: 8px 0 0;\n}\n.wello-heatmap {\n display: inline-block;\n}\n.wello-heatmap svg {\n display: block;\n overflow: visible;\n}\n.wello-heatmap-label {\n fill: var(--wello-chart-text-color);\n}\n.wello-heatmap-rect--outside {\n opacity: 0.4;\n}\n.wello-heatmap-tooltip {\n min-width: 0;\n}\n.wello-heatmap-legend {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 3px;\n margin-top: 8px;\n color: var(--wello-chart-text-color);\n}\n.wello-heatmap-legend > span:first-child {\n margin-inline-end: 4px;\n}\n.wello-heatmap-legend > span:last-child {\n margin-inline-start: 4px;\n}\n");
|
|
72
72
|
|
|
73
73
|
// src/charts/area-chart.tsx
|
|
74
74
|
var import_recharts2 = require("recharts");
|
|
@@ -424,7 +424,7 @@ function useIsRtl(ref) {
|
|
|
424
424
|
|
|
425
425
|
// src/components/chart-legend.tsx
|
|
426
426
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
427
|
-
function ChartLegend({ series, onHighlight, align = "
|
|
427
|
+
function ChartLegend({ series, onHighlight, align = "start", className }) {
|
|
428
428
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: cx("wello-legend", `wello-legend--${align}`, className), children: series.map((item) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
429
429
|
"div",
|
|
430
430
|
{
|
|
@@ -532,19 +532,45 @@ function withLabelPadding(props) {
|
|
|
532
532
|
const padding = vertical ? { top: 20, bottom: 20 } : { left: 30, right: 30 };
|
|
533
533
|
return { ...props, [key]: { padding, ...props[key] } };
|
|
534
534
|
}
|
|
535
|
+
function renderGridLine(props) {
|
|
536
|
+
const snap = (value) => Math.round(value) + 0.5;
|
|
537
|
+
const horizontal = props.y1 === props.y2;
|
|
538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
539
|
+
"line",
|
|
540
|
+
{
|
|
541
|
+
x1: horizontal ? props.x1 : snap(props.x1),
|
|
542
|
+
x2: horizontal ? props.x2 : snap(props.x2),
|
|
543
|
+
y1: horizontal ? snap(props.y1) : props.y1,
|
|
544
|
+
y2: horizontal ? snap(props.y2) : props.y2,
|
|
545
|
+
stroke: props.stroke,
|
|
546
|
+
strokeWidth: props.strokeWidth,
|
|
547
|
+
strokeOpacity: props.strokeOpacity,
|
|
548
|
+
strokeDasharray: props.strokeDasharray,
|
|
549
|
+
fill: "none",
|
|
550
|
+
shapeRendering: "crispEdges"
|
|
551
|
+
},
|
|
552
|
+
props.key
|
|
553
|
+
);
|
|
554
|
+
}
|
|
535
555
|
function tickFormatter(props) {
|
|
536
556
|
return (value) => `${props.valueFormatter ? props.valueFormatter(value) : value}${props.unit ?? ""}`;
|
|
537
557
|
}
|
|
538
558
|
function axisLabel(value, axis) {
|
|
539
559
|
if (!value) return void 0;
|
|
540
560
|
if (axis === "x")
|
|
541
|
-
return {
|
|
561
|
+
return {
|
|
562
|
+
value,
|
|
563
|
+
position: "insideBottom",
|
|
564
|
+
offset: -16,
|
|
565
|
+
fontSize: 12,
|
|
566
|
+
fill: "var(--wello-chart-text-color)"
|
|
567
|
+
};
|
|
542
568
|
return {
|
|
543
569
|
value,
|
|
544
570
|
angle: axis === "y" ? -90 : 90,
|
|
545
571
|
position: axis === "y" ? "insideLeft" : "insideRight",
|
|
546
572
|
fontSize: 12,
|
|
547
|
-
fill: "
|
|
573
|
+
fill: "var(--wello-chart-text-color)",
|
|
548
574
|
style: { textAnchor: "middle" }
|
|
549
575
|
};
|
|
550
576
|
}
|
|
@@ -579,20 +605,33 @@ function cartesianElements(props, { onHighlight, cursor, valueTickFormatter, rtl
|
|
|
579
605
|
const vertical = orientation === "vertical";
|
|
580
606
|
const gridStroke = getThemeColor(gridColor, "var(--wello-chart-grid-color)");
|
|
581
607
|
const valueTicks = valueTickFormatter ?? tickFormatter(props);
|
|
582
|
-
const
|
|
583
|
-
const
|
|
584
|
-
const
|
|
608
|
+
const tickBase = { fill: "var(--wello-chart-text-color)", fontSize: 12 };
|
|
609
|
+
const xTick = { ...tickBase, transform: "translate(0, 10)" };
|
|
610
|
+
const yTick = { ...tickBase, transform: rtl ? "translate(10, 0)" : "translate(-10, 0)" };
|
|
611
|
+
const rightYTick = { ...tickBase, transform: rtl ? "translate(-10, 0)" : "translate(10, 0)" };
|
|
612
|
+
const xTickLine = tickLine === "x" || tickLine === "xy" ? { stroke: "var(--wello-chart-grid-color)" } : false;
|
|
613
|
+
const yTickLine = tickLine === "y" || tickLine === "xy" ? { stroke: "var(--wello-chart-grid-color)" } : false;
|
|
585
614
|
const categoryAxis = { dataKey, type: "category" };
|
|
586
|
-
const valueAxis = {
|
|
615
|
+
const valueAxis = {
|
|
616
|
+
type: "number",
|
|
617
|
+
tickFormatter: valueTicks,
|
|
618
|
+
unit: void 0,
|
|
619
|
+
tickCount: 7,
|
|
620
|
+
// Keep every tick. With recharts' default ("preserveEnd") the grid re-thins the ticks using
|
|
621
|
+
// its own label-size guess, so a short chart shows 7 labels but only every other grid line.
|
|
622
|
+
interval: 0
|
|
623
|
+
};
|
|
624
|
+
const valueGrid = gridAxis === "x" || gridAxis === "xy";
|
|
625
|
+
const categoryGrid = gridAxis === "y" || gridAxis === "xy";
|
|
587
626
|
const elements = [
|
|
588
627
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
589
628
|
import_recharts.CartesianGrid,
|
|
590
629
|
{
|
|
630
|
+
yAxisId: "left",
|
|
591
631
|
strokeDasharray,
|
|
592
632
|
stroke: gridStroke,
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
vertical: gridAxis === "y" || gridAxis === "xy",
|
|
633
|
+
horizontal: (vertical ? categoryGrid : valueGrid) ? renderGridLine : false,
|
|
634
|
+
vertical: (vertical ? valueGrid : categoryGrid) ? renderGridLine : false,
|
|
596
635
|
...gridProps
|
|
597
636
|
},
|
|
598
637
|
"grid"
|
|
@@ -603,7 +642,7 @@ function cartesianElements(props, { onHighlight, cursor, valueTickFormatter, rtl
|
|
|
603
642
|
hide: !withXAxis,
|
|
604
643
|
...vertical ? valueAxis : categoryAxis,
|
|
605
644
|
reversed: rtl,
|
|
606
|
-
tick,
|
|
645
|
+
tick: xTick,
|
|
607
646
|
tickLine: xTickLine,
|
|
608
647
|
axisLine: false,
|
|
609
648
|
minTickGap: 5,
|
|
@@ -620,7 +659,7 @@ function cartesianElements(props, { onHighlight, cursor, valueTickFormatter, rtl
|
|
|
620
659
|
orientation: rtl ? "right" : "left",
|
|
621
660
|
hide: !withYAxis,
|
|
622
661
|
...vertical ? categoryAxis : valueAxis,
|
|
623
|
-
tick,
|
|
662
|
+
tick: yTick,
|
|
624
663
|
tickLine: yTickLine,
|
|
625
664
|
axisLine: false,
|
|
626
665
|
width: vertical ? 80 : 60,
|
|
@@ -638,7 +677,7 @@ function cartesianElements(props, { onHighlight, cursor, valueTickFormatter, rtl
|
|
|
638
677
|
yAxisId: "right",
|
|
639
678
|
orientation: rtl ? "left" : "right",
|
|
640
679
|
...vertical ? categoryAxis : valueAxis,
|
|
641
|
-
tick,
|
|
680
|
+
tick: rightYTick,
|
|
642
681
|
tickLine: yTickLine,
|
|
643
682
|
axisLine: false,
|
|
644
683
|
width: 60,
|
|
@@ -656,7 +695,10 @@ function cartesianElements(props, { onHighlight, cursor, valueTickFormatter, rtl
|
|
|
656
695
|
{
|
|
657
696
|
isAnimationActive: tooltipAnimationDuration !== 0,
|
|
658
697
|
animationDuration: tooltipAnimationDuration,
|
|
659
|
-
cursor: cursor === "fill" ? { fill: "var(--wello-chart-cursor-fill)" } :
|
|
698
|
+
cursor: cursor === "fill" ? { fill: "var(--wello-chart-cursor-fill)" } : (
|
|
699
|
+
// Dashed like the grid (Mantine style).
|
|
700
|
+
{ stroke: gridStroke, strokeWidth: 1, strokeDasharray }
|
|
701
|
+
),
|
|
660
702
|
wrapperStyle: { zIndex: 50, outline: "none" },
|
|
661
703
|
offset: 14,
|
|
662
704
|
content: renderCartesianTooltip({ series, unit, valueFormatter }),
|
|
@@ -771,9 +813,9 @@ function AreaChart(props) {
|
|
|
771
813
|
type = "default",
|
|
772
814
|
curveType = "monotone",
|
|
773
815
|
withGradient = true,
|
|
774
|
-
fillOpacity = 0.
|
|
775
|
-
strokeWidth = 2
|
|
776
|
-
withDots =
|
|
816
|
+
fillOpacity = 0.2,
|
|
817
|
+
strokeWidth = 2,
|
|
818
|
+
withDots = true,
|
|
777
819
|
dotProps,
|
|
778
820
|
activeDotProps,
|
|
779
821
|
connectNulls = true,
|
|
@@ -822,7 +864,7 @@ function AreaChart(props) {
|
|
|
822
864
|
)
|
|
823
865
|
] }) : withGradient ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
824
866
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("stop", { offset: "0%", stopColor: color, stopOpacity: fillOpacity }),
|
|
825
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("stop", { offset: "100%", stopColor: color, stopOpacity: 0.
|
|
867
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("stop", { offset: "100%", stopColor: color, stopOpacity: 0.01 })
|
|
826
868
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("stop", { offset: "0%", stopColor: color, stopOpacity: fillOpacity }) }) }, `defs-${item.name}`),
|
|
827
869
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
828
870
|
import_recharts2.Area,
|
|
@@ -844,11 +886,13 @@ function AreaChart(props) {
|
|
|
844
886
|
fillOpacity: dimmed ? 0 : 1,
|
|
845
887
|
strokeWidth: 2,
|
|
846
888
|
r: 4,
|
|
847
|
-
|
|
889
|
+
// Solid dot in the series color (no surface-colored ring), as in Mantine.
|
|
890
|
+
stroke: color,
|
|
891
|
+
strokeOpacity: dimmed ? 0 : 1,
|
|
848
892
|
...dotProps
|
|
849
893
|
} : false,
|
|
850
894
|
activeDot: {
|
|
851
|
-
fill: "
|
|
895
|
+
fill: "#fff",
|
|
852
896
|
stroke: color,
|
|
853
897
|
strokeWidth: 2,
|
|
854
898
|
r: 4,
|
|
@@ -863,7 +907,7 @@ function AreaChart(props) {
|
|
|
863
907
|
{
|
|
864
908
|
position: "top",
|
|
865
909
|
fontSize: 12,
|
|
866
|
-
fill: "
|
|
910
|
+
fill: "var(--wello-chart-text-color)",
|
|
867
911
|
formatter: props.valueFormatter
|
|
868
912
|
}
|
|
869
913
|
)
|
|
@@ -1018,7 +1062,7 @@ function BarChart(props) {
|
|
|
1018
1062
|
{
|
|
1019
1063
|
position: orientation === "vertical" ? "right" : "top",
|
|
1020
1064
|
fontSize: 12,
|
|
1021
|
-
fill: "
|
|
1065
|
+
fill: "var(--wello-chart-text-color)",
|
|
1022
1066
|
valueAccessor: (entry) => waterfall ? entry.payload.__value : entry.value,
|
|
1023
1067
|
formatter: (value) => valueFormatter && typeof value === "number" ? valueFormatter(value) : value,
|
|
1024
1068
|
...valueLabelProps
|
|
@@ -1172,7 +1216,7 @@ function LineChart(props) {
|
|
|
1172
1216
|
{
|
|
1173
1217
|
position: "top",
|
|
1174
1218
|
fontSize: 12,
|
|
1175
|
-
fill: "
|
|
1219
|
+
fill: "var(--wello-chart-text-color)",
|
|
1176
1220
|
formatter: (value) => valueFormatter && typeof value === "number" ? valueFormatter(value) : value
|
|
1177
1221
|
}
|
|
1178
1222
|
)
|
|
@@ -1382,7 +1426,7 @@ function PieBase({
|
|
|
1382
1426
|
labelsType = "value",
|
|
1383
1427
|
labelColor,
|
|
1384
1428
|
labelsPosition,
|
|
1385
|
-
paddingAngle =
|
|
1429
|
+
paddingAngle = 2,
|
|
1386
1430
|
startAngle = 0,
|
|
1387
1431
|
endAngle = 360,
|
|
1388
1432
|
cornerRadius = 6,
|
|
@@ -1431,7 +1475,7 @@ function PieBase({
|
|
|
1431
1475
|
{
|
|
1432
1476
|
x,
|
|
1433
1477
|
y,
|
|
1434
|
-
fill: outside ? getThemeColor(labelColor, "
|
|
1478
|
+
fill: outside ? getThemeColor(labelColor, "var(--wello-chart-text-color)") : getThemeColor(labelColor, "#fff"),
|
|
1435
1479
|
textAnchor: outside ? x > x0 ? "start" : "end" : "middle",
|
|
1436
1480
|
dominantBaseline: "central",
|
|
1437
1481
|
fontSize: 11,
|
|
@@ -1486,8 +1530,8 @@ function PieBase({
|
|
|
1486
1530
|
startAngle,
|
|
1487
1531
|
endAngle,
|
|
1488
1532
|
cornerRadius,
|
|
1489
|
-
stroke: getThemeColor(strokeColor
|
|
1490
|
-
strokeWidth: ring ? 0 : strokeWidth,
|
|
1533
|
+
stroke: strokeColor ? getThemeColor(strokeColor) : "none",
|
|
1534
|
+
strokeWidth: ring || !strokeColor ? 0 : strokeWidth,
|
|
1491
1535
|
label: withLabels && !ring ? renderLabel : false,
|
|
1492
1536
|
labelLine: outside && withLabelsLine && !ring ? { stroke: "var(--wello-chart-label-line-color)" } : false,
|
|
1493
1537
|
activeShape: ring ? void 0 : ActiveSlice,
|