@vuu-ui/vuu-chart 4.0.0-alpha.21 → 4.0.0-alpha.22

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.
Files changed (45) hide show
  1. package/README.md +324 -0
  2. package/package.json +12 -15
  3. package/src/Chart.css.js +22 -0
  4. package/src/Chart.js +4 -4
  5. package/src/ChartSeries.js +20 -3
  6. package/src/chart-data/ChartDataStore.js +131 -0
  7. package/src/chart-data/projection-utils.js +119 -0
  8. package/src/charts/CandlestickChart.js +31 -0
  9. package/src/charts/CartesianChart.js +28 -0
  10. package/src/charts/DepthChart.js +28 -0
  11. package/src/charts/HeatmapChart.js +31 -0
  12. package/src/charts/HierarchyChart.js +41 -0
  13. package/src/charts/candlestick-model.js +373 -0
  14. package/src/charts/cartesian-model.js +234 -0
  15. package/src/charts/depth-model.js +159 -0
  16. package/src/charts/heatmap-model.js +243 -0
  17. package/src/charts/hierarchy-model.js +224 -0
  18. package/src/echarts.js +26 -0
  19. package/src/engine/ChartModel.js +2 -0
  20. package/src/engine/VuuChartContainer.js +196 -0
  21. package/src/engine/useStructuralMemo.js +18 -0
  22. package/src/index.js +8 -0
  23. package/src/options/common.js +181 -0
  24. package/src/options/mergeOptions.js +37 -0
  25. package/src/theme/chartTheme.js +74 -0
  26. package/src/useChartOptions.js +25 -2
  27. package/src/vuu-chart-types.js +0 -0
  28. package/types/Chart.d.ts +0 -28
  29. package/types/ChartSeries.d.ts +0 -32
  30. package/types/DataRowMovingWindow.d.ts +0 -23
  31. package/types/chart-types.d.ts +0 -42
  32. package/types/chartTooltip.d.ts +0 -12
  33. package/types/index.d.ts +0 -5
  34. package/types/src/Chart.d.ts +0 -28
  35. package/types/src/ChartSeries.d.ts +0 -32
  36. package/types/src/DataRowMovingWindow.d.ts +0 -23
  37. package/types/src/chart-types.d.ts +0 -42
  38. package/types/src/chartTooltip.d.ts +0 -12
  39. package/types/src/index.d.ts +0 -5
  40. package/types/src/useChartContextMenu.d.ts +0 -16
  41. package/types/src/useChartOptions.d.ts +0 -28
  42. package/types/src/useChartSelection.d.ts +0 -14
  43. package/types/useChartContextMenu.d.ts +0 -16
  44. package/types/useChartOptions.d.ts +0 -28
  45. package/types/useChartSelection.d.ts +0 -14
