@aeriz/chart 1.1.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -34
- package/dist/aeriz.cjs +609 -354
- package/dist/aeriz.esm.js +578 -331
- package/dist/aeriz.esm.min.js +119 -105
- package/dist/aeriz.js +609 -354
- package/dist/aeriz.min.cjs +123 -107
- package/dist/aeriz.min.js +123 -107
- package/dist/esm/base.js +33 -22
- package/dist/esm/cartesian.js +7 -5
- package/dist/esm/charts/area.js +6 -6
- package/dist/esm/charts/bar.js +3 -3
- package/dist/esm/charts/boxplot.js +3 -3
- package/dist/esm/charts/bubble.js +3 -3
- package/dist/esm/charts/composite.js +8 -8
- package/dist/esm/charts/funnel.js +3 -3
- package/dist/esm/charts/gauge.js +5 -5
- package/dist/esm/charts/grouped-bar.js +4 -4
- package/dist/esm/charts/hbar.js +5 -5
- package/dist/esm/charts/heatmap.js +6 -6
- package/dist/esm/charts/line.js +6 -6
- package/dist/esm/charts/multi-line.js +5 -5
- package/dist/esm/charts/pie.js +6 -6
- package/dist/esm/charts/polar.js +3 -3
- package/dist/esm/charts/radar.js +6 -6
- package/dist/esm/charts/realtime.js +11 -9
- package/dist/esm/charts/scatter.js +4 -4
- package/dist/esm/charts/sparkline.js +4 -4
- package/dist/esm/charts/stacked-bar.js +5 -5
- package/dist/esm/charts/treemap.js +4 -4
- package/dist/esm/charts/waterfall.js +4 -4
- package/dist/esm/engine.js +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/jquery.js +5 -4
- package/dist/esm/math.js +1 -1
- package/dist/esm/react.js +4 -4
- package/dist/esm/shallow.js +4 -2
- package/dist/esm/svelte.js +4 -4
- package/dist/esm/vue.js +4 -2
- package/dist/index.d.ts +228 -552
- package/dist/jquery.d.ts +19 -8
- package/dist/react.d.ts +55 -18
- package/dist/svelte.d.ts +53 -14
- package/dist/types/sparkline.d.ts +1 -1
- package/dist/vue.d.ts +60 -10
- package/package.json +2 -2
package/dist/jquery.d.ts
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
|
+
// @aeriz/chart/jquery — install($, { BarChart }) then $(el).aerizChart('bar', options)
|
|
1
2
|
import type { Chart } from './index.js';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
export type ChartId = 'bar' | 'hbar' | 'line' | 'area' | 'stacked-bar' | 'grouped-bar' | 'multi-line' | 'scatter' | 'bubble' | 'pie' | 'radar' | 'polar' | 'gauge' | 'heatmap' | 'boxplot' | 'funnel' | 'treemap' | 'sparkline' | 'realtime' | 'waterfall' | 'composite';
|
|
5
|
+
|
|
6
|
+
/** Adds `$.fn.aerizChart` with the given chart classes. Call again to add more. */
|
|
7
|
+
export declare function install<J extends { fn: any }>($: J, charts: Record<string, typeof Chart<any>>): J;
|
|
8
|
+
|
|
9
|
+
declare global {
|
|
10
|
+
interface JQuery {
|
|
11
|
+
/** Create a chart: `.aerizChart('bar', { data })` (the chart must be installed). */
|
|
12
|
+
aerizChart(id: ChartId, options?: object): this;
|
|
13
|
+
/** Call a chart method on every matched element. */
|
|
14
|
+
aerizChart(method: 'update', patch: object): this;
|
|
15
|
+
aerizChart(method: 'setState', state: 'loading' | 'empty' | 'error' | null, text?: string): this;
|
|
16
|
+
aerizChart(method: 'render' | 'destroy' | 'clear'): this;
|
|
17
|
+
aerizChart(method: 'push', values: number | Array<number | null>): this;
|
|
18
|
+
/** The first element's chart instance, or `null`. */
|
|
19
|
+
aerizChart(method: 'instance'): Chart<any> | null;
|
|
20
|
+
}
|
|
21
|
+
}
|
package/dist/react.d.ts
CHANGED
|
@@ -1,22 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
1
|
+
// @aeriz/chart/react — one component per chart: <BarChart data={rows} … />
|
|
2
|
+
import type { ForwardRefExoticComponent, ReactElement, Ref, CSSProperties, AriaAttributes } from 'react';
|
|
3
|
+
import type {
|
|
4
|
+
BarChart as BarC, BarOptions,
|
|
5
|
+
HBarChart as HBarC, HBarOptions,
|
|
6
|
+
LineChart as LineC, LineOptions,
|
|
7
|
+
AreaChart as AreaC, AreaOptions,
|
|
8
|
+
StackedBarChart as StackedBarC, StackedBarOptions,
|
|
9
|
+
GroupedBarChart as GroupedBarC, GroupedBarOptions,
|
|
10
|
+
MultiLineChart as MultiLineC, MultiLineOptions,
|
|
11
|
+
ScatterChart as ScatterC, ScatterOptions,
|
|
12
|
+
BubbleChart as BubbleC, BubbleOptions,
|
|
13
|
+
PieChart as PieC, PieOptions,
|
|
14
|
+
RadarChart as RadarC, RadarOptions,
|
|
15
|
+
PolarChart as PolarC, PolarOptions,
|
|
16
|
+
GaugeChart as GaugeC, GaugeOptions,
|
|
17
|
+
HeatmapChart as HeatmapC, HeatmapOptions,
|
|
18
|
+
BoxplotChart as BoxplotC, BoxplotOptions,
|
|
19
|
+
FunnelChart as FunnelC, FunnelOptions,
|
|
20
|
+
TreemapChart as TreemapC, TreemapOptions,
|
|
21
|
+
SparklineChart as SparklineC, SparklineOptions,
|
|
22
|
+
RealtimeChart as RealtimeC, RealtimeOptions,
|
|
23
|
+
WaterfallChart as WaterfallC, WaterfallOptions,
|
|
24
|
+
CompositeChart as CompositeC, CompositeOptions,
|
|
25
|
+
Row,
|
|
26
|
+
} from './index.js';
|
|
3
27
|
|
|
4
|
-
|
|
5
|
-
type
|
|
6
|
-
|
|
7
|
-
export interface AerizChartProps<C extends Chart<any> = Chart<any>> extends Omit<HTMLAttributes<HTMLDivElement>, 'onClick'> {
|
|
8
|
-
/** The chart class, e.g. `BarChart` from `@aeriz/chart/bar`. Changing it re-creates the chart. */
|
|
9
|
-
type: ChartClass<C>;
|
|
10
|
-
/** Chart options. A changed object (shallow-compared) calls `chart.update()`. */
|
|
11
|
-
options?: Partial<OptionsOf<C>>;
|
|
12
|
-
/** Shorthand for `options.data`. */
|
|
13
|
-
data?: OptionsOf<C> extends { data: infer D } ? D : unknown;
|
|
14
|
-
/** Receives the chart instance after mount. */
|
|
15
|
-
onReady?: (chart: C) => void;
|
|
28
|
+
/** Chart options as props, plus wrapper-div props. `ref` gives the chart instance. */
|
|
29
|
+
export type Props<O, C> = O & AriaAttributes & {
|
|
16
30
|
className?: string;
|
|
17
31
|
style?: CSSProperties;
|
|
18
|
-
|
|
32
|
+
id?: string;
|
|
33
|
+
role?: string;
|
|
34
|
+
tabIndex?: number;
|
|
35
|
+
ref?: Ref<C>;
|
|
36
|
+
[data: `data-${string}`]: string | undefined;
|
|
37
|
+
};
|
|
19
38
|
|
|
20
|
-
|
|
21
|
-
export declare const
|
|
22
|
-
export
|
|
39
|
+
export declare const BarChart: <R = Row>(props: Props<BarOptions<R>, BarC<any>>) => ReactElement | null;
|
|
40
|
+
export declare const HBarChart: <R = Row>(props: Props<HBarOptions<R>, HBarC<any>>) => ReactElement | null;
|
|
41
|
+
export declare const LineChart: <R = Row>(props: Props<LineOptions<R>, LineC<any>>) => ReactElement | null;
|
|
42
|
+
export declare const AreaChart: ForwardRefExoticComponent<Props<AreaOptions, AreaC>>;
|
|
43
|
+
export declare const StackedBarChart: ForwardRefExoticComponent<Props<StackedBarOptions, StackedBarC>>;
|
|
44
|
+
export declare const GroupedBarChart: ForwardRefExoticComponent<Props<GroupedBarOptions, GroupedBarC>>;
|
|
45
|
+
export declare const MultiLineChart: ForwardRefExoticComponent<Props<MultiLineOptions, MultiLineC>>;
|
|
46
|
+
export declare const ScatterChart: ForwardRefExoticComponent<Props<ScatterOptions, ScatterC>>;
|
|
47
|
+
export declare const BubbleChart: ForwardRefExoticComponent<Props<BubbleOptions, BubbleC>>;
|
|
48
|
+
export declare const PieChart: <R = Row>(props: Props<PieOptions<R>, PieC<any>>) => ReactElement | null;
|
|
49
|
+
export declare const RadarChart: ForwardRefExoticComponent<Props<RadarOptions, RadarC>>;
|
|
50
|
+
export declare const PolarChart: <R = Row>(props: Props<PolarOptions<R>, PolarC<any>>) => ReactElement | null;
|
|
51
|
+
export declare const GaugeChart: ForwardRefExoticComponent<Props<GaugeOptions, GaugeC>>;
|
|
52
|
+
export declare const HeatmapChart: ForwardRefExoticComponent<Props<HeatmapOptions, HeatmapC>>;
|
|
53
|
+
export declare const BoxplotChart: ForwardRefExoticComponent<Props<BoxplotOptions, BoxplotC>>;
|
|
54
|
+
export declare const FunnelChart: <R = Row>(props: Props<FunnelOptions<R>, FunnelC<any>>) => ReactElement | null;
|
|
55
|
+
export declare const TreemapChart: <R = Row>(props: Props<TreemapOptions<R>, TreemapC<any>>) => ReactElement | null;
|
|
56
|
+
export declare const SparklineChart: <R = Row>(props: Props<SparklineOptions<R>, SparklineC<any>>) => ReactElement | null;
|
|
57
|
+
export declare const RealtimeChart: ForwardRefExoticComponent<Props<RealtimeOptions, RealtimeC>>;
|
|
58
|
+
export declare const WaterfallChart: ForwardRefExoticComponent<Props<WaterfallOptions, WaterfallC>>;
|
|
59
|
+
export declare const CompositeChart: ForwardRefExoticComponent<Props<CompositeOptions, CompositeC>>;
|
package/dist/svelte.d.ts
CHANGED
|
@@ -1,17 +1,56 @@
|
|
|
1
|
+
// @aeriz/chart/svelte — one action per chart: <div use:barChart={{ data }}></div>
|
|
1
2
|
import type { Chart } from './index.js';
|
|
3
|
+
import type {
|
|
4
|
+
BarChart as BarC, BarOptions,
|
|
5
|
+
HBarChart as HBarC, HBarOptions,
|
|
6
|
+
LineChart as LineC, LineOptions,
|
|
7
|
+
AreaChart as AreaC, AreaOptions,
|
|
8
|
+
StackedBarChart as StackedBarC, StackedBarOptions,
|
|
9
|
+
GroupedBarChart as GroupedBarC, GroupedBarOptions,
|
|
10
|
+
MultiLineChart as MultiLineC, MultiLineOptions,
|
|
11
|
+
ScatterChart as ScatterC, ScatterOptions,
|
|
12
|
+
BubbleChart as BubbleC, BubbleOptions,
|
|
13
|
+
PieChart as PieC, PieOptions,
|
|
14
|
+
RadarChart as RadarC, RadarOptions,
|
|
15
|
+
PolarChart as PolarC, PolarOptions,
|
|
16
|
+
GaugeChart as GaugeC, GaugeOptions,
|
|
17
|
+
HeatmapChart as HeatmapC, HeatmapOptions,
|
|
18
|
+
BoxplotChart as BoxplotC, BoxplotOptions,
|
|
19
|
+
FunnelChart as FunnelC, FunnelOptions,
|
|
20
|
+
TreemapChart as TreemapC, TreemapOptions,
|
|
21
|
+
SparklineChart as SparklineC, SparklineOptions,
|
|
22
|
+
RealtimeChart as RealtimeC, RealtimeOptions,
|
|
23
|
+
WaterfallChart as WaterfallC, WaterfallOptions,
|
|
24
|
+
CompositeChart as CompositeC, CompositeOptions,
|
|
25
|
+
} from './index.js';
|
|
2
26
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/** Any chart option (data, format, …). */
|
|
9
|
-
[option: string]: unknown;
|
|
10
|
-
}
|
|
27
|
+
/** A Svelte action whose parameter is the chart's options. */
|
|
28
|
+
export type Action<O> = (node: HTMLElement, options?: O) => {
|
|
29
|
+
update(options?: O): void;
|
|
30
|
+
destroy(): void;
|
|
31
|
+
};
|
|
11
32
|
|
|
12
|
-
/**
|
|
13
|
-
export declare function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export
|
|
33
|
+
/** The chart an action created on `node`, or `null`. */
|
|
34
|
+
export declare function chartOf(node: HTMLElement): Chart<any> | null;
|
|
35
|
+
|
|
36
|
+
export declare const barChart: Action<BarOptions>;
|
|
37
|
+
export declare const hbarChart: Action<HBarOptions>;
|
|
38
|
+
export declare const lineChart: Action<LineOptions>;
|
|
39
|
+
export declare const areaChart: Action<AreaOptions>;
|
|
40
|
+
export declare const stackedBarChart: Action<StackedBarOptions>;
|
|
41
|
+
export declare const groupedBarChart: Action<GroupedBarOptions>;
|
|
42
|
+
export declare const multiLineChart: Action<MultiLineOptions>;
|
|
43
|
+
export declare const scatterChart: Action<ScatterOptions>;
|
|
44
|
+
export declare const bubbleChart: Action<BubbleOptions>;
|
|
45
|
+
export declare const pieChart: Action<PieOptions>;
|
|
46
|
+
export declare const radarChart: Action<RadarOptions>;
|
|
47
|
+
export declare const polarChart: Action<PolarOptions>;
|
|
48
|
+
export declare const gaugeChart: Action<GaugeOptions>;
|
|
49
|
+
export declare const heatmapChart: Action<HeatmapOptions>;
|
|
50
|
+
export declare const boxplotChart: Action<BoxplotOptions>;
|
|
51
|
+
export declare const funnelChart: Action<FunnelOptions>;
|
|
52
|
+
export declare const treemapChart: Action<TreemapOptions>;
|
|
53
|
+
export declare const sparklineChart: Action<SparklineOptions>;
|
|
54
|
+
export declare const realtimeChart: Action<RealtimeOptions>;
|
|
55
|
+
export declare const waterfallChart: Action<WaterfallOptions>;
|
|
56
|
+
export declare const compositeChart: Action<CompositeOptions>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { SparklineChart } from '../index.js';
|
package/dist/vue.d.ts
CHANGED
|
@@ -1,13 +1,63 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
1
|
+
// @aeriz/chart/vue — one component per chart: <BarChart :data="rows" @click="…" />
|
|
2
|
+
import type { DefineComponent, ShallowRef } from 'vue';
|
|
3
|
+
import type { Hit, Chart } from './index.js';
|
|
4
|
+
import type {
|
|
5
|
+
BarChart as BarC, BarOptions,
|
|
6
|
+
HBarChart as HBarC, HBarOptions,
|
|
7
|
+
LineChart as LineC, LineOptions,
|
|
8
|
+
AreaChart as AreaC, AreaOptions,
|
|
9
|
+
StackedBarChart as StackedBarC, StackedBarOptions,
|
|
10
|
+
GroupedBarChart as GroupedBarC, GroupedBarOptions,
|
|
11
|
+
MultiLineChart as MultiLineC, MultiLineOptions,
|
|
12
|
+
ScatterChart as ScatterC, ScatterOptions,
|
|
13
|
+
BubbleChart as BubbleC, BubbleOptions,
|
|
14
|
+
PieChart as PieC, PieOptions,
|
|
15
|
+
RadarChart as RadarC, RadarOptions,
|
|
16
|
+
PolarChart as PolarC, PolarOptions,
|
|
17
|
+
GaugeChart as GaugeC, GaugeOptions,
|
|
18
|
+
HeatmapChart as HeatmapC, HeatmapOptions,
|
|
19
|
+
BoxplotChart as BoxplotC, BoxplotOptions,
|
|
20
|
+
FunnelChart as FunnelC, FunnelOptions,
|
|
21
|
+
TreemapChart as TreemapC, TreemapOptions,
|
|
22
|
+
SparklineChart as SparklineC, SparklineOptions,
|
|
23
|
+
RealtimeChart as RealtimeC, RealtimeOptions,
|
|
24
|
+
WaterfallChart as WaterfallC, WaterfallOptions,
|
|
25
|
+
CompositeChart as CompositeC, CompositeOptions,
|
|
26
|
+
} from './index.js';
|
|
3
27
|
|
|
4
28
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
29
|
+
* Chart options are props; `onClick` / `onLegend` are the events `@click` / `@legend`.
|
|
30
|
+
* The template ref exposes `chart` (the chart instance).
|
|
7
31
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
32
|
+
type Component<O, C> = DefineComponent<
|
|
33
|
+
Omit<O, 'onClick' | 'onLegend'>,
|
|
34
|
+
{ chart: ShallowRef<C | null> },
|
|
35
|
+
{},
|
|
36
|
+
{},
|
|
37
|
+
{},
|
|
38
|
+
{},
|
|
39
|
+
{},
|
|
40
|
+
{ click: (hit: Hit, chart: Chart) => void; legend: (index: number, visible: boolean, chart: Chart) => void }
|
|
41
|
+
>;
|
|
42
|
+
|
|
43
|
+
export declare const BarChart: Component<BarOptions, BarC>;
|
|
44
|
+
export declare const HBarChart: Component<HBarOptions, HBarC>;
|
|
45
|
+
export declare const LineChart: Component<LineOptions, LineC>;
|
|
46
|
+
export declare const AreaChart: Component<AreaOptions, AreaC>;
|
|
47
|
+
export declare const StackedBarChart: Component<StackedBarOptions, StackedBarC>;
|
|
48
|
+
export declare const GroupedBarChart: Component<GroupedBarOptions, GroupedBarC>;
|
|
49
|
+
export declare const MultiLineChart: Component<MultiLineOptions, MultiLineC>;
|
|
50
|
+
export declare const ScatterChart: Component<ScatterOptions, ScatterC>;
|
|
51
|
+
export declare const BubbleChart: Component<BubbleOptions, BubbleC>;
|
|
52
|
+
export declare const PieChart: Component<PieOptions, PieC>;
|
|
53
|
+
export declare const RadarChart: Component<RadarOptions, RadarC>;
|
|
54
|
+
export declare const PolarChart: Component<PolarOptions, PolarC>;
|
|
55
|
+
export declare const GaugeChart: Component<GaugeOptions, GaugeC>;
|
|
56
|
+
export declare const HeatmapChart: Component<HeatmapOptions, HeatmapC>;
|
|
57
|
+
export declare const BoxplotChart: Component<BoxplotOptions, BoxplotC>;
|
|
58
|
+
export declare const FunnelChart: Component<FunnelOptions, FunnelC>;
|
|
59
|
+
export declare const TreemapChart: Component<TreemapOptions, TreemapC>;
|
|
60
|
+
export declare const SparklineChart: Component<SparklineOptions, SparklineC>;
|
|
61
|
+
export declare const RealtimeChart: Component<RealtimeOptions, RealtimeC>;
|
|
62
|
+
export declare const WaterfallChart: Component<WaterfallOptions, WaterfallC>;
|
|
63
|
+
export declare const CompositeChart: Component<CompositeOptions, CompositeC>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeriz/chart",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Visualization, light as air — 21 canvas chart types, import only what you use, zero dependencies. React, Vue, Svelte and jQuery
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Visualization, light as air — 21 canvas chart types with one way to use them, import only what you use, zero dependencies. React, Vue, Svelte and jQuery components included.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chart",
|
|
7
7
|
"charts",
|