@ember-joinery/chart 0.0.0-stage → 1.1.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/CHANGELOG.md +189 -0
- package/LICENSE.md +9 -0
- package/NOTICE +532 -0
- package/README.md +69 -2
- package/addon-main.cjs +4 -0
- package/declarations/-private/cartesian-chart.d.ts +413 -0
- package/declarations/-private/cartesian-chart.d.ts.map +1 -0
- package/declarations/-private/cartesian.d.ts +236 -0
- package/declarations/-private/cartesian.d.ts.map +1 -0
- package/declarations/-private/config.d.ts +13 -0
- package/declarations/-private/config.d.ts.map +1 -0
- package/declarations/-private/dots.d.ts +27 -0
- package/declarations/-private/dots.d.ts.map +1 -0
- package/declarations/-private/nice-ticks.d.ts +17 -0
- package/declarations/-private/nice-ticks.d.ts.map +1 -0
- package/declarations/-private/parts.d.ts +596 -0
- package/declarations/-private/parts.d.ts.map +1 -0
- package/declarations/-private/paths.d.ts +26 -0
- package/declarations/-private/paths.d.ts.map +1 -0
- package/declarations/-private/pie-chart.d.ts +244 -0
- package/declarations/-private/pie-chart.d.ts.map +1 -0
- package/declarations/-private/polar-chart.d.ts +423 -0
- package/declarations/-private/polar-chart.d.ts.map +1 -0
- package/declarations/-private/polar-geometry.d.ts +230 -0
- package/declarations/-private/polar-geometry.d.ts.map +1 -0
- package/declarations/-private/polar-parts.d.ts +315 -0
- package/declarations/-private/polar-parts.d.ts.map +1 -0
- package/declarations/-private/polar.d.ts +156 -0
- package/declarations/-private/polar.d.ts.map +1 -0
- package/declarations/-private/registry.d.ts +9 -0
- package/declarations/-private/registry.d.ts.map +1 -0
- package/declarations/-private/text-size.d.ts +13 -0
- package/declarations/-private/text-size.d.ts.map +1 -0
- package/declarations/-private/tick-interval.d.ts +35 -0
- package/declarations/-private/tick-interval.d.ts.map +1 -0
- package/declarations/components/area-chart.d.ts +16 -0
- package/declarations/components/area-chart.d.ts.map +1 -0
- package/declarations/components/bar-chart.d.ts +16 -0
- package/declarations/components/bar-chart.d.ts.map +1 -0
- package/declarations/components/chart-container.d.ts +66 -0
- package/declarations/components/chart-container.d.ts.map +1 -0
- package/declarations/components/chart-legend-content.d.ts +42 -0
- package/declarations/components/chart-legend-content.d.ts.map +1 -0
- package/declarations/components/chart-style.d.ts +19 -0
- package/declarations/components/chart-style.d.ts.map +1 -0
- package/declarations/components/chart-tooltip-content.d.ts +94 -0
- package/declarations/components/chart-tooltip-content.d.ts.map +1 -0
- package/declarations/components/dot.d.ts +22 -0
- package/declarations/components/dot.d.ts.map +1 -0
- package/declarations/components/line-chart.d.ts +16 -0
- package/declarations/components/line-chart.d.ts.map +1 -0
- package/declarations/components/pie-chart.d.ts +13 -0
- package/declarations/components/pie-chart.d.ts.map +1 -0
- package/declarations/components/radar-chart.d.ts +21 -0
- package/declarations/components/radar-chart.d.ts.map +1 -0
- package/declarations/components/radial-bar-chart.d.ts +17 -0
- package/declarations/components/radial-bar-chart.d.ts.map +1 -0
- package/declarations/components/rectangle.d.ts +32 -0
- package/declarations/components/rectangle.d.ts.map +1 -0
- package/declarations/components/sector.d.ts +47 -0
- package/declarations/components/sector.d.ts.map +1 -0
- package/declarations/index.d.ts +24 -0
- package/declarations/index.d.ts.map +1 -0
- package/declarations/test-support/chart.d.ts +162 -0
- package/declarations/test-support/chart.d.ts.map +1 -0
- package/declarations/test-support/index.d.ts +3 -0
- package/declarations/test-support/index.d.ts.map +1 -0
- package/declarations/test-support/polar-chart.d.ts +62 -0
- package/declarations/test-support/polar-chart.d.ts.map +1 -0
- package/declarations/test-support.d.ts +2 -0
- package/declarations/types.d.ts +138 -0
- package/declarations/types.d.ts.map +1 -0
- package/dist/cartesian-D9hWDamz.js +1217 -0
- package/dist/cartesian-D9hWDamz.js.map +1 -0
- package/dist/cartesian-chart-BLj6Q_OB.js +1123 -0
- package/dist/cartesian-chart-BLj6Q_OB.js.map +1 -0
- package/dist/components/area-chart.js +20 -0
- package/dist/components/area-chart.js.map +1 -0
- package/dist/components/bar-chart.js +20 -0
- package/dist/components/bar-chart.js.map +1 -0
- package/dist/components/chart-container.js +54 -0
- package/dist/components/chart-container.js.map +1 -0
- package/dist/components/chart-legend-content.js +48 -0
- package/dist/components/chart-legend-content.js.map +1 -0
- package/dist/components/chart-style.js +35 -0
- package/dist/components/chart-style.js.map +1 -0
- package/dist/components/chart-tooltip-content.js +131 -0
- package/dist/components/chart-tooltip-content.js.map +1 -0
- package/dist/components/dot.js +18 -0
- package/dist/components/dot.js.map +1 -0
- package/dist/components/line-chart.js +20 -0
- package/dist/components/line-chart.js.map +1 -0
- package/dist/components/pie-chart.js +6 -0
- package/dist/components/pie-chart.js.map +1 -0
- package/dist/components/radar-chart.js +22 -0
- package/dist/components/radar-chart.js.map +1 -0
- package/dist/components/radial-bar-chart.js +20 -0
- package/dist/components/radial-bar-chart.js.map +1 -0
- package/dist/components/rectangle.js +5 -0
- package/dist/components/rectangle.js.map +1 -0
- package/dist/components/sector.js +5 -0
- package/dist/components/sector.js.map +1 -0
- package/dist/config-DnsUmxOT.js +35 -0
- package/dist/config-DnsUmxOT.js.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/parts-BWLhFFjB.js +355 -0
- package/dist/parts-BWLhFFjB.js.map +1 -0
- package/dist/pie-chart-CmDtW_Ge.js +646 -0
- package/dist/pie-chart-CmDtW_Ge.js.map +1 -0
- package/dist/polar-chart-GhgOSsH9.js +2242 -0
- package/dist/polar-chart-GhgOSsH9.js.map +1 -0
- package/dist/rectangle-Cl7tbXuZ.js +166 -0
- package/dist/rectangle-Cl7tbXuZ.js.map +1 -0
- package/dist/sector-7shQPJuQ.js +565 -0
- package/dist/sector-7shQPJuQ.js.map +1 -0
- package/dist/test-support.js +470 -0
- package/dist/test-support.js.map +1 -0
- package/dist/types.js +56 -0
- package/dist/types.js.map +1 -0
- package/package.json +117 -3
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import type { WithBoundArgs } from '@glint/template';
|
|
3
|
+
import AreaChart from './area-chart';
|
|
4
|
+
import BarChart from './bar-chart';
|
|
5
|
+
import LineChart from './line-chart';
|
|
6
|
+
import PieChart from './pie-chart';
|
|
7
|
+
import RadarChart from './radar-chart';
|
|
8
|
+
import RadialBarChart from './radial-bar-chart';
|
|
9
|
+
import type { ChartConfig } from '../types.ts';
|
|
10
|
+
/** What `ChartContainer` yields: the charts, each given the container's config. */
|
|
11
|
+
export interface ChartContainerParts {
|
|
12
|
+
/** An area chart: recharts' `AreaChart`. */
|
|
13
|
+
AreaChart: WithBoundArgs<typeof AreaChart, 'config' | 'inContainer' | 'initialDimension'>;
|
|
14
|
+
/** A bar chart: recharts' `BarChart`. */
|
|
15
|
+
BarChart: WithBoundArgs<typeof BarChart, 'config' | 'inContainer' | 'initialDimension'>;
|
|
16
|
+
/** A line chart: recharts' `LineChart`. */
|
|
17
|
+
LineChart: WithBoundArgs<typeof LineChart, 'config' | 'inContainer' | 'initialDimension'>;
|
|
18
|
+
/** A pie chart: recharts' `PieChart`. */
|
|
19
|
+
PieChart: WithBoundArgs<typeof PieChart, 'config' | 'inContainer' | 'initialDimension'>;
|
|
20
|
+
/** A radar chart: recharts' `RadarChart`. */
|
|
21
|
+
RadarChart: WithBoundArgs<typeof RadarChart, 'config' | 'inContainer' | 'initialDimension'>;
|
|
22
|
+
/** A radial bar chart: recharts' `RadialBarChart`. */
|
|
23
|
+
RadialBarChart: WithBoundArgs<typeof RadialBarChart, 'config' | 'inContainer' | 'initialDimension'>;
|
|
24
|
+
}
|
|
25
|
+
export interface ChartContainerSignature {
|
|
26
|
+
Args: {
|
|
27
|
+
/** The labels, icons and colours of the chart's series. */
|
|
28
|
+
config: ChartConfig;
|
|
29
|
+
/** The chart's id, in `data-chart`. Default a unique one. */
|
|
30
|
+
id?: string;
|
|
31
|
+
/** The chart's name, for its harness (`data-test-jn-name`). */
|
|
32
|
+
name?: string;
|
|
33
|
+
/**
|
|
34
|
+
* The size the chart draws at before the container has been measured (and in a page
|
|
35
|
+
* rendered on the server), as shadcn's `initialDimension`. Default 320 × 200.
|
|
36
|
+
*/
|
|
37
|
+
initialDimension?: {
|
|
38
|
+
width: number;
|
|
39
|
+
height: number;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
Blocks: {
|
|
43
|
+
/** The chart, from the parts it yields: `<ChartContainer as |chart|><chart.BarChart …>`. */
|
|
44
|
+
default: [ChartContainerParts];
|
|
45
|
+
};
|
|
46
|
+
Element: HTMLDivElement;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The box a chart draws in, and its colours: shadcn's `ChartContainer`. It sets a
|
|
50
|
+
* `--color-<key>` variable for each series in `@config`, and yields the charts, which fill it
|
|
51
|
+
* (keep a height, a `min-h-*` or an aspect ratio on it; it is `aspect-video` by default).
|
|
52
|
+
*
|
|
53
|
+
* <ChartContainer @config={{chartConfig}} class="min-h-[200px] w-full" as |chart|>
|
|
54
|
+
* <chart.BarChart @data={{chartData}} as |c|>
|
|
55
|
+
* <c.Bar @dataKey="desktop" @fill="var(--color-desktop)" @radius={{4}} />
|
|
56
|
+
* </chart.BarChart>
|
|
57
|
+
* </ChartContainer>
|
|
58
|
+
*/
|
|
59
|
+
export default class ChartContainer extends Component<ChartContainerSignature> {
|
|
60
|
+
get chartId(): string;
|
|
61
|
+
get initialDimension(): {
|
|
62
|
+
width: number;
|
|
63
|
+
height: number;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=chart-container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart-container.d.ts","sourceRoot":"","sources":["../../src/components/chart-container.gts"],"names":[],"mappings":"AA+GA,OAAO,SAAS,MAAM,oBAAoB,CAAA;AAE1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAGpD,OAAO,SAAS,MAAM,kBAAkB,CAAA;AACxC,OAAO,QAAQ,MAAM,iBAAiB,CAAA;AACtC,OAAO,SAAS,MAAM,kBAAkB,CAAA;AACxC,OAAO,QAAQ,MAAM,iBAAiB,CAAA;AACtC,OAAO,UAAU,MAAM,mBAAmB,CAAA;AAC1C,OAAO,cAAc,MAAM,wBAAwB,CAAA;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,mFAAmF;AACnF,MAAM,WAAW,mBAAmB;IAClC,4CAA4C;IAC5C,SAAS,EAAE,aAAa,CAAC,OAAO,SAAS,EAAE,QAAQ,GAAG,aAAa,GAAG,kBAAkB,CAAC,CAAA;IACzF,yCAAyC;IACzC,QAAQ,EAAE,aAAa,CAAC,OAAO,QAAQ,EAAE,QAAQ,GAAG,aAAa,GAAG,kBAAkB,CAAC,CAAA;IACvF,2CAA2C;IAC3C,SAAS,EAAE,aAAa,CAAC,OAAO,SAAS,EAAE,QAAQ,GAAG,aAAa,GAAG,kBAAkB,CAAC,CAAA;IACzF,yCAAyC;IACzC,QAAQ,EAAE,aAAa,CAAC,OAAO,QAAQ,EAAE,QAAQ,GAAG,aAAa,GAAG,kBAAkB,CAAC,CAAA;IACvF,6CAA6C;IAC7C,UAAU,EAAE,aAAa,CAAC,OAAO,UAAU,EAAE,QAAQ,GAAG,aAAa,GAAG,kBAAkB,CAAC,CAAA;IAC3F,sDAAsD;IACtD,cAAc,EAAE,aAAa,CAC3B,OAAO,cAAc,EACrB,QAAQ,GAAG,aAAa,GAAG,kBAAkB,CAC9C,CAAA;CACF;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE;QACJ,2DAA2D;QAC3D,MAAM,EAAE,WAAW,CAAA;QACnB,6DAA6D;QAC7D,EAAE,CAAC,EAAE,MAAM,CAAA;QACX,+DAA+D;QAC/D,IAAI,CAAC,EAAE,MAAM,CAAA;QACb;;;WAGG;QACH,gBAAgB,CAAC,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAA;KACrD,CAAA;IACD,MAAM,EAAE;QACN,4FAA4F;QAC5F,OAAO,EAAE,CAAC,mBAAmB,CAAC,CAAA;KAC/B,CAAA;IACD,OAAO,EAAE,cAAc,CAAA;CACxB;AAKD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,SAAS,CAAC,uBAAuB,CAAC;IAC5E,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,IAAI,gBAAgB,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAExD;CAuCF"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { type SafeString } from '@ember/template';
|
|
3
|
+
import type { ComponentLike } from '@glint/template';
|
|
4
|
+
import { type IconNode } from '@ember-joinery/ember/components/icon';
|
|
5
|
+
import type { ChartConfig, LegendPayloadItem } from '../types.ts';
|
|
6
|
+
export interface ChartLegendContentSignature {
|
|
7
|
+
Args: {
|
|
8
|
+
/** The legend's entries; the chart passes them. */
|
|
9
|
+
payload?: readonly LegendPayloadItem[];
|
|
10
|
+
/** Where the legend sits; the chart passes it. `top` puts the space below it. */
|
|
11
|
+
verticalAlign?: 'top' | 'middle' | 'bottom';
|
|
12
|
+
/** The chart's config; the chart passes the container's. */
|
|
13
|
+
config?: ChartConfig;
|
|
14
|
+
/** Shows a swatch even where the config has an icon. */
|
|
15
|
+
hideIcon?: boolean;
|
|
16
|
+
/** The config or row key to name the entries by. Default each entry's data key. */
|
|
17
|
+
nameKey?: string;
|
|
18
|
+
/** Classes for the legend, for use in a curried `@content`. */
|
|
19
|
+
class?: string;
|
|
20
|
+
};
|
|
21
|
+
Element: HTMLDivElement;
|
|
22
|
+
}
|
|
23
|
+
interface Entry {
|
|
24
|
+
key: string;
|
|
25
|
+
label: string;
|
|
26
|
+
iconNode?: IconNode;
|
|
27
|
+
iconComponent?: ComponentLike<{
|
|
28
|
+
Element: Element;
|
|
29
|
+
}>;
|
|
30
|
+
swatchStyle: SafeString;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A chart legend: each series' colour (or its config icon) and its config label, in a centred
|
|
34
|
+
* row. shadcn's `ChartLegendContent`; give it to a chart's legend as its content:
|
|
35
|
+
*
|
|
36
|
+
* <c.ChartLegend @content={{component ChartLegendContent nameKey="browser"}} />
|
|
37
|
+
*/
|
|
38
|
+
export default class ChartLegendContent extends Component<ChartLegendContentSignature> {
|
|
39
|
+
get entries(): Entry[];
|
|
40
|
+
}
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=chart-legend-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart-legend-content.d.ts","sourceRoot":"","sources":["../../src/components/chart-legend-content.gts"],"names":[],"mappings":"AAmGA,OAAO,SAAS,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAa,EAAE,KAAK,QAAQ,EAAE,MAAM,sCAAsC,CAAA;AAE1E,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAEjE,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE;QACJ,mDAAmD;QACnD,OAAO,CAAC,EAAE,SAAS,iBAAiB,EAAE,CAAA;QACtC,iFAAiF;QACjF,aAAa,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAA;QAC3C,4DAA4D;QAC5D,MAAM,CAAC,EAAE,WAAW,CAAA;QACpB,wDAAwD;QACxD,QAAQ,CAAC,EAAE,OAAO,CAAA;QAClB,mFAAmF;QACnF,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,+DAA+D;QAC/D,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,CAAA;IACD,OAAO,EAAE,cAAc,CAAA;CACxB;AAED,UAAU,KAAK;IACb,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,aAAa,CAAC,EAAE,aAAa,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAA;IACnD,WAAW,EAAE,UAAU,CAAA;CACxB;AAED;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,SAAS,CAAC,2BAA2B,CAAC;IACpF,IAAI,OAAO,IAAI,KAAK,EAAE,CAqBrB;CA0EF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { type ChartConfig } from '../types.ts';
|
|
3
|
+
export interface ChartStyleSignature {
|
|
4
|
+
Args: {
|
|
5
|
+
/** The chart's id, as its `data-chart` attribute holds it. */
|
|
6
|
+
id: string;
|
|
7
|
+
config: ChartConfig;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The `<style>` that gives a chart its colours: `--color-<key>` for each config entry with a
|
|
12
|
+
* `color` (or a `theme`, with its dark colour under `.dark`), scoped to `[data-chart=<id>]`.
|
|
13
|
+
* `ChartContainer` renders it; render it yourself only for a chart outside one. shadcn's
|
|
14
|
+
* `ChartStyle`.
|
|
15
|
+
*/
|
|
16
|
+
export default class ChartStyle extends Component<ChartStyleSignature> {
|
|
17
|
+
get css(): string | null;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=chart-style.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart-style.d.ts","sourceRoot":"","sources":["../../src/components/chart-style.gts"],"names":[],"mappings":"AAkDA,OAAO,SAAS,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAGtD,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE;QACJ,8DAA8D;QAC9D,EAAE,EAAE,MAAM,CAAA;QACV,MAAM,EAAE,WAAW,CAAA;KACpB,CAAA;CACF;AAED;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,SAAS,CAAC,mBAAmB,CAAC;IACpE,IAAI,GAAG,IAAI,MAAM,GAAG,IAAI,CAqBvB;CAaF"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { type SafeString } from '@ember/template';
|
|
3
|
+
import type { ComponentLike } from '@glint/template';
|
|
4
|
+
import { type IconNode } from '@ember-joinery/ember/components/icon';
|
|
5
|
+
import type { ChartConfig, ChartIcon, ChartTooltipContentArgs, LabelFormatter, TooltipFormatter, TooltipFormatterSignature, TooltipPayloadItem } from '../types.ts';
|
|
6
|
+
/** How a tooltip marks each series: a square `dot`, a `line`, or a `dashed` line. */
|
|
7
|
+
export type ChartTooltipIndicator = 'dot' | 'line' | 'dashed';
|
|
8
|
+
export interface ChartTooltipContentSignature {
|
|
9
|
+
Args: {
|
|
10
|
+
/** Whether the tooltip is showing; the chart passes it. */
|
|
11
|
+
active?: boolean;
|
|
12
|
+
/** The entries at the active row; the chart passes them. */
|
|
13
|
+
payload?: readonly TooltipPayloadItem[];
|
|
14
|
+
/** The active row's category; the chart passes it. */
|
|
15
|
+
label?: unknown;
|
|
16
|
+
/** The chart's config; the chart passes the container's. */
|
|
17
|
+
config?: ChartConfig;
|
|
18
|
+
/** Where the tooltip points; the chart passes it. Unused. */
|
|
19
|
+
coordinate?: {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
};
|
|
23
|
+
/** The chart tooltip's own label class and formatters; the chart passes them. */
|
|
24
|
+
tooltip?: ChartTooltipContentArgs['tooltip'];
|
|
25
|
+
/** Hides the label. */
|
|
26
|
+
hideLabel?: boolean;
|
|
27
|
+
/** Hides each entry's indicator. */
|
|
28
|
+
hideIndicator?: boolean;
|
|
29
|
+
/** `dot` (default), `line` or `dashed`. */
|
|
30
|
+
indicator?: ChartTooltipIndicator;
|
|
31
|
+
/** The config or row key to name the entries by. Default each entry's name. */
|
|
32
|
+
nameKey?: string;
|
|
33
|
+
/** The config or data key to label the tooltip by. Default the active row's category. */
|
|
34
|
+
labelKey?: string;
|
|
35
|
+
/** Formats the label. */
|
|
36
|
+
labelFormatter?: LabelFormatter;
|
|
37
|
+
/** Classes for the label. */
|
|
38
|
+
labelClassName?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Formats each entry, in place of its indicator, name and value: a function returning its
|
|
41
|
+
* text, or a component that draws it (for markup, as recharts' formatter can return).
|
|
42
|
+
*/
|
|
43
|
+
formatter?: TooltipFormatter;
|
|
44
|
+
/** One indicator colour for every entry. Default each entry's `fill` (in its row) or colour. */
|
|
45
|
+
color?: string;
|
|
46
|
+
/** Classes for the tooltip box, for use in a curried `@content`: `class="w-[150px]"`. */
|
|
47
|
+
class?: string;
|
|
48
|
+
};
|
|
49
|
+
Element: HTMLDivElement;
|
|
50
|
+
}
|
|
51
|
+
interface Entry {
|
|
52
|
+
key: string;
|
|
53
|
+
name: string;
|
|
54
|
+
value: string | null;
|
|
55
|
+
icon?: ChartIcon;
|
|
56
|
+
iconNode?: IconNode;
|
|
57
|
+
iconComponent?: ComponentLike<{
|
|
58
|
+
Element: Element;
|
|
59
|
+
}>;
|
|
60
|
+
indicatorStyle: SafeString;
|
|
61
|
+
/** Whether a formatter function drew the entry, and its text (which may be empty). */
|
|
62
|
+
isFormatted?: boolean;
|
|
63
|
+
formatted?: string;
|
|
64
|
+
/** What the formatter component is handed. */
|
|
65
|
+
custom?: Omit<TooltipFormatterSignature['Args'], 'config'>;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* A chart tooltip's box: the active row's label, then each series with its colour, name and
|
|
69
|
+
* value. shadcn's `ChartTooltipContent`; give it to a chart's tooltip as its content, with any
|
|
70
|
+
* of its arguments curried in:
|
|
71
|
+
*
|
|
72
|
+
* <c.ChartTooltip @content={{component ChartTooltipContent indicator="line"}} />
|
|
73
|
+
*
|
|
74
|
+
* It draws nothing while the tooltip is inactive or empty. It also renders on its own, given
|
|
75
|
+
* `@active`, `@payload` and `@label`.
|
|
76
|
+
*/
|
|
77
|
+
export default class ChartTooltipContent extends Component<ChartTooltipContentSignature> {
|
|
78
|
+
get indicator(): ChartTooltipIndicator;
|
|
79
|
+
get visible(): boolean;
|
|
80
|
+
get labelFormatter(): LabelFormatter | undefined;
|
|
81
|
+
get labelClassName(): string | undefined;
|
|
82
|
+
get formatter(): TooltipFormatter | undefined;
|
|
83
|
+
/** The formatter, when it is a component. */
|
|
84
|
+
get formatterComponent(): ComponentLike<TooltipFormatterSignature> | undefined;
|
|
85
|
+
get config(): ChartConfig;
|
|
86
|
+
get nestLabel(): boolean;
|
|
87
|
+
/** The label's text, or null for none. */
|
|
88
|
+
get label(): {
|
|
89
|
+
text: string;
|
|
90
|
+
} | null;
|
|
91
|
+
get entries(): Entry[];
|
|
92
|
+
}
|
|
93
|
+
export {};
|
|
94
|
+
//# sourceMappingURL=chart-tooltip-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart-tooltip-content.d.ts","sourceRoot":"","sources":["../../src/components/chart-tooltip-content.gts"],"names":[],"mappings":"AAoSA,OAAO,SAAS,MAAM,oBAAoB,CAAA;AAE1C,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAa,EAAE,KAAK,QAAQ,EAAE,MAAM,sCAAsC,CAAA;AAE1E,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,uBAAuB,EACvB,cAAc,EACd,gBAAgB,EAChB,yBAAyB,EACzB,kBAAkB,EAEnB,MAAM,aAAa,CAAA;AAEpB,qFAAqF;AACrF,MAAM,MAAM,qBAAqB,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAA;AAE7D,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE;QACJ,2DAA2D;QAC3D,MAAM,CAAC,EAAE,OAAO,CAAA;QAChB,4DAA4D;QAC5D,OAAO,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAA;QACvC,sDAAsD;QACtD,KAAK,CAAC,EAAE,OAAO,CAAA;QACf,4DAA4D;QAC5D,MAAM,CAAC,EAAE,WAAW,CAAA;QACpB,6DAA6D;QAC7D,UAAU,CAAC,EAAE;YAAE,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;QACrC,iFAAiF;QACjF,OAAO,CAAC,EAAE,uBAAuB,CAAC,SAAS,CAAC,CAAA;QAC5C,uBAAuB;QACvB,SAAS,CAAC,EAAE,OAAO,CAAA;QACnB,oCAAoC;QACpC,aAAa,CAAC,EAAE,OAAO,CAAA;QACvB,2CAA2C;QAC3C,SAAS,CAAC,EAAE,qBAAqB,CAAA;QACjC,+EAA+E;QAC/E,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,yFAAyF;QACzF,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,yBAAyB;QACzB,cAAc,CAAC,EAAE,cAAc,CAAA;QAC/B,6BAA6B;QAC7B,cAAc,CAAC,EAAE,MAAM,CAAA;QACvB;;;WAGG;QACH,SAAS,CAAC,EAAE,gBAAgB,CAAA;QAC5B,gGAAgG;QAChG,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,yFAAyF;QACzF,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,CAAA;IACD,OAAO,EAAE,cAAc,CAAA;CACxB;AAED,UAAU,KAAK;IACb,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,aAAa,CAAC,EAAE,aAAa,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAA;IACnD,cAAc,EAAE,UAAU,CAAA;IAC1B,sFAAsF;IACtF,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,8CAA8C;IAC9C,MAAM,CAAC,EAAE,IAAI,CAAC,yBAAyB,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAA;CAC3D;AAoBD;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,SAAS,CAAC,4BAA4B,CAAC;IACtF,IAAI,SAAS,IAAI,qBAAqB,CAErC;IAED,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,IAAI,cAAc,IAAI,cAAc,GAAG,SAAS,CAE/C;IAED,IAAI,cAAc,IAAI,MAAM,GAAG,SAAS,CAEvC;IAED,IAAI,SAAS,IAAI,gBAAgB,GAAG,SAAS,CAE5C;IAED,6CAA6C;IAC7C,IAAI,kBAAkB,IAAI,aAAa,CAAC,yBAAyB,CAAC,GAAG,SAAS,CAG7E;IAED,IAAI,MAAM,IAAI,WAAW,CAExB;IAED,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,0CAA0C;IAC1C,IAAI,KAAK,IAAI;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAYnC;IAED,IAAI,OAAO,IAAI,KAAK,EAAE,CA+CrB;CA2LF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { TOC } from '@ember/component/template-only';
|
|
2
|
+
export interface DotSignature {
|
|
3
|
+
Args: {
|
|
4
|
+
/** The centre. */
|
|
5
|
+
cx: number;
|
|
6
|
+
cy: number;
|
|
7
|
+
/** The radius. */
|
|
8
|
+
r: number;
|
|
9
|
+
};
|
|
10
|
+
Element: Element;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A circle at a point: recharts' `Dot`, for a series' custom `@dot`. Give it `fill`, `stroke`
|
|
14
|
+
* and any other attribute:
|
|
15
|
+
*
|
|
16
|
+
* const ColoredDot = <template>
|
|
17
|
+
* <Dot @cx={{@cx}} @cy={{@cy}} @r={{5}} fill={{@payload.fill}} stroke={{@payload.fill}} />
|
|
18
|
+
* </template>
|
|
19
|
+
*/
|
|
20
|
+
declare const Dot: TOC<DotSignature>;
|
|
21
|
+
export default Dot;
|
|
22
|
+
//# sourceMappingURL=dot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dot.d.ts","sourceRoot":"","sources":["../../src/components/dot.gts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAA;AAEzD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE;QACJ,kBAAkB;QAClB,EAAE,EAAE,MAAM,CAAA;QACV,EAAE,EAAE,MAAM,CAAA;QACV,kBAAkB;QAClB,CAAC,EAAE,MAAM,CAAA;KACV,CAAA;IACD,OAAO,EAAE,OAAO,CAAA;CACjB;AAED;;;;;;;GAOG;AACH,QAAA,MAAM,GAAG,EAAE,GAAG,CAAC,YAAY,CAoBzB,CAAA;AAEF,eAAe,GAAG,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import CartesianChart from '../-private/cartesian-chart';
|
|
2
|
+
import type { ChartName } from '../-private/cartesian.ts';
|
|
3
|
+
/**
|
|
4
|
+
* recharts' `LineChart`, as Glimmer SVG. It yields its parts (axes, grid, series, tooltip and
|
|
5
|
+
* legend); inside a `ChartContainer`, take it from the container's yield (`chart.LineChart`), which
|
|
6
|
+
* gives it the container's config and size.
|
|
7
|
+
*
|
|
8
|
+
* <chart.LineChart @data={{chartData}} as |c|>
|
|
9
|
+
* <c.CartesianGrid @vertical={{false}} />
|
|
10
|
+
* <c.XAxis @dataKey="month" />
|
|
11
|
+
* </chart.LineChart>
|
|
12
|
+
*/
|
|
13
|
+
export default class LineChart extends CartesianChart {
|
|
14
|
+
get chartName(): ChartName;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=line-chart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"line-chart.d.ts","sourceRoot":"","sources":["../../src/components/line-chart.gts"],"names":[],"mappings":"AAkBA,OAAO,cAAc,MAAM,iCAAiC,CAAA;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAEzD;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,cAAc;IACnD,IAAa,SAAS,IAAI,SAAS,CAElC;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import PieChart from '../-private/pie-chart';
|
|
2
|
+
/**
|
|
3
|
+
* recharts' `PieChart`, as Glimmer SVG. It yields its parts (pies, tooltip and legend); inside a
|
|
4
|
+
* `ChartContainer`, take it from the container's yield (`chart.PieChart`), which gives it the
|
|
5
|
+
* container's config and size.
|
|
6
|
+
*
|
|
7
|
+
* <chart.PieChart as |c|>
|
|
8
|
+
* <c.ChartTooltip @content={{component ChartTooltipContent hideLabel=true}} />
|
|
9
|
+
* <c.Pie @data={{chartData}} @dataKey="visitors" @nameKey="browser" />
|
|
10
|
+
* </chart.PieChart>
|
|
11
|
+
*/
|
|
12
|
+
export default PieChart;
|
|
13
|
+
//# sourceMappingURL=pie-chart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pie-chart.d.ts","sourceRoot":"","sources":["../../src/components/pie-chart.gts"],"names":[],"mappings":"AAaA,OAAO,QAAQ,MAAM,2BAA2B,CAAA;AAEhD;;;;;;;;;GASG;AACH,eAAe,QAAQ,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import PolarChart from '../-private/polar-chart';
|
|
2
|
+
import type { PolarChartName } from '../-private/polar-geometry.ts';
|
|
3
|
+
export type { PolarChartParts, PolarChartSignature } from '../-private/polar-chart';
|
|
4
|
+
export type { PolarAngleAxisSignature, PolarAngleAxisTickArgs, PolarAxisArgs, PolarGridSignature, PolarLabelContentSignature, PolarRadiusAxisParts, PolarRadiusAxisSignature, PolarSeriesArgs, RadarDotOption, RadarSignature, RadiusAxisLabelSignature, } from '../-private/polar-parts';
|
|
5
|
+
export type { PolarPosition, PolarTick } from '../-private/polar-geometry.ts';
|
|
6
|
+
/**
|
|
7
|
+
* recharts' `RadarChart`, as Glimmer SVG: a polygon per series, round the chart's categories
|
|
8
|
+
* from 12 o'clock. It yields its parts (grid, axes, series, tooltip and legend); inside a
|
|
9
|
+
* `ChartContainer`, take it from the container's yield (`chart.RadarChart`), which gives it the
|
|
10
|
+
* container's config and size.
|
|
11
|
+
*
|
|
12
|
+
* <chart.RadarChart @data={{chartData}} as |c|>
|
|
13
|
+
* <c.PolarAngleAxis @dataKey="month" />
|
|
14
|
+
* <c.PolarGrid />
|
|
15
|
+
* <c.Radar @dataKey="desktop" @fill="var(--color-desktop)" @fillOpacity={{0.6}} />
|
|
16
|
+
* </chart.RadarChart>
|
|
17
|
+
*/
|
|
18
|
+
export default class RadarChart extends PolarChart {
|
|
19
|
+
get chartName(): PolarChartName;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=radar-chart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radar-chart.d.ts","sourceRoot":"","sources":["../../src/components/radar-chart.gts"],"names":[],"mappings":"AAoCA,OAAO,UAAU,MAAM,6BAA6B,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAEnE,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AACvF,YAAY,EACV,uBAAuB,EACvB,sBAAsB,EACtB,aAAa,EACb,kBAAkB,EAClB,0BAA0B,EAC1B,oBAAoB,EACpB,wBAAwB,EACxB,eAAe,EACf,cAAc,EACd,cAAc,EACd,wBAAwB,GACzB,MAAM,6BAA6B,CAAA;AACpC,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAE7E;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,UAAU;IAChD,IAAa,SAAS,IAAI,cAAc,CAEvC;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import PolarChart from '../-private/polar-chart';
|
|
2
|
+
import type { PolarChartName } from '../-private/polar-geometry.ts';
|
|
3
|
+
export type { PolarLabelListSignature, RadialBarBackground, RadialBarParts, RadialBarSignature, } from '../-private/polar-parts';
|
|
4
|
+
/**
|
|
5
|
+
* recharts' `RadialBarChart`, as Glimmer SVG: a bar round the chart for each row, its rows out
|
|
6
|
+
* from the centre. It yields its parts (grid, axes, series, tooltip and legend); inside a
|
|
7
|
+
* `ChartContainer`, take it from the container's yield (`chart.RadialBarChart`), which gives it
|
|
8
|
+
* the container's config and size.
|
|
9
|
+
*
|
|
10
|
+
* <chart.RadialBarChart @data={{chartData}} @innerRadius={{30}} @outerRadius={{110}} as |c|>
|
|
11
|
+
* <c.RadialBar @dataKey="visitors" @background={{true}} />
|
|
12
|
+
* </chart.RadialBarChart>
|
|
13
|
+
*/
|
|
14
|
+
export default class RadialBarChart extends PolarChart {
|
|
15
|
+
get chartName(): PolarChartName;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=radial-bar-chart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radial-bar-chart.d.ts","sourceRoot":"","sources":["../../src/components/radial-bar-chart.gts"],"names":[],"mappings":"AAyBA,OAAO,UAAU,MAAM,6BAA6B,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAEnE,YAAY,EACV,uBAAuB,EACvB,mBAAmB,EACnB,cAAc,EACd,kBAAkB,GACnB,MAAM,6BAA6B,CAAA;AAEpC;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,UAAU;IACpD,IAAa,SAAS,IAAI,cAAc,CAEvC;CACF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import type { RectangleProps } from '../-private/parts';
|
|
3
|
+
export interface RectangleSignature {
|
|
4
|
+
Args: {
|
|
5
|
+
/**
|
|
6
|
+
* A bar's `@shape` props, as recharts' `{...props}`: the bar's rectangle and attributes.
|
|
7
|
+
* The arguments below override them.
|
|
8
|
+
*/
|
|
9
|
+
props?: Partial<RectangleProps>;
|
|
10
|
+
x?: number;
|
|
11
|
+
y?: number;
|
|
12
|
+
width?: number;
|
|
13
|
+
height?: number;
|
|
14
|
+
/** The corners' radius: one for all four, or `[topLeft, topRight, bottomRight, bottomLeft]`. */
|
|
15
|
+
radius?: number | readonly number[];
|
|
16
|
+
};
|
|
17
|
+
Element: Element;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A rectangle with rounded corners: recharts' `Rectangle`. A bar draws each of its bars with
|
|
21
|
+
* one; draw one yourself in a bar's `@shape`, given the props it is handed, with attributes of
|
|
22
|
+
* your own (they win over the bar's):
|
|
23
|
+
*
|
|
24
|
+
* const DashedBar = <template>
|
|
25
|
+
* <Rectangle @props={{@props}} stroke={{@props.payload.fill}} stroke-dasharray="4" />
|
|
26
|
+
* </template>
|
|
27
|
+
*/
|
|
28
|
+
export default class Rectangle extends Component<RectangleSignature> {
|
|
29
|
+
get d(): string;
|
|
30
|
+
get value(): string | undefined;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=rectangle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rectangle.d.ts","sourceRoot":"","sources":["../../src/components/rectangle.gts"],"names":[],"mappings":"AA6DA,OAAO,SAAS,MAAM,oBAAoB,CAAA;AAE1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAE3D,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE;QACJ;;;WAGG;QACH,KAAK,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;QAC/B,CAAC,CAAC,EAAE,MAAM,CAAA;QACV,CAAC,CAAC,EAAE,MAAM,CAAA;QACV,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,gGAAgG;QAChG,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAA;KACpC,CAAA;IACD,OAAO,EAAE,OAAO,CAAA;CACjB;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,SAAS,CAAC,kBAAkB,CAAC;IAClE,IAAI,CAAC,IAAI,MAAM,CASd;IAED,IAAI,KAAK,IAAI,MAAM,GAAG,SAAS,CAG9B;CAmCF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import type { SectorProps } from '../-private/parts';
|
|
3
|
+
export interface SectorSignature {
|
|
4
|
+
Args: {
|
|
5
|
+
/**
|
|
6
|
+
* A pie's `@shape` props, as recharts' `{...props}`: the sector's geometry and attributes.
|
|
7
|
+
* The arguments below override them.
|
|
8
|
+
*/
|
|
9
|
+
props?: Partial<SectorProps>;
|
|
10
|
+
/** The centre. */
|
|
11
|
+
cx?: number;
|
|
12
|
+
cy?: number;
|
|
13
|
+
/** The ring: 0 inside for a slice of pie, more for a donut's. */
|
|
14
|
+
innerRadius?: number;
|
|
15
|
+
outerRadius?: number;
|
|
16
|
+
/** The angles, in degrees counter-clockwise from 3 o'clock. */
|
|
17
|
+
startAngle?: number;
|
|
18
|
+
endAngle?: number;
|
|
19
|
+
/** Rounds the corners: pixels, or a percentage of the ring's width. */
|
|
20
|
+
cornerRadius?: number | string;
|
|
21
|
+
};
|
|
22
|
+
Element: Element;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A pie's sector: recharts' `Sector`. A pie draws each of its sectors with one; draw one
|
|
26
|
+
* yourself in a pie's `@shape`, given the props it is handed, and override any of them:
|
|
27
|
+
*
|
|
28
|
+
* const ActiveShape = <template>
|
|
29
|
+
* <Sector @props={{@props}} @outerRadius={{add @props.outerRadius 10}} />
|
|
30
|
+
* </template>
|
|
31
|
+
*
|
|
32
|
+
* It takes the sector's `fill`, `stroke` and `stroke-width` from `@props`; attributes on it win.
|
|
33
|
+
*/
|
|
34
|
+
export default class Sector extends Component<SectorSignature> {
|
|
35
|
+
get geometry(): {
|
|
36
|
+
cx: number;
|
|
37
|
+
cy: number;
|
|
38
|
+
innerRadius: number;
|
|
39
|
+
outerRadius: number;
|
|
40
|
+
startAngle: number;
|
|
41
|
+
endAngle: number;
|
|
42
|
+
cornerRadius: string | number;
|
|
43
|
+
};
|
|
44
|
+
get d(): string | null;
|
|
45
|
+
get name(): string | undefined;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=sector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sector.d.ts","sourceRoot":"","sources":["../../src/components/sector.gts"],"names":[],"mappings":"AA2EA,OAAO,SAAS,MAAM,oBAAoB,CAAA;AAE1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE;QACJ;;;WAGG;QACH,KAAK,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAA;QAC5B,kBAAkB;QAClB,EAAE,CAAC,EAAE,MAAM,CAAA;QACX,EAAE,CAAC,EAAE,MAAM,CAAA;QACX,iEAAiE;QACjE,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,+DAA+D;QAC/D,UAAU,CAAC,EAAE,MAAM,CAAA;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,uEAAuE;QACvE,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAC/B,CAAA;IACD,OAAO,EAAE,OAAO,CAAA;CACjB;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,SAAS,CAAC,eAAe,CAAC;IAC5D,IAAI,QAAQ;;;;;;;;MAWX;IAED,IAAI,CAAC,IAAI,MAAM,GAAG,IAAI,CAErB;IAED,IAAI,IAAI,IAAI,MAAM,GAAG,SAAS,CAG7B;CAqCF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export { default as AreaChart } from './components/area-chart';
|
|
2
|
+
export { default as BarChart } from './components/bar-chart';
|
|
3
|
+
export { default as ChartContainer } from './components/chart-container';
|
|
4
|
+
export * from './components/chart-container';
|
|
5
|
+
export { default as ChartLegendContent } from './components/chart-legend-content';
|
|
6
|
+
export * from './components/chart-legend-content';
|
|
7
|
+
export { default as ChartStyle } from './components/chart-style';
|
|
8
|
+
export * from './components/chart-style';
|
|
9
|
+
export { default as ChartTooltipContent } from './components/chart-tooltip-content';
|
|
10
|
+
export * from './components/chart-tooltip-content';
|
|
11
|
+
export { default as Dot } from './components/dot';
|
|
12
|
+
export * from './components/dot';
|
|
13
|
+
export { default as LineChart } from './components/line-chart';
|
|
14
|
+
export { default as PieChart } from './components/pie-chart';
|
|
15
|
+
export { default as RadarChart } from './components/radar-chart';
|
|
16
|
+
export * from './components/radar-chart';
|
|
17
|
+
export { default as RadialBarChart } from './components/radial-bar-chart';
|
|
18
|
+
export * from './components/radial-bar-chart';
|
|
19
|
+
export { default as Rectangle } from './components/rectangle';
|
|
20
|
+
export * from './components/rectangle';
|
|
21
|
+
export { default as Sector } from './components/sector';
|
|
22
|
+
export * from './components/sector';
|
|
23
|
+
export * from './types.ts';
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kCAAkC,CAAA;AAC5E,cAAc,kCAAkC,CAAA;AAChD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,uCAAuC,CAAA;AACrF,cAAc,uCAAuC,CAAA;AACrD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,8BAA8B,CAAA;AACpE,cAAc,8BAA8B,CAAA;AAC5C,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,wCAAwC,CAAA;AACvF,cAAc,wCAAwC,CAAA;AACtD,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,sBAAsB,CAAA;AACrD,cAAc,sBAAsB,CAAA;AACpC,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,8BAA8B,CAAA;AACpE,cAAc,8BAA8B,CAAA;AAC5C,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAC7E,cAAc,mCAAmC,CAAA;AACjD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,4BAA4B,CAAA;AACjE,cAAc,4BAA4B,CAAA;AAC1C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAC3D,cAAc,yBAAyB,CAAA;AACvC,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { Harness } from '@ember-joinery/test-support';
|
|
2
|
+
/** A point, in the chart's pixels (its `<svg>`'s coordinates). */
|
|
3
|
+
export interface ChartPoint {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
}
|
|
7
|
+
/** A series as its harness reads it. */
|
|
8
|
+
export interface ChartSeriesInfo {
|
|
9
|
+
/** Its data key. */
|
|
10
|
+
key: string;
|
|
11
|
+
type: 'area' | 'bar' | 'line' | 'pie';
|
|
12
|
+
/**
|
|
13
|
+
* Each drawn point, in the chart's pixels: a bar's top-left corner, a sector's middle (where
|
|
14
|
+
* its tooltip points).
|
|
15
|
+
*/
|
|
16
|
+
points: ChartPoint[];
|
|
17
|
+
/** A line's or area's curve, as the path's `d`. */
|
|
18
|
+
path: string | null;
|
|
19
|
+
/** An area's filled path. */
|
|
20
|
+
areaPath: string | null;
|
|
21
|
+
fill: string | null;
|
|
22
|
+
stroke: string | null;
|
|
23
|
+
/** The series' group, to look inside. */
|
|
24
|
+
element: SVGGElement;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Reads a chart tooltip's box (`ChartTooltipContent`): its label and each entry's name and
|
|
28
|
+
* value. A chart's harness gives you the one it shows (`chart.tooltip`); this one also finds a
|
|
29
|
+
* tooltip rendered on its own.
|
|
30
|
+
*/
|
|
31
|
+
export declare class ChartTooltipHarness extends Harness {
|
|
32
|
+
static component: string;
|
|
33
|
+
/** `dot`, `line` or `dashed`. */
|
|
34
|
+
get indicator(): string | null;
|
|
35
|
+
/** The label's text, or `null` without one. */
|
|
36
|
+
get label(): string | null;
|
|
37
|
+
/** Each entry: its key, the name it shows, its value's text, and its indicator. */
|
|
38
|
+
get items(): {
|
|
39
|
+
key: string;
|
|
40
|
+
name: string;
|
|
41
|
+
value: string | null;
|
|
42
|
+
indicator: HTMLElement | null;
|
|
43
|
+
}[];
|
|
44
|
+
/** The entries' names, in order. */
|
|
45
|
+
get names(): string[];
|
|
46
|
+
/** The entries' values' text, in order. */
|
|
47
|
+
get entryValues(): (string | null)[];
|
|
48
|
+
/** All the text it shows, whitespace collapsed. */
|
|
49
|
+
get text(): string;
|
|
50
|
+
}
|
|
51
|
+
/** Reads a chart legend (`ChartLegendContent`): each entry's key and label. */
|
|
52
|
+
export declare class ChartLegendHarness extends Harness {
|
|
53
|
+
static component: string;
|
|
54
|
+
/** Each entry: its key, its label, and its swatch (or `null` where it shows an icon). */
|
|
55
|
+
get items(): {
|
|
56
|
+
key: string;
|
|
57
|
+
label: string;
|
|
58
|
+
swatch: HTMLElement | null;
|
|
59
|
+
}[];
|
|
60
|
+
/** The entries' labels, in order. */
|
|
61
|
+
get labels(): string[];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Drives a chart from `@ember-joinery/chart` (`<ChartContainer>`, or a chart outside one): reads
|
|
65
|
+
* its series, axes, grid, labels and legend, and moves the tooltip with the pointer or the
|
|
66
|
+
* keyboard, as a user does.
|
|
67
|
+
*
|
|
68
|
+
* const chart = new ChartHarness('visitors') // <ChartContainer @name="visitors">
|
|
69
|
+
* assert.deepEqual(chart.xTicks, ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'])
|
|
70
|
+
* await chart.hover(1)
|
|
71
|
+
* assert.strictEqual(chart.tooltip?.label, 'February')
|
|
72
|
+
* assert.deepEqual(chart.legend?.labels, ['Desktop', 'Mobile'])
|
|
73
|
+
*/
|
|
74
|
+
export declare class ChartHarness extends Harness {
|
|
75
|
+
#private;
|
|
76
|
+
static component: string;
|
|
77
|
+
/** recharts' wrapper: the chart at its size, holding the `<svg>`, legend and tooltip. */
|
|
78
|
+
get wrapper(): HTMLElement;
|
|
79
|
+
/** The chart's `<svg>`. */
|
|
80
|
+
get surface(): SVGSVGElement;
|
|
81
|
+
/** The size the chart drew at. */
|
|
82
|
+
get width(): number;
|
|
83
|
+
get height(): number;
|
|
84
|
+
/** The plot area: the chart less its margins, axes and legend. */
|
|
85
|
+
get plot(): {
|
|
86
|
+
x: number;
|
|
87
|
+
y: number;
|
|
88
|
+
width: number;
|
|
89
|
+
height: number;
|
|
90
|
+
};
|
|
91
|
+
/** The value of the chart's `--color-<key>` variable (from its config). */
|
|
92
|
+
color(key: string): string;
|
|
93
|
+
/** Every series, in the order the chart draws them (areas, then bars, then lines). */
|
|
94
|
+
get series(): ChartSeriesInfo[];
|
|
95
|
+
/** The series drawn for `key`. Throws when there is none. */
|
|
96
|
+
seriesFor(key: string): ChartSeriesInfo;
|
|
97
|
+
/** A bar series' bars, as `<path>` elements. */
|
|
98
|
+
bars(key: string): SVGPathElement[];
|
|
99
|
+
/** A pie's sectors, as `<path>` elements, in its rows' order. */
|
|
100
|
+
sectors(key: string): SVGPathElement[];
|
|
101
|
+
/** A pie's sectors' names (each row's `@nameKey`, or its index). */
|
|
102
|
+
sectorNames(key: string): string[];
|
|
103
|
+
/** A series' dots (circles, or the custom dots it draws). */
|
|
104
|
+
dots(key: string): Element[];
|
|
105
|
+
/**
|
|
106
|
+
* A series' labels' text: its first `LabelList`, or a pie's `@label`s. `labelLists(key)` has
|
|
107
|
+
* every list.
|
|
108
|
+
*/
|
|
109
|
+
labels(key: string): string[];
|
|
110
|
+
/** The text of each of a series' label lists (a pie's `@label`s count as one), in order. */
|
|
111
|
+
labelLists(key: string): string[][];
|
|
112
|
+
/** The lines from a pie's sectors to their `@label`s. */
|
|
113
|
+
labelLines(key: string): SVGPathElement[];
|
|
114
|
+
/** The x-axis's tick labels, as drawn. Empty without a drawn x-axis. */
|
|
115
|
+
get xTicks(): string[];
|
|
116
|
+
/** The y-axis's tick labels, as drawn. Empty without a drawn y-axis. */
|
|
117
|
+
get yTicks(): string[];
|
|
118
|
+
/** The grid's lines: the y of each horizontal one and the x of each vertical one. */
|
|
119
|
+
get gridLines(): {
|
|
120
|
+
horizontal: number[];
|
|
121
|
+
vertical: number[];
|
|
122
|
+
};
|
|
123
|
+
/** Where each row sits along the category axis, in the chart's pixels. */
|
|
124
|
+
get categories(): number[];
|
|
125
|
+
/**
|
|
126
|
+
* Whether it is a pie chart, whose tooltip points at sectors rather than rows. A radar chart's
|
|
127
|
+
* layout is `centric` too, but it marks itself a polar chart (`data-polar-chart`).
|
|
128
|
+
*/
|
|
129
|
+
get isPie(): boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Moves the pointer over row `index` (its category), which shows the tooltip there. In a pie
|
|
132
|
+
* chart, over the middle of sector `index` of the pie for `key` (the first pie by default).
|
|
133
|
+
*/
|
|
134
|
+
hover(index: number, key?: string): Promise<void>;
|
|
135
|
+
/** Moves the pointer off the chart, which hides the tooltip. */
|
|
136
|
+
unhover(): Promise<void>;
|
|
137
|
+
/** Focuses the chart, as Tab does: the tooltip shows the first row (or a pie's first sector). */
|
|
138
|
+
focus(): Promise<void>;
|
|
139
|
+
/** Takes focus away from the chart, which hides a keyboard tooltip. */
|
|
140
|
+
blur(): Promise<void>;
|
|
141
|
+
/**
|
|
142
|
+
* Presses a key on the focused chart: `ArrowRight`/`ArrowLeft` move the tooltip a row (or a
|
|
143
|
+
* sector), `Enter` toggles it.
|
|
144
|
+
*/
|
|
145
|
+
press(key: 'ArrowRight' | 'ArrowLeft' | 'Enter'): Promise<void>;
|
|
146
|
+
/** Whether the tooltip is showing. */
|
|
147
|
+
get isTooltipVisible(): boolean;
|
|
148
|
+
/** The tooltip box, while it shows; otherwise `null`. */
|
|
149
|
+
get tooltip(): ChartTooltipHarness | null;
|
|
150
|
+
/** The tooltip's position against the chart: the translate recharts gives it. */
|
|
151
|
+
get tooltipPosition(): {
|
|
152
|
+
x: number;
|
|
153
|
+
y: number;
|
|
154
|
+
} | null;
|
|
155
|
+
/** The tooltip's cursor: the line (or band) under the active row, or `null`. */
|
|
156
|
+
get cursor(): SVGPathElement | null;
|
|
157
|
+
/** The dots drawn at the active row while the tooltip shows. */
|
|
158
|
+
get activeDots(): SVGCircleElement[];
|
|
159
|
+
/** The legend, or `null` without one. */
|
|
160
|
+
get legend(): ChartLegendHarness | null;
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=chart.d.ts.map
|