@@ -0,0 +1,37 @@
1
+ const isPlainObject = (value)=>null !== value && "object" == typeof value && (Object.getPrototypeOf(value) === Object.prototype || null === Object.getPrototypeOf(value));
2
+ const hasId = (value)=>isPlainObject(value) && void 0 !== value.id;
3
+ const mergeArrays = (base, override)=>{
4
+ const result = base.slice();
5
+ override.forEach((item, i)=>{
6
+ if (hasId(item)) {
7
+ const index = result.findIndex((b)=>hasId(b) && b.id === item.id);
8
+ if (-1 !== index) result[index] = mergeValues(result[index], item);
9
+ else result.push(item);
10
+ } else if (i < result.length) result[i] = mergeValues(result[i], item);
11
+ else result.push(item);
12
+ });
13
+ return result;
14
+ };
15
+ const mergeValues = (base, override)=>{
16
+ if (void 0 === override) return base;
17
+ if (isPlainObject(base) && isPlainObject(override)) {
18
+ const result = {
19
+ ...base
20
+ };
21
+ for (const [key, value] of Object.entries(override))result[key] = mergeValues(base[key], value);
22
+ return result;
23
+ }
24
+ if (Array.isArray(override) && (Array.isArray(base) || isPlainObject(base))) {
25
+ const baseArray = Array.isArray(base) ? base : [
26
+ base
27
+ ];
28
+ if (override.every((o)=>isPlainObject(o))) return mergeArrays(baseArray, override);
29
+ return override;
30
+ }
31
+ if (Array.isArray(base) && isPlainObject(override)) return mergeArrays(base, [
32
+ override
33
+ ]);
34
+ return override;
35
+ };
36
+ const mergeEChartsOptions = (base, ...overrides)=>overrides.reduce((result, override)=>override ? mergeValues(result, override) : result, base);
37
+ export { mergeEChartsOptions };
@@ -0,0 +1,74 @@
1
+ const defaultPalette = [
2
+ "#4676bf",
3
+ "#ab6528",
4
+ "#9f55c2",
5
+ "#2a8285",
6
+ "#697694",
7
+ "#b0549d",
8
+ "#c69d26",
9
+ "#5c8a3a"
10
+ ];
11
+ const defaultChartTheme = {
12
+ axisLineColor: "#9fa3a8",
13
+ backgroundColor: "transparent",
14
+ crosshairColor: "#697694",
15
+ downColor: "#e52135",
16
+ fontFamily: "sans-serif",
17
+ foregroundColor: "#15171b",
18
+ heatmapColors: [
19
+ "#e2ebf8",
20
+ "#1b4f9c"
21
+ ],
22
+ palette: defaultPalette,
23
+ secondaryForegroundColor: "#5f646d",
24
+ splitLineColor: "#e6e8ea",
25
+ tooltipBackgroundColor: "#ffffff",
26
+ tooltipBorderColor: "#2670a9",
27
+ upColor: "#00875d"
28
+ };
29
+ const PALETTE_SIZE = 8;
30
+ const read = (style, name, fallback)=>{
31
+ const value = style.getPropertyValue(name).trim();
32
+ return "" === value ? fallback : value;
33
+ };
34
+ const resolveChartTheme = (element, overrides)=>{
35
+ let theme = defaultChartTheme;
36
+ if (element && "function" == typeof getComputedStyle) {
37
+ const style = getComputedStyle(element);
38
+ const d = defaultChartTheme;
39
+ const palette = [];
40
+ for(let i = 0; i < PALETTE_SIZE; i++)palette.push(read(style, `--vuuChart-color-${i + 1}`, d.palette[i]));
41
+ theme = {
42
+ axisLineColor: read(style, "--vuuChart-axisLineColor", d.axisLineColor),
43
+ backgroundColor: read(style, "--vuuChart-background", d.backgroundColor),
44
+ crosshairColor: read(style, "--vuuChart-crosshairColor", d.crosshairColor),
45
+ downColor: read(style, "--vuuChart-downColor", d.downColor),
46
+ fontFamily: read(style, "--vuuChart-fontFamily", d.fontFamily),
47
+ foregroundColor: read(style, "--vuuChart-foreground", d.foregroundColor),
48
+ heatmapColors: [
49
+ read(style, "--vuuChart-heatmap-lowColor", d.heatmapColors[0]),
50
+ read(style, "--vuuChart-heatmap-highColor", d.heatmapColors[1])
51
+ ],
52
+ palette,
53
+ secondaryForegroundColor: read(style, "--vuuChart-secondaryForeground", d.secondaryForegroundColor),
54
+ splitLineColor: read(style, "--vuuChart-splitLineColor", d.splitLineColor),
55
+ tooltipBackgroundColor: read(style, "--vuuChart-tooltip-background", d.tooltipBackgroundColor),
56
+ tooltipBorderColor: read(style, "--vuuChart-tooltip-borderColor", d.tooltipBorderColor),
57
+ upColor: read(style, "--vuuChart-upColor", d.upColor)
58
+ };
59
+ }
60
+ return overrides ? {
61
+ ...theme,
62
+ ...overrides
63
+ } : theme;
64
+ };
65
+ const resolveColor = (color, theme)=>{
66
+ if ("up" === color) return theme.upColor;
67
+ if ("down" === color) return theme.downColor;
68
+ if (color?.startsWith("palette-")) {
69
+ const index = parseInt(color.slice(8), 10) - 1;
70
+ return theme.palette[index % theme.palette.length];
71
+ }
72
+ return color;
73
+ };
74
+ export { defaultChartTheme, defaultPalette, resolveChartTheme, resolveColor };
@@ -1,5 +1,5 @@
1
1
  import { itemsChanged } from "@vuu-ui/vuu-utils";
2
- import { useMemo, useState } from "react";
2
+ import { useEffect, useMemo, useRef, useState } from "react";
3
3
  import { ChartSeries } from "./ChartSeries.js";
