@sproutsocial/seeds-react-data-viz 0.16.1 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/annotations-CjFoRPXf.d.mts +20 -0
- package/dist/annotations-CjFoRPXf.d.ts +20 -0
- package/dist/axis-WOeYkTO1.d.mts +44 -0
- package/dist/axis-WOeYkTO1.d.ts +44 -0
- package/dist/bar/index.d.mts +3 -1
- package/dist/bar/index.d.ts +3 -1
- package/dist/bar/index.js +12 -8
- package/dist/bar/index.js.map +1 -1
- package/dist/{axis-BVPkC6iF.d.ts → chartBase-C-l7yYGx.d.ts} +5 -59
- package/dist/{axis-BjucJt39.d.mts → chartBase-Cn_5CUJi.d.mts} +5 -59
- package/dist/{chunk-EJYDQYLE.js → chunk-2K7PFHIM.js} +92 -245
- package/dist/chunk-2K7PFHIM.js.map +1 -0
- package/dist/chunk-6D7P3IOT.js +150 -0
- package/dist/chunk-6D7P3IOT.js.map +1 -0
- package/dist/chunk-CYQXUAJC.js +169 -0
- package/dist/chunk-CYQXUAJC.js.map +1 -0
- package/dist/chunk-VVGBJOFH.js +68 -0
- package/dist/chunk-VVGBJOFH.js.map +1 -0
- package/dist/donut/index.d.mts +48 -0
- package/dist/donut/index.d.ts +48 -0
- package/dist/donut/index.js +125 -0
- package/dist/donut/index.js.map +1 -0
- package/dist/esm/bar/index.js +10 -6
- package/dist/esm/bar/index.js.map +1 -1
- package/dist/esm/chunk-AUJ3EWRH.js +68 -0
- package/dist/esm/chunk-AUJ3EWRH.js.map +1 -0
- package/dist/esm/{chunk-DKTW56NJ.js → chunk-LPQXJJNT.js} +93 -246
- package/dist/esm/chunk-LPQXJJNT.js.map +1 -0
- package/dist/esm/chunk-NAKJY5PA.js +150 -0
- package/dist/esm/chunk-NAKJY5PA.js.map +1 -0
- package/dist/esm/chunk-XMYGML25.js +169 -0
- package/dist/esm/chunk-XMYGML25.js.map +1 -0
- package/dist/esm/donut/index.js +125 -0
- package/dist/esm/donut/index.js.map +1 -0
- package/dist/esm/index.js +13 -157
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/line-area/index.js +11 -6
- package/dist/esm/line-area/index.js.map +1 -1
- package/dist/esm/sparkline/index.js +123 -0
- package/dist/esm/sparkline/index.js.map +1 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +55 -199
- package/dist/index.js.map +1 -1
- package/dist/line-area/index.d.mts +6 -3
- package/dist/line-area/index.d.ts +6 -3
- package/dist/line-area/index.js +13 -8
- package/dist/line-area/index.js.map +1 -1
- package/dist/sparkline/index.d.mts +75 -0
- package/dist/sparkline/index.d.ts +75 -0
- package/dist/sparkline/index.js +123 -0
- package/dist/sparkline/index.js.map +1 -0
- package/dist/sparkline.css +76 -0
- package/package.json +13 -2
- package/dist/chunk-EJYDQYLE.js.map +0 -1
- package/dist/esm/chunk-DKTW56NJ.js.map +0 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { TypeIconName } from '@sproutsocial/seeds-react-icon';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Declarative annotation shape — the DS renders the marker and tooltip header
|
|
5
|
+
* internally; consumers don't supply render functions. See CE-7.
|
|
6
|
+
*/
|
|
7
|
+
interface ChartAnnotation {
|
|
8
|
+
/** Numeric x-axis coordinate — a category index (category axes) or the raw coordinate (datetime/linear axes). */
|
|
9
|
+
position: number;
|
|
10
|
+
/** Icon shown above the chart at `position` and inline with `title` in the tooltip header. */
|
|
11
|
+
icon?: TypeIconName;
|
|
12
|
+
/** Color applied to the marker's vertical line. */
|
|
13
|
+
color?: string;
|
|
14
|
+
/** Tooltip header line 1. */
|
|
15
|
+
title?: string;
|
|
16
|
+
/** Tooltip header line 2. */
|
|
17
|
+
description?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type { ChartAnnotation as C };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { TypeIconName } from '@sproutsocial/seeds-react-icon';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Declarative annotation shape — the DS renders the marker and tooltip header
|
|
5
|
+
* internally; consumers don't supply render functions. See CE-7.
|
|
6
|
+
*/
|
|
7
|
+
interface ChartAnnotation {
|
|
8
|
+
/** Numeric x-axis coordinate — a category index (category axes) or the raw coordinate (datetime/linear axes). */
|
|
9
|
+
position: number;
|
|
10
|
+
/** Icon shown above the chart at `position` and inline with `title` in the tooltip header. */
|
|
11
|
+
icon?: TypeIconName;
|
|
12
|
+
/** Color applied to the marker's vertical line. */
|
|
13
|
+
color?: string;
|
|
14
|
+
/** Tooltip header line 1. */
|
|
15
|
+
title?: string;
|
|
16
|
+
/** Tooltip header line 2. */
|
|
17
|
+
description?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type { ChartAnnotation as C };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure, Highcharts-free datetime axis label formatter for v2 chart families.
|
|
3
|
+
*
|
|
4
|
+
* Ports v1's `helpers/xAxisLabelFormatter` into a rendering-agnostic shape: it
|
|
5
|
+
* returns a `{ primary, secondary? }` object instead of an HTML string, leaving
|
|
6
|
+
* SVG rendering to the caller. The timezone- and DST-correct boundary detection
|
|
7
|
+
* (calendar parts read in the target timezone) and the per-granularity
|
|
8
|
+
* `Intl.DateTimeFormat` option sets are a near-verbatim port of v1.
|
|
9
|
+
*
|
|
10
|
+
* The one net-new piece versus v1 is granularity derivation: v1 receives
|
|
11
|
+
* `unitName` from Highcharts, but `charts/` may not depend on Highcharts types
|
|
12
|
+
* (see `charts/README.md` invariants), so granularity is derived from the
|
|
13
|
+
* spacing of `tickPositions`.
|
|
14
|
+
*/
|
|
15
|
+
type DatetimeTimeFormat = "12" | "24";
|
|
16
|
+
|
|
17
|
+
/** A datetime data point: `[msSinceEpoch, value]` tuple or `{ x, y }` object. */
|
|
18
|
+
type DatetimePoint = [number, number | null] | {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number | null;
|
|
21
|
+
};
|
|
22
|
+
/** A value on a category axis, or a datetime point when the axis is `"datetime"`. */
|
|
23
|
+
type ChartDataPoint = number | null | DatetimePoint;
|
|
24
|
+
/** Category axis — labels indexed parallel to `series.data`. The default axis type. */
|
|
25
|
+
interface CategoryAxis {
|
|
26
|
+
type?: "category";
|
|
27
|
+
/** Category labels, indexed parallel to `series.data`. */
|
|
28
|
+
categories: Array<string>;
|
|
29
|
+
crosshair?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/** Datetime axis — `series.data` carries timestamped points. */
|
|
32
|
+
interface DatetimeAxis {
|
|
33
|
+
type: "datetime";
|
|
34
|
+
crosshair?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* 12- or 24-hour clock for hour-granularity tick labels (e.g. `9 AM` vs
|
|
37
|
+
* `09:00`). Default `"12"`. Coarser granularities (day/month/year) ignore it.
|
|
38
|
+
*/
|
|
39
|
+
timeFormat?: DatetimeTimeFormat;
|
|
40
|
+
}
|
|
41
|
+
/** The dimensional (non-value) axis of an X/Y chart: category or datetime. */
|
|
42
|
+
type DimensionalAxis = CategoryAxis | DatetimeAxis;
|
|
43
|
+
|
|
44
|
+
export type { ChartDataPoint as C, DatetimeAxis as D, CategoryAxis as a, DatetimePoint as b, DimensionalAxis as c };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure, Highcharts-free datetime axis label formatter for v2 chart families.
|
|
3
|
+
*
|
|
4
|
+
* Ports v1's `helpers/xAxisLabelFormatter` into a rendering-agnostic shape: it
|
|
5
|
+
* returns a `{ primary, secondary? }` object instead of an HTML string, leaving
|
|
6
|
+
* SVG rendering to the caller. The timezone- and DST-correct boundary detection
|
|
7
|
+
* (calendar parts read in the target timezone) and the per-granularity
|
|
8
|
+
* `Intl.DateTimeFormat` option sets are a near-verbatim port of v1.
|
|
9
|
+
*
|
|
10
|
+
* The one net-new piece versus v1 is granularity derivation: v1 receives
|
|
11
|
+
* `unitName` from Highcharts, but `charts/` may not depend on Highcharts types
|
|
12
|
+
* (see `charts/README.md` invariants), so granularity is derived from the
|
|
13
|
+
* spacing of `tickPositions`.
|
|
14
|
+
*/
|
|
15
|
+
type DatetimeTimeFormat = "12" | "24";
|
|
16
|
+
|
|
17
|
+
/** A datetime data point: `[msSinceEpoch, value]` tuple or `{ x, y }` object. */
|
|
18
|
+
type DatetimePoint = [number, number | null] | {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number | null;
|
|
21
|
+
};
|
|
22
|
+
/** A value on a category axis, or a datetime point when the axis is `"datetime"`. */
|
|
23
|
+
type ChartDataPoint = number | null | DatetimePoint;
|
|
24
|
+
/** Category axis — labels indexed parallel to `series.data`. The default axis type. */
|
|
25
|
+
interface CategoryAxis {
|
|
26
|
+
type?: "category";
|
|
27
|
+
/** Category labels, indexed parallel to `series.data`. */
|
|
28
|
+
categories: Array<string>;
|
|
29
|
+
crosshair?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/** Datetime axis — `series.data` carries timestamped points. */
|
|
32
|
+
interface DatetimeAxis {
|
|
33
|
+
type: "datetime";
|
|
34
|
+
crosshair?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* 12- or 24-hour clock for hour-granularity tick labels (e.g. `9 AM` vs
|
|
37
|
+
* `09:00`). Default `"12"`. Coarser granularities (day/month/year) ignore it.
|
|
38
|
+
*/
|
|
39
|
+
timeFormat?: DatetimeTimeFormat;
|
|
40
|
+
}
|
|
41
|
+
/** The dimensional (non-value) axis of an X/Y chart: category or datetime. */
|
|
42
|
+
type DimensionalAxis = CategoryAxis | DatetimeAxis;
|
|
43
|
+
|
|
44
|
+
export type { ChartDataPoint as C, DatetimeAxis as D, CategoryAxis as a, DatetimePoint as b, DimensionalAxis as c };
|
package/dist/bar/index.d.mts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { TypeIconName } from '@sproutsocial/seeds-react-icon';
|
|
4
|
-
import { C as
|
|
4
|
+
import { C as ChartAnnotation } from '../annotations-CjFoRPXf.mjs';
|
|
5
|
+
import { V as ValueFormat, C as ChartTooltipProps } from '../chartBase-Cn_5CUJi.mjs';
|
|
5
6
|
import { C as ChartExportHandle } from '../chartExport-CKYpuhik.mjs';
|
|
7
|
+
import { C as ChartDataPoint, a as CategoryAxis, D as DatetimeAxis, b as DatetimePoint } from '../axis-WOeYkTO1.mjs';
|
|
6
8
|
import '../types-DxrhdAdn.mjs';
|
|
7
9
|
import 'highcharts';
|
|
8
10
|
|
package/dist/bar/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { TypeIconName } from '@sproutsocial/seeds-react-icon';
|
|
4
|
-
import { C as
|
|
4
|
+
import { C as ChartAnnotation } from '../annotations-CjFoRPXf.js';
|
|
5
|
+
import { V as ValueFormat, C as ChartTooltipProps } from '../chartBase-C-l7yYGx.js';
|
|
5
6
|
import { C as ChartExportHandle } from '../chartExport-CKYpuhik.js';
|
|
7
|
+
import { C as ChartDataPoint, a as CategoryAxis, D as DatetimeAxis, b as DatetimePoint } from '../axis-WOeYkTO1.js';
|
|
6
8
|
import '../types-DxrhdAdn.js';
|
|
7
9
|
import 'highcharts';
|
|
8
10
|
|
package/dist/bar/index.js
CHANGED
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
+
var _chunkVVGBJOFHjs = require('../chunk-VVGBJOFH.js');
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
|
|
9
|
+
var _chunk6D7P3IOTjs = require('../chunk-6D7P3IOT.js');
|
|
8
10
|
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
var _chunk2K7PFHIMjs = require('../chunk-2K7PFHIM.js');
|
|
11
15
|
|
|
12
16
|
|
|
13
17
|
var _chunkWEKDYQ4Tjs = require('../chunk-WEKDYQ4T.js');
|
|
@@ -22,8 +26,8 @@ function highchartsType(direction) {
|
|
|
22
26
|
function buildBarChartOptions(props, direction, series = props.series) {
|
|
23
27
|
const chartType = highchartsType(direction);
|
|
24
28
|
const isDatetime = props.xAxis.type === "datetime";
|
|
25
|
-
const tooltipTimezone =
|
|
26
|
-
const { annotations, lookup: annotationLookup } =
|
|
29
|
+
const tooltipTimezone = _chunk6D7P3IOTjs.resolveTooltipTimezone.call(void 0, props.xAxis, props.timezone);
|
|
30
|
+
const { annotations, lookup: annotationLookup } = _chunkVVGBJOFHjs.buildAnnotationConfig.call(void 0,
|
|
27
31
|
props.annotations
|
|
28
32
|
);
|
|
29
33
|
const barTypeConfig = {
|
|
@@ -70,14 +74,14 @@ function buildBarChartOptions(props, direction, series = props.series) {
|
|
|
70
74
|
}
|
|
71
75
|
};
|
|
72
76
|
const options = {
|
|
73
|
-
...
|
|
77
|
+
..._chunk2K7PFHIMjs.buildBaseChartOptions.call(void 0, {
|
|
74
78
|
type: chartType,
|
|
75
79
|
description: props.description,
|
|
76
80
|
valueSuffix: props.valueSuffix,
|
|
77
81
|
reserveTopMargin: Boolean(annotations),
|
|
78
82
|
timezone: tooltipTimezone
|
|
79
83
|
}),
|
|
80
|
-
xAxis:
|
|
84
|
+
xAxis: _chunk6D7P3IOTjs.buildDimensionalAxis.call(void 0, props.xAxis, _nullishCoalesce(tooltipTimezone, () => ( "UTC"))),
|
|
81
85
|
yAxis: {
|
|
82
86
|
min: _optionalChain([props, 'access', _11 => _11.yAxis, 'optionalAccess', _12 => _12.min]),
|
|
83
87
|
max: _optionalChain([props, 'access', _13 => _13.yAxis, 'optionalAccess', _14 => _14.max]),
|
|
@@ -88,7 +92,7 @@ function buildBarChartOptions(props, direction, series = props.series) {
|
|
|
88
92
|
enabled: _optionalChain([props, 'access', _19 => _19.yAxis, 'optionalAccess', _20 => _20.showLabels]) !== false,
|
|
89
93
|
// A declarative `format` drives ticks through the shared valueFormatter;
|
|
90
94
|
// absent it, the zero-config decimal default (1.20K / 1.20M / 1.20B).
|
|
91
|
-
formatter: _optionalChain([props, 'access', _21 => _21.yAxis, 'optionalAccess', _22 => _22.format]) ?
|
|
95
|
+
formatter: _optionalChain([props, 'access', _21 => _21.yAxis, 'optionalAccess', _22 => _22.format]) ? _chunkVVGBJOFHjs.makeValueAxisLabelFormatter.call(void 0, props.yAxis.format) : _chunkVVGBJOFHjs.defaultValueAxisLabelFormatter
|
|
92
96
|
}
|
|
93
97
|
},
|
|
94
98
|
plotOptions: {
|
|
@@ -159,7 +163,7 @@ var BAR_CHART_DEFAULT_SERIES_LIMIT = 10;
|
|
|
159
163
|
var _jsxruntime = require('react/jsx-runtime');
|
|
160
164
|
var BarChart = _react.memo.call(void 0, function BarChart2(props) {
|
|
161
165
|
const seriesLimit = _nullishCoalesce(props.seriesLimit, () => ( BAR_CHART_DEFAULT_SERIES_LIMIT));
|
|
162
|
-
const { colors, series } =
|
|
166
|
+
const { colors, series } = _chunk2K7PFHIMjs.useSeedsChartSetup.call(void 0, {
|
|
163
167
|
series: props.series,
|
|
164
168
|
seriesLimit,
|
|
165
169
|
isSeriesLimitOverridden: props.seriesLimit !== void 0,
|
|
@@ -179,7 +183,7 @@ var BarChart = _react.memo.call(void 0, function BarChart2(props) {
|
|
|
179
183
|
$hasOnClick: hasOnClick,
|
|
180
184
|
bg: "container.background.base",
|
|
181
185
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
182
|
-
|
|
186
|
+
_chunk2K7PFHIMjs.ChartRenderer,
|
|
183
187
|
{
|
|
184
188
|
options,
|
|
185
189
|
series,
|
package/dist/bar/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/bar/index.js","../../src/charts/bar/BarChart.tsx","../../src/charts/bar/adapter.ts","../../src/charts/bar/styles.ts","../../src/charts/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QAAA;AAAA,MACjB;AAAA,IAAA;AAAA,EACF,CAAA;AAEJ,CAAC,CAAA;ADuJD;AACE;AACF,4BAAC","file":"/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/bar/index.js","sourcesContent":[null,"import { memo } from \"react\";\nimport { useSeedsChartSetup, ChartRenderer } from \"../shared/chartBase\";\nimport { buildBarChartOptions } from \"./adapter\";\nimport { BarStyledBox } from \"./styles\";\nimport type { BarChartProps } from \"./types\";\nimport { BAR_CHART_DEFAULT_SERIES_LIMIT } from \"../constants\";\n\nexport const BarChart = memo(function BarChart(props: BarChartProps) {\n // The shared hook caps the series to the limit (and warns once per render\n // when the default is exceeded without an explicit override) so the adapter\n // and renderer below all consume the capped data.\n const seriesLimit = props.seriesLimit ?? BAR_CHART_DEFAULT_SERIES_LIMIT;\n const { colors, series } = useSeedsChartSetup({\n series: props.series,\n seriesLimit,\n isSeriesLimitOverridden: props.seriesLimit !== undefined,\n hideSeriesLimitWarning: props.hideSeriesLimitWarning,\n componentName: \"BarChart\",\n });\n\n const { options, annotationLookup, tooltipTimezone } = buildBarChartOptions(\n props,\n props.direction ?? \"vertical\",\n series\n );\n const hasOnClick = Boolean(props.onClick);\n\n return (\n <BarStyledBox\n $colors={colors}\n $hasOnClick={hasOnClick}\n bg=\"container.background.base\"\n >\n <ChartRenderer\n options={options}\n series={series}\n colors={colors}\n tooltip={props.tooltip}\n annotationLookup={annotationLookup}\n hasOnClick={hasOnClick}\n tooltipClickLabel={props.tooltipClickLabel}\n timezone={tooltipTimezone}\n invalidNumberLabel={props.invalidNumberLabel}\n valueFormat={props.yAxis?.format}\n onReady={props.onReady}\n />\n </BarStyledBox>\n );\n});\n","import { buildAnnotationConfig } from \"../shared/annotations\";\nimport type { ChartAnnotationLookup } from \"../shared/annotations\";\nimport type {\n SeedsChartColumnPlotOptions,\n SeedsChartOptions,\n} from \"../shared/chartBase\";\nimport { buildBaseChartOptions } from \"../shared/baseChartOptions\";\nimport {\n buildDimensionalAxis,\n resolveTooltipTimezone,\n} from \"../shared/axisOptions\";\nimport {\n defaultValueAxisLabelFormatter,\n makeValueAxisLabelFormatter,\n} from \"../shared/valueAxisLabelFormatter\";\nimport type { BarChartDirection, BarChartProps } from \"./types\";\n\n// Maps the public `direction` to the Highcharts series/chart type. Highcharts\n// `bar` is a horizontally-oriented `column`: it performs the visual rotation\n// while keeping axis roles (xAxis = category, yAxis = value), so the rest of the\n// adapter is direction-agnostic.\nfunction highchartsType(direction: BarChartDirection): \"column\" | \"bar\" {\n return direction === \"horizontal\" ? \"bar\" : \"column\";\n}\n\nexport function buildBarChartOptions(\n props: BarChartProps,\n direction: BarChartDirection,\n // The (already-capped) series to render. Defaults to `props.series` so the\n // ~40 existing call sites keep working; the component passes the capped\n // series from `useSeedsChartSetup` explicitly.\n series: BarChartProps[\"series\"] = props.series\n): {\n options: SeedsChartOptions;\n annotationLookup: ChartAnnotationLookup | undefined;\n /** Resolved timezone for the tooltip date formatter; undefined on category axes. */\n tooltipTimezone: string | undefined;\n} {\n const chartType = highchartsType(direction);\n const isDatetime = props.xAxis.type === \"datetime\";\n const tooltipTimezone = resolveTooltipTimezone(props.xAxis, props.timezone);\n const { annotations, lookup: annotationLookup } = buildAnnotationConfig(\n props.annotations\n );\n // `column` (vertical) and `bar` (horizontal) take the same option shape, so a\n // single config is assigned under the active direction's key. Typed\n // explicitly so the `point.events` handlers below keep their `this`/`event`\n // contextual types (a computed `[chartType]` key would otherwise erase them).\n const barTypeConfig: SeedsChartColumnPlotOptions = {\n // \"grouped\" maps to omitting `stacking` — Highcharts renders multi-series\n // columns side-by-side when no stacking is set.\n ...(props.stacking === \"grouped\"\n ? {}\n : { stacking: props.stacking ?? \"normal\" }),\n // Horizontal bars are height-constrained (fixed chart height ÷ categories),\n // so the same padding fractions that work for columns produce hairline bars.\n pointPadding: direction === \"horizontal\" ? 0.05 : 0.25,\n groupPadding: direction === \"horizontal\" ? 0.1 : 0.25,\n // Fixed bar width on datetime axes. Sparse time-series otherwise size\n // columns from the (large) gap between points and balloon; this mirrors\n // v1's `pointWidth: 20` time-series treatment. Dense datetime data may\n // instead want a `maxPointWidth` cap — revisit when Line/Area land.\n ...(isDatetime ? { pointWidth: 20 } : {}),\n borderRadius: 4,\n borderWidth: 0,\n // Pairs with the `:hover` dimming rule in `styles.ts`: while the cursor\n // is over the chart, all bars dim; these handlers restore opacity for\n // every bar at the hovered x (so stacked/grouped bars highlight together\n // rather than just the single hovered bar).\n point: {\n events: {\n click: props.onClick\n ? (event) => props.onClick!({ position: event.point.x })\n : undefined,\n mouseOver: function () {\n const x = this.x;\n this.series.chart.series.forEach((s) => {\n if (s.type !== chartType) return;\n s.data.forEach((point) => {\n if (point.x !== x) return;\n point.graphic?.element?.classList.add(\"bar-point-hover\");\n });\n });\n },\n mouseOut: function () {\n this.series.chart.series.forEach((s) => {\n if (s.type !== chartType) return;\n s.data.forEach((point) => {\n point.graphic?.element?.classList.remove(\"bar-point-hover\");\n });\n });\n },\n },\n },\n };\n const options: SeedsChartOptions = {\n ...buildBaseChartOptions({\n type: chartType,\n description: props.description,\n valueSuffix: props.valueSuffix,\n reserveTopMargin: Boolean(annotations),\n timezone: tooltipTimezone,\n }),\n xAxis: buildDimensionalAxis(props.xAxis, tooltipTimezone ?? \"UTC\"),\n yAxis: {\n min: props.yAxis?.min,\n max: props.yAxis?.max,\n gridLineWidth: props.yAxis?.showGridLines === false ? 0 : 1,\n title: { text: props.yAxis?.title ?? \"\" },\n labels: {\n // `showLabels` toggles tick-label visibility; defaults to shown.\n enabled: props.yAxis?.showLabels !== false,\n // A declarative `format` drives ticks through the shared valueFormatter;\n // absent it, the zero-config decimal default (1.20K / 1.20M / 1.20B).\n formatter: props.yAxis?.format\n ? makeValueAxisLabelFormatter(props.yAxis.format)\n : defaultValueAxisLabelFormatter,\n },\n },\n plotOptions: {\n series: { animation: false },\n [chartType]: barTypeConfig,\n },\n series: series.map((s) => ({\n type: chartType,\n name: s.name,\n data: [...s.data],\n color: s.color,\n })),\n ...(annotations ? { annotations } : {}),\n };\n\n return { options, annotationLookup, tooltipTimezone };\n}\n","import styled, { css } from \"styled-components\";\nimport { Box } from \"@sproutsocial/seeds-react-box\";\nimport { timeSeriesChartStyles } from \"../../styles/chartStyles\";\nimport { axisLabelV2Styles } from \"../shared/styles\";\nimport type {\n TypeChartStyleColor,\n TypeChartStyleHasOnClick,\n} from \"../../types\";\n\ntype StyleProps = Readonly<{\n $colors: ReadonlyArray<TypeChartStyleColor>;\n $hasOnClick: TypeChartStyleHasOnClick;\n}>;\n\n// Direction-neutral styling shared by the v2 bar family (vertical + horizontal).\n// Consumes only the v1 `timeSeriesChartStyles` base and owns the hover-dimming\n// block itself, keyed on the neutral `.bar-point-hover` class the adapter emits\n// — so v2 no longer imports v1 *component* styles (see `shared/styles.ts`).\nexport const barFamilyStyles = css<StyleProps>`\n ${timeSeriesChartStyles}\n\n /*\n When the chart container is hovered, dim all bars. Then restore opacity for\n the hovered bar(s) — flagged with the bar-point-hover class by the adapter —\n so the non-hovered bars fade out.\n */\n .highcharts-container:hover .highcharts-point {\n fill-opacity: 0.3;\n }\n\n .highcharts-point.bar-point-hover {\n fill-opacity: 1 !important;\n }\n`;\n\nexport const BarStyledBox = styled(Box)<StyleProps>`\n ${barFamilyStyles}\n ${axisLabelV2Styles}\n`;\n","import { css } from \"styled-components\";\n\n/**\n * v2 chart axis-label styles. v2 charts render in `styledMode` with\n * `useHTML: false`, so axis labels are SVG `<text>` / `<tspan>` rather than the\n * HTML `<span>`s v1 uses; these mirror the v1 HTML label rules in\n * `styles/chartStyles.ts` for the SVG element type.\n *\n * Kept here, separate from v1's `timeSeriesChartStyles`: v2 may *consume* the v1\n * styles, but v2-specific rules must not accrete into the v1 files — that keeps\n * the eventual v1 → v2 port clean and avoids coupling. Compose this into each v2\n * chart family's styled wrapper.\n */\nexport const axisLabelV2Styles = css`\n .highcharts-xaxis-labels,\n .highcharts-yaxis-labels {\n // SVG labels (styledMode): fill is the SVG text colour; color has no effect.\n text {\n font-family: ${({ theme }) => theme.fontFamily};\n ${({ theme }) => theme.typography[100]};\n font-weight: ${({ theme }) => theme.fontWeights.normal};\n fill: ${({ theme }) => theme.colors.text.subtext};\n }\n }\n // Two-line stacked datetime label: the boundary token is an\n // hc-axis-label-secondary tspan on a second line, rendered semibold.\n .highcharts-xaxis-labels text tspan.hc-axis-label-secondary {\n font-weight: ${({ theme }) => theme.fontWeights.semibold};\n }\n`;\n","export const BAR_CHART_DEFAULT_SERIES_LIMIT = 10;\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/bar/index.js","../../src/charts/bar/BarChart.tsx","../../src/charts/bar/adapter.ts","../../src/charts/bar/styles.ts","../../src/charts/shared/styles.ts","../../src/charts/constants.ts"],"names":["css","BarChart"],"mappings":"AAAA;AACE;AACA;AACA;AACF,uDAA6B;AAC7B;AACE;AACA;AACF,uDAA6B;AAC7B;AACE;AACA;AACA;AACF,uDAA6B;AAC7B;AACE;AACF,uDAA6B;AAC7B;AACA;AClBA,8BAAqB;ADoBrB;AACA;AEAA,SAAS,cAAA,CAAe,SAAA,EAAgD;AACtE,EAAA,OAAO,UAAA,IAAc,aAAA,EAAe,MAAA,EAAQ,QAAA;AAC9C;AAEO,SAAS,oBAAA,CACd,KAAA,EACA,SAAA,EAIA,OAAA,EAAkC,KAAA,CAAM,MAAA,EAMxC;AACA,EAAA,MAAM,UAAA,EAAY,cAAA,CAAe,SAAS,CAAA;AAC1C,EAAA,MAAM,WAAA,EAAa,KAAA,CAAM,KAAA,CAAM,KAAA,IAAS,UAAA;AACxC,EAAA,MAAM,gBAAA,EAAkB,qDAAA,KAAuB,CAAM,KAAA,EAAO,KAAA,CAAM,QAAQ,CAAA;AAC1E,EAAA,MAAM,EAAE,WAAA,EAAa,MAAA,EAAQ,iBAAiB,EAAA,EAAI,oDAAA;AAAA,IAChD,KAAA,CAAM;AAAA,EACR,CAAA;AAKA,EAAA,MAAM,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AA;AAAA,IAAA;AAAA,MACC,OAAA,EAAS,MAAA;AAAA,MACT,WAAA,EAAa,UAAA;AAAA,MACb,EAAA,EAAG,2BAAA;AAAA,MAEH,QAAA,kBAAA,6BAAA;AAAA,QAAC,8BAAA;AAAA,QAAA;AAAA,UACC,OAAA;AAAA,UACA,MAAA;AAAA,UACA,MAAA;AAAA,UACA,OAAA,EAAS,KAAA,CAAM,OAAA;AAAA,UACf,gBAAA;AAAA,UACA,UAAA;AAAA,UACA,iBAAA,EAAmB,KAAA,CAAM,iBAAA;AAAA,UACzB,QAAA,EAAU,eAAA;AAAA,UACV,kBAAA,EAAoB,KAAA,CAAM,kBAAA;AAAA,UAC1B,WAAA,kBAAa,KAAA,uBAAM,KAAA,+BAAO,QAAA;AAAA,UAC1B,OAAA,EAAS,KAAA,CAAM;AAAA,QAAA;AAAA,MACjB;AAAA,IAAA;AAAA,EACF,CAAA;AAEJ,CAAC,CAAA;AD2JD;AACE;AACF,4BAAC","file":"/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/bar/index.js","sourcesContent":[null,"import { memo } from \"react\";\nimport { useSeedsChartSetup, ChartRenderer } from \"../shared/chartBase\";\nimport { buildBarChartOptions } from \"./adapter\";\nimport { BarStyledBox } from \"./styles\";\nimport type { BarChartProps } from \"./types\";\nimport { BAR_CHART_DEFAULT_SERIES_LIMIT } from \"../constants\";\n\nexport const BarChart = memo(function BarChart(props: BarChartProps) {\n // The shared hook caps the series to the limit (and warns once per render\n // when the default is exceeded without an explicit override) so the adapter\n // and renderer below all consume the capped data.\n const seriesLimit = props.seriesLimit ?? BAR_CHART_DEFAULT_SERIES_LIMIT;\n const { colors, series } = useSeedsChartSetup({\n series: props.series,\n seriesLimit,\n isSeriesLimitOverridden: props.seriesLimit !== undefined,\n hideSeriesLimitWarning: props.hideSeriesLimitWarning,\n componentName: \"BarChart\",\n });\n\n const { options, annotationLookup, tooltipTimezone } = buildBarChartOptions(\n props,\n props.direction ?? \"vertical\",\n series\n );\n const hasOnClick = Boolean(props.onClick);\n\n return (\n <BarStyledBox\n $colors={colors}\n $hasOnClick={hasOnClick}\n bg=\"container.background.base\"\n >\n <ChartRenderer\n options={options}\n series={series}\n colors={colors}\n tooltip={props.tooltip}\n annotationLookup={annotationLookup}\n hasOnClick={hasOnClick}\n tooltipClickLabel={props.tooltipClickLabel}\n timezone={tooltipTimezone}\n invalidNumberLabel={props.invalidNumberLabel}\n valueFormat={props.yAxis?.format}\n onReady={props.onReady}\n />\n </BarStyledBox>\n );\n});\n","import { buildAnnotationConfig } from \"../shared/annotations\";\nimport type { ChartAnnotationLookup } from \"../shared/annotations\";\nimport type {\n SeedsChartColumnPlotOptions,\n SeedsChartOptions,\n} from \"../shared/chartBase\";\nimport { buildBaseChartOptions } from \"../shared/baseChartOptions\";\nimport {\n buildDimensionalAxis,\n resolveTooltipTimezone,\n} from \"../shared/axisOptions\";\nimport {\n defaultValueAxisLabelFormatter,\n makeValueAxisLabelFormatter,\n} from \"../shared/valueAxisLabelFormatter\";\nimport type { BarChartDirection, BarChartProps } from \"./types\";\n\n// Maps the public `direction` to the Highcharts series/chart type. Highcharts\n// `bar` is a horizontally-oriented `column`: it performs the visual rotation\n// while keeping axis roles (xAxis = category, yAxis = value), so the rest of the\n// adapter is direction-agnostic.\nfunction highchartsType(direction: BarChartDirection): \"column\" | \"bar\" {\n return direction === \"horizontal\" ? \"bar\" : \"column\";\n}\n\nexport function buildBarChartOptions(\n props: BarChartProps,\n direction: BarChartDirection,\n // The (already-capped) series to render. Defaults to `props.series` so the\n // ~40 existing call sites keep working; the component passes the capped\n // series from `useSeedsChartSetup` explicitly.\n series: BarChartProps[\"series\"] = props.series\n): {\n options: SeedsChartOptions;\n annotationLookup: ChartAnnotationLookup | undefined;\n /** Resolved timezone for the tooltip date formatter; undefined on category axes. */\n tooltipTimezone: string | undefined;\n} {\n const chartType = highchartsType(direction);\n const isDatetime = props.xAxis.type === \"datetime\";\n const tooltipTimezone = resolveTooltipTimezone(props.xAxis, props.timezone);\n const { annotations, lookup: annotationLookup } = buildAnnotationConfig(\n props.annotations\n );\n // `column` (vertical) and `bar` (horizontal) take the same option shape, so a\n // single config is assigned under the active direction's key. Typed\n // explicitly so the `point.events` handlers below keep their `this`/`event`\n // contextual types (a computed `[chartType]` key would otherwise erase them).\n const barTypeConfig: SeedsChartColumnPlotOptions = {\n // \"grouped\" maps to omitting `stacking` — Highcharts renders multi-series\n // columns side-by-side when no stacking is set.\n ...(props.stacking === \"grouped\"\n ? {}\n : { stacking: props.stacking ?? \"normal\" }),\n // Horizontal bars are height-constrained (fixed chart height ÷ categories),\n // so the same padding fractions that work for columns produce hairline bars.\n pointPadding: direction === \"horizontal\" ? 0.05 : 0.25,\n groupPadding: direction === \"horizontal\" ? 0.1 : 0.25,\n // Fixed bar width on datetime axes. Sparse time-series otherwise size\n // columns from the (large) gap between points and balloon; this mirrors\n // v1's `pointWidth: 20` time-series treatment. Dense datetime data may\n // instead want a `maxPointWidth` cap — revisit when Line/Area land.\n ...(isDatetime ? { pointWidth: 20 } : {}),\n borderRadius: 4,\n borderWidth: 0,\n // Pairs with the `:hover` dimming rule in `styles.ts`: while the cursor\n // is over the chart, all bars dim; these handlers restore opacity for\n // every bar at the hovered x (so stacked/grouped bars highlight together\n // rather than just the single hovered bar).\n point: {\n events: {\n click: props.onClick\n ? (event) => props.onClick!({ position: event.point.x })\n : undefined,\n mouseOver: function () {\n const x = this.x;\n this.series.chart.series.forEach((s) => {\n if (s.type !== chartType) return;\n s.data.forEach((point) => {\n if (point.x !== x) return;\n point.graphic?.element?.classList.add(\"bar-point-hover\");\n });\n });\n },\n mouseOut: function () {\n this.series.chart.series.forEach((s) => {\n if (s.type !== chartType) return;\n s.data.forEach((point) => {\n point.graphic?.element?.classList.remove(\"bar-point-hover\");\n });\n });\n },\n },\n },\n };\n const options: SeedsChartOptions = {\n ...buildBaseChartOptions({\n type: chartType,\n description: props.description,\n valueSuffix: props.valueSuffix,\n reserveTopMargin: Boolean(annotations),\n timezone: tooltipTimezone,\n }),\n xAxis: buildDimensionalAxis(props.xAxis, tooltipTimezone ?? \"UTC\"),\n yAxis: {\n min: props.yAxis?.min,\n max: props.yAxis?.max,\n gridLineWidth: props.yAxis?.showGridLines === false ? 0 : 1,\n title: { text: props.yAxis?.title ?? \"\" },\n labels: {\n // `showLabels` toggles tick-label visibility; defaults to shown.\n enabled: props.yAxis?.showLabels !== false,\n // A declarative `format` drives ticks through the shared valueFormatter;\n // absent it, the zero-config decimal default (1.20K / 1.20M / 1.20B).\n formatter: props.yAxis?.format\n ? makeValueAxisLabelFormatter(props.yAxis.format)\n : defaultValueAxisLabelFormatter,\n },\n },\n plotOptions: {\n series: { animation: false },\n [chartType]: barTypeConfig,\n },\n series: series.map((s) => ({\n type: chartType,\n name: s.name,\n data: [...s.data],\n color: s.color,\n })),\n ...(annotations ? { annotations } : {}),\n };\n\n return { options, annotationLookup, tooltipTimezone };\n}\n","import styled, { css } from \"styled-components\";\nimport { Box } from \"@sproutsocial/seeds-react-box\";\nimport { timeSeriesChartStyles } from \"../../styles/chartStyles\";\nimport { axisLabelV2Styles } from \"../shared/styles\";\nimport type {\n TypeChartStyleColor,\n TypeChartStyleHasOnClick,\n} from \"../../types\";\n\ntype StyleProps = Readonly<{\n $colors: ReadonlyArray<TypeChartStyleColor>;\n $hasOnClick: TypeChartStyleHasOnClick;\n}>;\n\n// Direction-neutral styling shared by the v2 bar family (vertical + horizontal).\n// Consumes only the v1 `timeSeriesChartStyles` base and owns the hover-dimming\n// block itself, keyed on the neutral `.bar-point-hover` class the adapter emits\n// — so v2 no longer imports v1 *component* styles (see `shared/styles.ts`).\nexport const barFamilyStyles = css<StyleProps>`\n ${timeSeriesChartStyles}\n\n /*\n When the chart container is hovered, dim all bars. Then restore opacity for\n the hovered bar(s) — flagged with the bar-point-hover class by the adapter —\n so the non-hovered bars fade out.\n */\n .highcharts-container:hover .highcharts-point {\n fill-opacity: 0.3;\n }\n\n .highcharts-point.bar-point-hover {\n fill-opacity: 1 !important;\n }\n`;\n\nexport const BarStyledBox = styled(Box)<StyleProps>`\n ${barFamilyStyles}\n ${axisLabelV2Styles}\n`;\n","import { css } from \"styled-components\";\n\n/**\n * v2 chart axis-label styles. v2 charts render in `styledMode` with\n * `useHTML: false`, so axis labels are SVG `<text>` / `<tspan>` rather than the\n * HTML `<span>`s v1 uses; these mirror the v1 HTML label rules in\n * `styles/chartStyles.ts` for the SVG element type.\n *\n * Kept here, separate from v1's `timeSeriesChartStyles`: v2 may *consume* the v1\n * styles, but v2-specific rules must not accrete into the v1 files — that keeps\n * the eventual v1 → v2 port clean and avoids coupling. Compose this into each v2\n * chart family's styled wrapper.\n */\nexport const axisLabelV2Styles = css`\n .highcharts-xaxis-labels,\n .highcharts-yaxis-labels {\n // SVG labels (styledMode): fill is the SVG text colour; color has no effect.\n text {\n font-family: ${({ theme }) => theme.fontFamily};\n ${({ theme }) => theme.typography[100]};\n font-weight: ${({ theme }) => theme.fontWeights.normal};\n fill: ${({ theme }) => theme.colors.text.subtext};\n }\n }\n // Two-line stacked datetime label: the boundary token is an\n // hc-axis-label-secondary tspan on a second line, rendered semibold.\n .highcharts-xaxis-labels text tspan.hc-axis-label-secondary {\n font-weight: ${({ theme }) => theme.fontWeights.semibold};\n }\n`;\n","export const BAR_CHART_DEFAULT_SERIES_LIMIT = 10;\n"]}
|
|
@@ -30,12 +30,16 @@ interface ChartTooltipDataRow {
|
|
|
30
30
|
color: TypeChartStyleColor;
|
|
31
31
|
name: string;
|
|
32
32
|
value: number | null;
|
|
33
|
+
/** Slice percentage — populated by pie/donut tooltips; `undefined` for bar/line-area rows. */
|
|
34
|
+
percent?: number;
|
|
33
35
|
}
|
|
34
36
|
/** Tooltip render-prop signature for v2 charts. */
|
|
35
37
|
interface ChartTooltipProps {
|
|
36
38
|
data: ChartTooltipDataRow[];
|
|
37
39
|
/** Resolved x-axis position. Category name for category axes, numeric for time/linear. */
|
|
38
40
|
position: number | string;
|
|
41
|
+
/** Suppress the default tooltip's title row. Set for pie/donut, which have no x-axis position — the title would just duplicate the single slice's name. */
|
|
42
|
+
hideTitle?: boolean;
|
|
39
43
|
/** Resolved chart timezone — pass to date formatters when `position` is a numeric timestamp. Undefined on category axes. */
|
|
40
44
|
timezone?: string;
|
|
41
45
|
/** Declarative annotation anchored at this position, if any. Rendered in the tooltip header. */
|
|
@@ -55,62 +59,4 @@ interface ChartTooltipProps {
|
|
|
55
59
|
valueFormat?: ValueFormat;
|
|
56
60
|
}
|
|
57
61
|
|
|
58
|
-
|
|
59
|
-
* Declarative annotation shape — the DS renders the marker and tooltip header
|
|
60
|
-
* internally; consumers don't supply render functions. See CE-7.
|
|
61
|
-
*/
|
|
62
|
-
interface ChartAnnotation {
|
|
63
|
-
/** Numeric x-axis coordinate — a category index (category axes) or the raw coordinate (datetime/linear axes). */
|
|
64
|
-
position: number;
|
|
65
|
-
/** Icon shown above the chart at `position` and inline with `title` in the tooltip header. */
|
|
66
|
-
icon?: TypeIconName;
|
|
67
|
-
/** Color applied to the marker's vertical line. */
|
|
68
|
-
color?: string;
|
|
69
|
-
/** Tooltip header line 1. */
|
|
70
|
-
title?: string;
|
|
71
|
-
/** Tooltip header line 2. */
|
|
72
|
-
description?: string;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Pure, Highcharts-free datetime axis label formatter for v2 chart families.
|
|
77
|
-
*
|
|
78
|
-
* Ports v1's `helpers/xAxisLabelFormatter` into a rendering-agnostic shape: it
|
|
79
|
-
* returns a `{ primary, secondary? }` object instead of an HTML string, leaving
|
|
80
|
-
* SVG rendering to the caller. The timezone- and DST-correct boundary detection
|
|
81
|
-
* (calendar parts read in the target timezone) and the per-granularity
|
|
82
|
-
* `Intl.DateTimeFormat` option sets are a near-verbatim port of v1.
|
|
83
|
-
*
|
|
84
|
-
* The one net-new piece versus v1 is granularity derivation: v1 receives
|
|
85
|
-
* `unitName` from Highcharts, but `charts/` may not depend on Highcharts types
|
|
86
|
-
* (see `charts/README.md` invariants), so granularity is derived from the
|
|
87
|
-
* spacing of `tickPositions`.
|
|
88
|
-
*/
|
|
89
|
-
type DatetimeTimeFormat = "12" | "24";
|
|
90
|
-
|
|
91
|
-
/** A datetime data point: `[msSinceEpoch, value]` tuple or `{ x, y }` object. */
|
|
92
|
-
type DatetimePoint = [number, number | null] | {
|
|
93
|
-
x: number;
|
|
94
|
-
y: number | null;
|
|
95
|
-
};
|
|
96
|
-
/** A value on a category axis, or a datetime point when the axis is `"datetime"`. */
|
|
97
|
-
type ChartDataPoint = number | null | DatetimePoint;
|
|
98
|
-
/** Category axis — labels indexed parallel to `series.data`. The default axis type. */
|
|
99
|
-
interface CategoryAxis {
|
|
100
|
-
type?: "category";
|
|
101
|
-
/** Category labels, indexed parallel to `series.data`. */
|
|
102
|
-
categories: Array<string>;
|
|
103
|
-
crosshair?: boolean;
|
|
104
|
-
}
|
|
105
|
-
/** Datetime axis — `series.data` carries timestamped points. */
|
|
106
|
-
interface DatetimeAxis {
|
|
107
|
-
type: "datetime";
|
|
108
|
-
crosshair?: boolean;
|
|
109
|
-
/**
|
|
110
|
-
* 12- or 24-hour clock for hour-granularity tick labels (e.g. `9 AM` vs
|
|
111
|
-
* `09:00`). Default `"12"`. Coarser granularities (day/month/year) ignore it.
|
|
112
|
-
*/
|
|
113
|
-
timeFormat?: DatetimeTimeFormat;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export type { ChartDataPoint as C, DatetimeAxis as D, ValueFormat as V, CategoryAxis as a, ChartTooltipProps as b, ChartAnnotation as c, DatetimePoint as d };
|
|
62
|
+
export type { ChartTooltipProps as C, ValueFormat as V, ChartTooltipDataRow as a };
|
|
@@ -30,12 +30,16 @@ interface ChartTooltipDataRow {
|
|
|
30
30
|
color: TypeChartStyleColor;
|
|
31
31
|
name: string;
|
|
32
32
|
value: number | null;
|
|
33
|
+
/** Slice percentage — populated by pie/donut tooltips; `undefined` for bar/line-area rows. */
|
|
34
|
+
percent?: number;
|
|
33
35
|
}
|
|
34
36
|
/** Tooltip render-prop signature for v2 charts. */
|
|
35
37
|
interface ChartTooltipProps {
|
|
36
38
|
data: ChartTooltipDataRow[];
|
|
37
39
|
/** Resolved x-axis position. Category name for category axes, numeric for time/linear. */
|
|
38
40
|
position: number | string;
|
|
41
|
+
/** Suppress the default tooltip's title row. Set for pie/donut, which have no x-axis position — the title would just duplicate the single slice's name. */
|
|
42
|
+
hideTitle?: boolean;
|
|
39
43
|
/** Resolved chart timezone — pass to date formatters when `position` is a numeric timestamp. Undefined on category axes. */
|
|
40
44
|
timezone?: string;
|
|
41
45
|
/** Declarative annotation anchored at this position, if any. Rendered in the tooltip header. */
|
|
@@ -55,62 +59,4 @@ interface ChartTooltipProps {
|
|
|
55
59
|
valueFormat?: ValueFormat;
|
|
56
60
|
}
|
|
57
61
|
|
|
58
|
-
|
|
59
|
-
* Declarative annotation shape — the DS renders the marker and tooltip header
|
|
60
|
-
* internally; consumers don't supply render functions. See CE-7.
|
|
61
|
-
*/
|
|
62
|
-
interface ChartAnnotation {
|
|
63
|
-
/** Numeric x-axis coordinate — a category index (category axes) or the raw coordinate (datetime/linear axes). */
|
|
64
|
-
position: number;
|
|
65
|
-
/** Icon shown above the chart at `position` and inline with `title` in the tooltip header. */
|
|
66
|
-
icon?: TypeIconName;
|
|
67
|
-
/** Color applied to the marker's vertical line. */
|
|
68
|
-
color?: string;
|
|
69
|
-
/** Tooltip header line 1. */
|
|
70
|
-
title?: string;
|
|
71
|
-
/** Tooltip header line 2. */
|
|
72
|
-
description?: string;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Pure, Highcharts-free datetime axis label formatter for v2 chart families.
|
|
77
|
-
*
|
|
78
|
-
* Ports v1's `helpers/xAxisLabelFormatter` into a rendering-agnostic shape: it
|
|
79
|
-
* returns a `{ primary, secondary? }` object instead of an HTML string, leaving
|
|
80
|
-
* SVG rendering to the caller. The timezone- and DST-correct boundary detection
|
|
81
|
-
* (calendar parts read in the target timezone) and the per-granularity
|
|
82
|
-
* `Intl.DateTimeFormat` option sets are a near-verbatim port of v1.
|
|
83
|
-
*
|
|
84
|
-
* The one net-new piece versus v1 is granularity derivation: v1 receives
|
|
85
|
-
* `unitName` from Highcharts, but `charts/` may not depend on Highcharts types
|
|
86
|
-
* (see `charts/README.md` invariants), so granularity is derived from the
|
|
87
|
-
* spacing of `tickPositions`.
|
|
88
|
-
*/
|
|
89
|
-
type DatetimeTimeFormat = "12" | "24";
|
|
90
|
-
|
|
91
|
-
/** A datetime data point: `[msSinceEpoch, value]` tuple or `{ x, y }` object. */
|
|
92
|
-
type DatetimePoint = [number, number | null] | {
|
|
93
|
-
x: number;
|
|
94
|
-
y: number | null;
|
|
95
|
-
};
|
|
96
|
-
/** A value on a category axis, or a datetime point when the axis is `"datetime"`. */
|
|
97
|
-
type ChartDataPoint = number | null | DatetimePoint;
|
|
98
|
-
/** Category axis — labels indexed parallel to `series.data`. The default axis type. */
|
|
99
|
-
interface CategoryAxis {
|
|
100
|
-
type?: "category";
|
|
101
|
-
/** Category labels, indexed parallel to `series.data`. */
|
|
102
|
-
categories: Array<string>;
|
|
103
|
-
crosshair?: boolean;
|
|
104
|
-
}
|
|
105
|
-
/** Datetime axis — `series.data` carries timestamped points. */
|
|
106
|
-
interface DatetimeAxis {
|
|
107
|
-
type: "datetime";
|
|
108
|
-
crosshair?: boolean;
|
|
109
|
-
/**
|
|
110
|
-
* 12- or 24-hour clock for hour-granularity tick labels (e.g. `9 AM` vs
|
|
111
|
-
* `09:00`). Default `"12"`. Coarser granularities (day/month/year) ignore it.
|
|
112
|
-
*/
|
|
113
|
-
timeFormat?: DatetimeTimeFormat;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export type { ChartDataPoint as C, DatetimeAxis as D, ValueFormat as V, CategoryAxis as a, ChartTooltipProps as b, ChartAnnotation as c, DatetimePoint as d };
|
|
62
|
+
export type { ChartTooltipProps as C, ValueFormat as V, ChartTooltipDataRow as a };
|