4
4
  import { chartTooltip } from "./chartTooltip.js";
5
5
  const defaultPalette = [
@@ -16,6 +16,7 @@ const combineConfig = (config, overrides)=>({
16
16
  });
17
17
  const useChartOptions = ({ categoryColumnName, config, dataExclusions, dataSource, itemColorFunction, palette = defaultPalette, seriesColumnNames, showTooltip = true, symbolSizeFunction: symbolSize })=>{
18
18
  const [, forceRender] = useState({});
19
+ const frameRef = useRef(void 0);
19
20
  const chartSeries = useMemo(()=>{
20
21
  const cs = new ChartSeries({
21
22
  config: combineConfig(config, {
@@ -26,12 +27,34 @@ const useChartOptions = ({ categoryColumnName, config, dataExclusions, dataSourc
26
27
  dataSource,
27
28
  palette
28
29
  });
29
- cs.on("update", ()=>forceRender({}));
30
+ cs.on("update", ()=>{
31
+ if (void 0 === frameRef.current) frameRef.current = requestAnimationFrame(()=>{
32
+ frameRef.current = void 0;
33
+ forceRender({});
34
+ });
35
+ });
30
36
  return cs;
31
37
  }, [
32
38
  dataSource,
33
39
  config
34
40
  ]);
41
+ const chartSeriesRef = useRef(chartSeries);
42
+ chartSeriesRef.current = chartSeries;
43
+ useEffect(()=>{
44
+ chartSeries.subscribe();
45
+ return ()=>{
46
+ if (void 0 !== frameRef.current) {
47
+ cancelAnimationFrame(frameRef.current);
48
+ frameRef.current = void 0;
49
+ }
50
+ chartSeries.detach();
51
+ };
52
+ }, [
53
+ chartSeries
54
+ ]);
55
+ useEffect(()=>()=>{
56
+ chartSeriesRef.current.dispose();
57
+ }, []);
35
58
  useMemo(()=>{
36
59
  if (categoryColumnName !== chartSeries.categoryColumn) chartSeries.categoryColumn = categoryColumnName;
37
60
  if (itemsChanged(seriesColumnNames, chartSeries.seriesColumnNames)) chartSeries.seriesColumnNames = seriesColumnNames;
File without changes
package/types/Chart.d.ts DELETED
@@ -1,28 +0,0 @@
1
- import { type ChartOptionsProps } from "./useChartOptions";
2
- import { type MeasuredContainerProps } from "@vuu-ui/vuu-ui-controls";
3
- type OptionSettings = {
4
- notMerge: boolean;
5
- };
6
- type ChartSettings = {
7
- /**
8
- * Default value will be svg
9
- */
10
- renderer: "svg" | "canvas";
11
- /**
12
- * Enlarges 'click zone' around interactive elements.
13
- * Default value true;
14
- */
15
- useCoarsePointer: boolean;
16
- };
17
- export interface ChartProps extends ChartOptionsProps, Omit<MeasuredContainerProps, "children" | "onResize"> {
18
- chartSettings?: Partial<ChartSettings>;
19
- optionSettings?: OptionSettings;
20
- /**
21
- * An array of color values that will be assigned, in the order given
22
- * to rendered series.
23
- */
24
- palette?: string[];
25
- showTooltip?: boolean;
26
- }
27
- export declare const Chart: ({ categoryColumnName, chartSettings, className, config, dataExclusions, dataSource, height, optionSettings, palette, resizeStrategy, showTooltip, style, seriesColumnNames, width, ...htmlAttributes }: ChartProps) => import("react/jsx-runtime").JSX.Element;
28
- export {};
@@ -1,32 +0,0 @@
1
- import { DataSource, DataSourceRow, DataSourceSubscribeCallback } from "@vuu-ui/vuu-data-types";
2
- import { EventEmitter } from "@vuu-ui/vuu-utils";
3
- import { Series } from "./chart-types";
4
- import { ChartConfig, DataExclusionOptions } from "./useChartOptions";
5
- export type DataSourceValue = {
6
- key: string;
7
- readonly row: DataSourceRow;
8
- value: number | null;
9
- };
10
- export type ChartEvents = {
11
- update: () => void;
12
- };
13
- export interface ChartSeriesConstructorProps {
14
- dataExclusions?: DataExclusionOptions;
15
- dataSource: DataSource;
16
- config: ChartConfig;
17
- palette: string[];
18
- }
19
- export declare class ChartSeries extends EventEmitter<ChartEvents> {
20
- #private;
21
- handleData: DataSourceSubscribeCallback;
22
- buildCategoriesAndSeries(): void;
23
- constructor({ config, dataExclusions, dataSource, palette, }: ChartSeriesConstructorProps);
24
- get palette(): (string | undefined)[];
25
- get categoryColumn(): string;
26
- set categoryColumn(categoryColumn: string);
27
- get seriesColumnNames(): string[];
28
- set seriesColumnNames(seriesColumnNames: string[]);
29
- get categories(): string[];
30
- get series(): Series[];
31
- private getCategoriesAndSeries;
32
- }
@@ -1,23 +0,0 @@
1
- import { DataSourceRow } from "@vuu-ui/vuu-data-types";
2
- import { VuuRange } from "@vuu-ui/vuu-protocol-types";
3
- import { WindowRange } from "@vuu-ui/vuu-utils";
4
- export declare class MovingDataRowWindow {
5
- #private;
6
- data: DataSourceRow[];
7
- rowCount: number;
8
- constructor({ from, to }: VuuRange);
9
- setRowCount: (rowCount: number) => void;
10
- add(data: DataSourceRow): void;
11
- getAtIndex(index: number): DataSourceRow | undefined;
12
- getByKey(key: string): DataSourceRow | undefined;
13
- isWithinRange(index: number): boolean;
14
- setRange({ from, to }: VuuRange): void;
15
- get hasData(): boolean;
16
- /**
17
- * This will throw if there is no data. Check `hasData` first
18
- * to guard against this, if not certain.
19
- */
20
- get firstRow(): DataSourceRow;
21
- get range(): WindowRange;
22
- get hasAllRowsWithinRange(): boolean;
23
- }
@@ -1,42 +0,0 @@
1
- import { DataSourceValue } from "./ChartSeries";
2
- export declare const defaultItemColorFunction: ItemColorFunction;
3
- export type EChartsCallbackParams = {
4
- color: string;
5
- data: DataSourceValue;
6
- dataIndex: number;
7
- name: string;
8
- /**
9
- * This is the Vuu column name
10
- */
11
- seriesName: string;
12
- };
13
- export type SymbolSizeFunction = (value: number, params: EChartsCallbackParams) => number | [number, number];
14
- export type SymbolSize = number | [number, number] | SymbolSizeFunction;
15
- export type SymbolType = "emptyCircle" | "circle" | `path://${string}`;
16
- export type ItemColorFunction = (params: EChartsCallbackParams) => string;
17
- export interface SeriesBase {
18
- data: DataSourceValue[];
19
- id: string;
20
- itemStyle?: {
21
- borderColor?: string;
22
- color: string | ItemColorFunction;
23
- borderWidth?: number;
24
- };
25
- label: string;
26
- name: string;
27
- symbol?: SymbolType;
28
- symbolSize: SymbolSize;
29
- }
30
- export interface LineSeries extends SeriesBase {
31
- connectNulls?: boolean;
32
- lineStyle: {
33
- color?: string;
34
- width: number;
35
- };
36
- type: "line";
37
- }
38
- export interface ScatterSeries extends SeriesBase {
39
- type: "scatter";
40
- }
41
- export type Series = LineSeries | ScatterSeries;
42
- export type ChartSelectionModel = "none" | "single" | "single-no-deselect" | "extended";
@@ -1,12 +0,0 @@
1
- import { DataSourceValue } from "./ChartSeries";
2
- export interface TooltipParams {
3
- axisValueLabel: string;
4
- color: string;
5
- componentType: string;
6
- componentSubType: string;
7
- data: DataSourceValue;
8
- seriesName: string;
9
- seriesType: 'line' | 'scatter';
10
- value: number;
11
- }
12
- export declare const chartTooltip: (params: TooltipParams[]) => string | undefined;
package/types/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export { Chart, type ChartProps } from "./Chart";
2
- export type { ItemColorFunction, LineSeries as Series } from './chart-types';
3
- export { ChartSeries, type DataSourceValue } from "./ChartSeries";
4
- export type { ChartContextMenuOptions, ChartMenuLocation } from "./useChartContextMenu";
5
- export type { ChartConfig, DataExclusionOptions } from './useChartOptions';
@@ -1,28 +0,0 @@
1
- import { ChartOptionsProps } from "./useChartOptions";
2
- import { type MeasuredContainerProps } from "@vuu-ui/vuu-ui-controls";
3
- type OptionSettings = {
4
- notMerge: boolean;
5
- };
6
- type ChartSettings = {
7
- /**
8
- * Default value will be svg
9
- */
10
- renderer: "svg" | "canvas";
11
- /**
12
- * Enlarges 'click zone' around interactive elements.
13
- * Default value true;
14
- */
15
- useCoarsePointer: boolean;
16
- };
17
- export interface ChartProps extends ChartOptionsProps, Omit<MeasuredContainerProps, "children" | "onResize"> {
18
- chartSettings?: Partial<ChartSettings>;
19
- optionSettings?: OptionSettings;
20
- /**
21
- * An array of color values that will be assigned, in the order given
22
- * to rendered series.
23
- */
24
- palette?: string[];
25
- showTooltip?: boolean;
26
- }
27
- export declare const Chart: ({ categoryColumnName, chartSettings, className, config, dataExclusions, dataSource, height, optionSettings, palette, resizeStrategy, showTooltip, style, seriesColumnNames, width, ...htmlAttributes }: ChartProps) => import("react").JSX.Element;
28
- export {};
@@ -1,32 +0,0 @@
1
- import { DataSource, DataSourceRow, DataSourceSubscribeCallback } from "@vuu-ui/vuu-data-types";
2
- import { EventEmitter } from "@vuu-ui/vuu-utils";
3
- import { Series } from "./chart-types";
4
- import { ChartConfig, DataExclusionOptions } from "./useChartOptions";
5
- export type DataSourceValue = {
6
- key: string;
7
- readonly row: DataSourceRow;
8
- value: number | null;
9
- };
10
- export type ChartEvents = {
11
- update: () => void;
12
- };
13
- export interface ChartSeriesConstructorProps {
14
- dataExclusions?: DataExclusionOptions;
15
- dataSource: DataSource;
16
- config: ChartConfig;
17
- palette: string[];
18
- }
19
- export declare class ChartSeries extends EventEmitter<ChartEvents> {
20
- #private;
21
- handleData: DataSourceSubscribeCallback;
22
- buildCategoriesAndSeries(): void;
23
- constructor({ config, dataExclusions, dataSource, palette, }: ChartSeriesConstructorProps);
24
- get palette(): (string | undefined)[];
25
- get categoryColumn(): string;
26
- set categoryColumn(categoryColumn: string);
27
- get seriesColumnNames(): string[];
28
- set seriesColumnNames(seriesColumnNames: string[]);
29
- get categories(): string[];
30
- get series(): Series[];
31
- private getCategoriesAndSeries;
32
- }
@@ -1,23 +0,0 @@
1
- import { DataSourceRow } from "@vuu-ui/vuu-data-types";
2
- import { VuuRange } from "@vuu-ui/vuu-protocol-types";
3
- import { WindowRange } from "@vuu-ui/vuu-utils";
4
- export declare class MovingDataRowWindow {
5
- #private;
6
- data: DataSourceRow[];
7
- rowCount: number;
8
- constructor({ from, to }: VuuRange);
9
- setRowCount: (rowCount: number) => void;
10
- add(data: DataSourceRow): void;
11
- getAtIndex(index: number): DataSourceRow | undefined;
12
- getByKey(key: string): DataSourceRow | undefined;
13
- isWithinRange(index: number): boolean;
14
- setRange({ from, to }: VuuRange): void;
15
- get hasData(): boolean;
16
- /**
17
- * This will throw if there is no data. Check `hasData` first
18
- * to guard against this, if not certain.
19
- */
20
- get firstRow(): DataSourceRow;
21
- get range(): WindowRange;
22
- get hasAllRowsWithinRange(): boolean;
23
- }
@@ -1,42 +0,0 @@
1
- import { DataSourceValue } from "./ChartSeries";
2
- export declare const defaultItemColorFunction: ItemColorFunction;
3
- export type EChartsCallbackParams = {
4
- color: string;
5
- data: DataSourceValue;
6
- dataIndex: number;
7
- name: string;
8
- /**
9
- * This is the Vuu column name
10
- */
11
- seriesName: string;
12
- };
13
- export type SymbolSizeFunction = (value: number, params: EChartsCallbackParams) => number | [number, number];
14
- export type SymbolSize = number | [number, number] | SymbolSizeFunction;
15
- export type SymbolType = "emptyCircle" | "circle" | `path://${string}`;
16
- export type ItemColorFunction = (params: EChartsCallbackParams) => string;
17
- export interface SeriesBase {
18
- data: DataSourceValue[];
19
- id: string;
20
- itemStyle?: {
21
- borderColor?: string;
22
- color: string | ItemColorFunction;
23
- borderWidth?: number;
24
- };
25
- label: string;
26
- name: string;
27
- symbol?: SymbolType;
28
- symbolSize: SymbolSize;
29
- }
30
- export interface LineSeries extends SeriesBase {
31
- connectNulls?: boolean;
32
- lineStyle: {
33
- color?: string;
34
- width: number;
35
- };
36
- type: "line";
37
- }
38
- export interface ScatterSeries extends SeriesBase {
39
- type: "scatter";
40
- }
41
- export type Series = LineSeries | ScatterSeries;
42
- export type ChartSelectionModel = "none" | "single" | "single-no-deselect" | "extended";
@@ -1,12 +0,0 @@
1
- import { DataSourceValue } from "./ChartSeries";
2
- export interface TooltipParams {
3
- axisValueLabel: string;
4
- color: string;
5
- componentType: string;
6
- componentSubType: string;
7
- data: DataSourceValue;
8
- seriesName: string;
9
- seriesType: 'line' | 'scatter';
10
- value: number;
11
- }
12
- export declare const chartTooltip: (params: TooltipParams[]) => string | undefined;
@@ -1,5 +0,0 @@
1
- export { Chart, type ChartProps } from "./Chart";
2
- export type { ItemColorFunction, LineSeries as Series } from './chart-types';
3
- export { ChartSeries, type DataSourceValue } from "./ChartSeries";
4
- export type { ChartContextMenuOptions, ChartMenuLocation } from "./useChartContextMenu";
5
- export type { ChartConfig, DataExclusionOptions } from './useChartOptions';
@@ -1,16 +0,0 @@
1
- import { DataSourceRow } from "@vuu-ui/vuu-data-types";
2
- import { ECElementEvent } from "echarts";
3
- import { ColumnMap } from "@vuu-ui/vuu-utils";
4
- export type ChartMenuLocation = "canvas" | "series";
5
- export type ChartContextMenuOptions = {
6
- column: string;
7
- columnMap: ColumnMap;
8
- row: DataSourceRow;
9
- };
10
- interface ChartContextMenuHookProps {
11
- allowContextMenu?: boolean;
12
- categoryColumnName?: string;
13
- columnMap: ColumnMap;
14
- }
15
- export declare const useChartContextMenu: ({ columnMap, }: ChartContextMenuHookProps) => ({ data, event, seriesName }: ECElementEvent) => void;
16
- export {};
@@ -1,28 +0,0 @@
1
- import { DataSource, DataSourceRow } from "@vuu-ui/vuu-data-types";
2
- import { ColumnMap } from "@vuu-ui/vuu-utils";
3
- import { type EChartsCoreOption } from "echarts";
4
- import type { ChartSelectionModel, ItemColorFunction, SymbolSize, SymbolSizeFunction, SymbolType } from "./chart-types";
5
- export interface ChartConfig {
6
- itemColorFunction?: ItemColorFunction;
7
- selectionModel?: ChartSelectionModel;
8
- symbolSize?: SymbolSize;
9
- }
10
- export interface DataExclusionOptions {
11
- isExcludedData: (row: DataSourceRow, columnMap: ColumnMap, column: string) => boolean;
12
- /**
13
- * An embedded SVG path. If provided, will be used to render excluded values.
14
- */
15
- symbol?: SymbolType;
16
- }
17
- export interface ChartOptionsProps {
18
- categoryColumnName: string;
19
- config: ChartConfig;
20
- dataExclusions?: DataExclusionOptions;
21
- dataSource: DataSource;
22
- itemColorFunction?: ItemColorFunction;
23
- palette?: string[];
24
- seriesColumnNames: string[];
25
- showTooltip?: boolean;
26
- symbolSizeFunction?: SymbolSizeFunction;
27
- }
28
- export declare const useChartOptions: ({ categoryColumnName, config, dataExclusions, dataSource, itemColorFunction, palette, seriesColumnNames, showTooltip, symbolSizeFunction: symbolSize, }: ChartOptionsProps) => EChartsCoreOption;
@@ -1,14 +0,0 @@
1
- import { ECElementEvent } from "echarts";
2
- import { ChartSelectionModel, ItemColorFunction, SymbolSizeFunction } from "./chart-types";
3
- interface ChartSelectionHookProps {
4
- selectionModel?: ChartSelectionModel;
5
- categoryColumnName: string;
6
- }
7
- export declare const useChartSelection: (_props: ChartSelectionHookProps) => {
8
- onClick: ({ data, event, seriesName: column }: ECElementEvent) => void;
9
- onMouseOver: ({ data, seriesName }: ECElementEvent) => void;
10
- onMouseOut: () => void;
11
- itemColorFunction: ItemColorFunction;
12
- symbolSizeFunction: SymbolSizeFunction;
13
- };
14
- export {};
@@ -1,16 +0,0 @@
1
- import { DataSourceRow } from "@vuu-ui/vuu-data-types";
2
- import { ECElementEvent } from "echarts";
3
- import { ColumnMap } from "@vuu-ui/vuu-utils";
4
- export type ChartMenuLocation = "canvas" | "series";
5
- export type ChartContextMenuOptions = {
6
- column: string;
7
- columnMap: ColumnMap;
8
- row: DataSourceRow;
9
- };
10
- interface ChartContextMenuHookProps {
11
- allowContextMenu?: boolean;
12
- categoryColumnName?: string;
13
- columnMap: ColumnMap;
14
- }
15
- export declare const useChartContextMenu: ({ columnMap, }: ChartContextMenuHookProps) => ({ data, event, seriesName }: ECElementEvent) => void;
16
- export {};
@@ -1,28 +0,0 @@
1
- import { DataSource, DataSourceRow } from "@vuu-ui/vuu-data-types";
2
- import { ColumnMap } from "@vuu-ui/vuu-utils";
3
- import { type EChartsCoreOption } from "echarts";
4
- import type { ChartSelectionModel, ItemColorFunction, SymbolSize, SymbolSizeFunction, SymbolType } from "./chart-types";
5
- export interface ChartConfig {
6
- itemColorFunction?: ItemColorFunction;
7
- selectionModel?: ChartSelectionModel;
8
- symbolSize?: SymbolSize;
9
- }
10
- export interface DataExclusionOptions {
11
- isExcludedData: (row: DataSourceRow, columnMap: ColumnMap, column: string) => boolean;
12
- /**
13
- * An embedded SVG path. If provided, will be used to render excluded values.
14
- */
15
- symbol?: SymbolType;
16
- }
17
- export interface ChartOptionsProps {
18
- categoryColumnName: string;
19
- config: ChartConfig;
20
- dataExclusions?: DataExclusionOptions;
21
- dataSource: DataSource;
22
- itemColorFunction?: ItemColorFunction;
23
- palette?: string[];
24
- seriesColumnNames: string[];
25
- showTooltip?: boolean;
26
- symbolSizeFunction?: SymbolSizeFunction;
27
- }
28
- export declare const useChartOptions: ({ categoryColumnName, config, dataExclusions, dataSource, itemColorFunction, palette, seriesColumnNames, showTooltip, symbolSizeFunction: symbolSize, }: ChartOptionsProps) => EChartsCoreOption;
@@ -1,14 +0,0 @@
1
- import { ECElementEvent } from "echarts";
2
- import { ChartSelectionModel, ItemColorFunction, SymbolSizeFunction } from "./chart-types";
3
- interface ChartSelectionHookProps {
4
- selectionModel?: ChartSelectionModel;
5
- categoryColumnName: string;
6
- }
7
- export declare const useChartSelection: (_props: ChartSelectionHookProps) => {
8
- onClick: ({ data, event, seriesName: column }: ECElementEvent) => void;
9
- onMouseOver: ({ data, seriesName }: ECElementEvent) => void;
10
- onMouseOut: () => void;
11
- itemColorFunction: ItemColorFunction;
12
- symbolSizeFunction: SymbolSizeFunction;
13
- };
14
- export {};