@neo4j-ndl/react-charts 1.2.13 → 1.3.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/lib/cjs/charts/Chart.js +20 -0
- package/lib/cjs/charts/Chart.js.map +1 -1
- package/lib/cjs/charts/ChartRender.js +1 -3
- package/lib/cjs/charts/ChartRender.js.map +1 -1
- package/lib/cjs/charts/hooks/use-chart-option.js +1 -3
- package/lib/cjs/charts/hooks/use-chart-option.js.map +1 -1
- package/lib/cjs/charts/tests/HorizontalBarWithVerticalSlider.js +78 -0
- package/lib/cjs/charts/tests/HorizontalBarWithVerticalSlider.js.map +1 -0
- package/lib/cjs/charts/utils/build-chart-option.js +48 -16
- package/lib/cjs/charts/utils/build-chart-option.js.map +1 -1
- package/lib/cjs/charts/utils/user-option-utils.js +171 -8
- package/lib/cjs/charts/utils/user-option-utils.js.map +1 -1
- package/lib/esm/charts/Chart.js +20 -0
- package/lib/esm/charts/Chart.js.map +1 -1
- package/lib/esm/charts/ChartRender.js +2 -4
- package/lib/esm/charts/ChartRender.js.map +1 -1
- package/lib/esm/charts/hooks/use-chart-option.js +1 -3
- package/lib/esm/charts/hooks/use-chart-option.js.map +1 -1
- package/lib/esm/charts/tests/HorizontalBarWithVerticalSlider.js +74 -0
- package/lib/esm/charts/tests/HorizontalBarWithVerticalSlider.js.map +1 -0
- package/lib/esm/charts/utils/build-chart-option.js +46 -16
- package/lib/esm/charts/utils/build-chart-option.js.map +1 -1
- package/lib/esm/charts/utils/user-option-utils.js +168 -7
- package/lib/esm/charts/utils/user-option-utils.js.map +1 -1
- package/lib/types/charts/Chart.d.ts +20 -0
- package/lib/types/charts/Chart.d.ts.map +1 -1
- package/lib/types/charts/ChartRender.d.ts.map +1 -1
- package/lib/types/charts/hooks/use-chart-option.d.ts +1 -2
- package/lib/types/charts/hooks/use-chart-option.d.ts.map +1 -1
- package/lib/types/charts/tests/HorizontalBarWithVerticalSlider.d.ts +38 -0
- package/lib/types/charts/tests/HorizontalBarWithVerticalSlider.d.ts.map +1 -0
- package/lib/types/charts/utils/build-chart-option.d.ts +17 -4
- package/lib/types/charts/utils/build-chart-option.d.ts.map +1 -1
- package/lib/types/charts/utils/user-option-utils.d.ts +26 -2
- package/lib/types/charts/utils/user-option-utils.d.ts.map +1 -1
- package/package.json +3 -3
- package/skills/ndl-react-charts/SKILL.md +1 -1
- package/skills/ndl-react-charts/components/charts.md +195 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* Copyright (c) "Neo4j"
|
|
4
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
5
|
+
*
|
|
6
|
+
* This file is part of Neo4j.
|
|
7
|
+
*
|
|
8
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU General Public License as published by
|
|
10
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
* (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU General Public License
|
|
19
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
21
|
+
export declare const verticalSliderCategories: string[];
|
|
22
|
+
export type VerticalSliderHarnessApi = {
|
|
23
|
+
/** Resolved layout of the first dataZoom component and the grid. */
|
|
24
|
+
getResolvedLayout: () => {
|
|
25
|
+
grid: {
|
|
26
|
+
right?: number | string;
|
|
27
|
+
};
|
|
28
|
+
slider: Record<string, unknown>;
|
|
29
|
+
};
|
|
30
|
+
/** Applies a zoom window through the slider's dataZoom action. */
|
|
31
|
+
zoomTo: (start: number, end: number) => void;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Horizontal bar chart (value x-axis, category y-axis) with a slider bound to
|
|
35
|
+
* the category axis, which Needle lays out as a vertical slider on the right.
|
|
36
|
+
*/
|
|
37
|
+
export declare const HorizontalBarWithVerticalSlider: () => import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
//# sourceMappingURL=HorizontalBarWithVerticalSlider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HorizontalBarWithVerticalSlider.d.ts","sourceRoot":"","sources":["../../../../src/charts/tests/HorizontalBarWithVerticalSlider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAMH,eAAO,MAAM,wBAAwB,UASpC,CAAC;AAYF,MAAM,MAAM,wBAAwB,GAAG;IACrC,oEAAoE;IACpE,iBAAiB,EAAE,MAAM;QACvB,IAAI,EAAE;YAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAC;QAClC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACjC,CAAC;IACF,kEAAkE;IAClE,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C,CAAC;AAWF;;;GAGG;AACH,eAAO,MAAM,+BAA+B,+CAoC3C,CAAC"}
|
|
@@ -25,7 +25,6 @@ type BuildChartOptionParams = {
|
|
|
25
25
|
dataZoom: EChartsOption['dataZoom'];
|
|
26
26
|
dataset: ChartProps['dataset'];
|
|
27
27
|
hasCategoryXAxis: boolean;
|
|
28
|
-
hasSliderZoom: boolean;
|
|
29
28
|
legendSelected: Record<string, boolean>;
|
|
30
29
|
propsSeries: ChartProps['series'];
|
|
31
30
|
series: EchartsSeries;
|
|
@@ -37,9 +36,15 @@ type BuildChartOptionParams = {
|
|
|
37
36
|
hasMarkArea: boolean;
|
|
38
37
|
};
|
|
39
38
|
/**
|
|
40
|
-
*
|
|
39
|
+
* Horizontal slider zoom needs extra bottom grid space for ECharts' slider
|
|
40
|
+
* control.
|
|
41
41
|
*/
|
|
42
|
-
export declare function
|
|
42
|
+
export declare function hasHorizontalSliderZoom(dataZoom: EChartsOption['dataZoom']): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Vertical slider zoom needs extra right grid space for ECharts' slider
|
|
45
|
+
* control.
|
|
46
|
+
*/
|
|
47
|
+
export declare function hasVerticalSliderZoom(dataZoom: EChartsOption['dataZoom']): boolean;
|
|
43
48
|
/**
|
|
44
49
|
* Reserves the area occupied by bottom-positioned horizontal slider controls.
|
|
45
50
|
*
|
|
@@ -49,6 +54,14 @@ export declare function hasSliderDataZoom(dataZoom: EChartsOption['dataZoom']):
|
|
|
49
54
|
* reserve because they cannot be resolved without the rendered chart size.
|
|
50
55
|
*/
|
|
51
56
|
export declare function getSliderBottomOuterBound(dataZoom: EChartsOption['dataZoom']): number | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Reserves the area occupied by right-positioned vertical slider controls,
|
|
59
|
+
* mirroring `getSliderBottomOuterBound` for horizontal ones. Normalized
|
|
60
|
+
* sliders use pixel values; custom percentage-based layouts fall back to the
|
|
61
|
+
* 60px reserve because they cannot be resolved without the rendered chart
|
|
62
|
+
* size.
|
|
63
|
+
*/
|
|
64
|
+
export declare function getSliderRightOuterBound(dataZoom: EChartsOption['dataZoom']): number | undefined;
|
|
52
65
|
/**
|
|
53
66
|
* Mark area needs extra top grid space to fit inside the chart.
|
|
54
67
|
*/
|
|
@@ -61,6 +74,6 @@ export declare function hasCategoryXAxis(xAxis: EChartsOption['xAxis']): boolean
|
|
|
61
74
|
* Builds the ECharts option object from Needle chart props and derived values.
|
|
62
75
|
* Applying the option to an ECharts instance happens in `useChartOption`.
|
|
63
76
|
*/
|
|
64
|
-
export declare function buildChartOption({ dataZoom, dataset, hasCategoryXAxis,
|
|
77
|
+
export declare function buildChartOption({ dataZoom, dataset, hasCategoryXAxis, legendSelected, propsSeries, series, thresholdLines, toolboxOptions, userOption, xAxis, yAxis, hasMarkArea, }: BuildChartOptionParams): EChartsOption;
|
|
65
78
|
export {};
|
|
66
79
|
//# sourceMappingURL=build-chart-option.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-chart-option.d.ts","sourceRoot":"","sources":["../../../../src/charts/utils/build-chart-option.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAA2B,aAAa,EAAE,MAAM,SAAS,CAAC;AAItE,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAM3D,KAAK,sBAAsB,GAAG;IAC5B,QAAQ,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IACpC,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IAC/B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,
|
|
1
|
+
{"version":3,"file":"build-chart-option.d.ts","sourceRoot":"","sources":["../../../../src/charts/utils/build-chart-option.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAA2B,aAAa,EAAE,MAAM,SAAS,CAAC;AAItE,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAM3D,KAAK,sBAAsB,GAAG;IAC5B,QAAQ,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IACpC,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IAC/B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,WAAW,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAClC,MAAM,EAAE,aAAa,CAAC;IACtB,cAAc,EAAE,uBAAuB,EAAE,CAAC;IAC1C,cAAc,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACzC,UAAU,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IACjC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9B,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9B,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAKF;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,aAAa,CAAC,UAAU,CAAC,GAClC,OAAO,CAKT;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,aAAa,CAAC,UAAU,CAAC,GAClC,OAAO,CAKT;AAsBD;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,aAAa,CAAC,UAAU,CAAC,GAClC,MAAM,GAAG,SAAS,CAmBpB;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,aAAa,CAAC,UAAU,CAAC,GAClC,MAAM,GAAG,SAAS,CAmBpB;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,QAAQ,aAAa,YAGlC,CAAC;AAExB;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,GAAG,OAAO,CAIvE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,OAAO,EACP,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,MAAM,EACN,cAAc,EACd,cAAc,EACd,UAAU,EACV,KAAK,EACL,KAAK,EACL,WAAW,GACZ,EAAE,sBAAsB,GAAG,aAAa,CA6DxC"}
|
|
@@ -23,6 +23,30 @@ import { type EchartsSeries, type HexColor, type NeedleSeries } from './chart-ty
|
|
|
23
23
|
export declare const mergeSeries: (series: NeedleSeries, theme?: "light" | "dark", userOption?: Omit<EChartsOption, "series" | "dataset" | "legend" | "xAxis" | "yAxis">, palette?: HexColor[]) => EchartsSeries;
|
|
24
24
|
export declare const mergeXAxis: (xAxis: EChartsOption["xAxis"], theme?: "light" | "dark") => EChartsOption["xAxis"];
|
|
25
25
|
export declare const mergeYAxis: (yAxis: EChartsOption["yAxis"], theme?: "light" | "dark") => EChartsOption["yAxis"];
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
type SingleDataZoomOption = Exclude<NonNullable<EChartsOption['dataZoom']>, unknown[]>;
|
|
27
|
+
type MergeDataZoomAxes = {
|
|
28
|
+
xAxis?: EChartsOption['xAxis'];
|
|
29
|
+
yAxis?: EChartsOption['yAxis'];
|
|
30
|
+
};
|
|
31
|
+
export type DataZoomTargetAxes = {
|
|
32
|
+
xAxisIndices: number[];
|
|
33
|
+
yAxisIndices: number[];
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Union of the axis indices targeted by all slider/inside entries in a
|
|
37
|
+
* dataZoom config, using the same per-entry resolution as ECharts (explicit
|
|
38
|
+
* axis indices first, then orientation).
|
|
39
|
+
*/
|
|
40
|
+
export declare const getDataZoomTargetAxes: (dataZoom: EChartsOption["dataZoom"]) => DataZoomTargetAxes;
|
|
41
|
+
/**
|
|
42
|
+
* A slider is vertical when the consumer sets `orient: 'vertical'`, or when it
|
|
43
|
+
* only targets a y-axis, which makes ECharts infer the vertical orientation.
|
|
44
|
+
*/
|
|
45
|
+
export declare const isVerticalSlider: (dataZoom: SingleDataZoomOption | undefined) => boolean;
|
|
46
|
+
export declare const mergeDataZoom: (dataZoom: EChartsOption["dataZoom"], axes?: MergeDataZoomAxes) => EChartsOption["dataZoom"];
|
|
47
|
+
type MergeToolboxContext = MergeDataZoomAxes & {
|
|
48
|
+
dataZoom?: EChartsOption['dataZoom'];
|
|
49
|
+
};
|
|
50
|
+
export declare const mergeToolbox: (toolbox: EChartsOption["toolbox"], context?: MergeToolboxContext) => EChartsOption["toolbox"];
|
|
51
|
+
export {};
|
|
28
52
|
//# sourceMappingURL=user-option-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-option-utils.d.ts","sourceRoot":"","sources":["../../../../src/charts/utils/user-option-utils.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,KAAK,aAAa,EAAqB,MAAM,SAAS,CAAC;AAKhE,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,YAAY,EAElB,MAAM,eAAe,CAAC;AAevB,eAAO,MAAM,WAAW,GACtB,QAAQ,YAAY,EACpB,QAAO,OAAO,GAAG,MAAgB,EACjC,aAAa,IAAI,CACf,aAAa,EACb,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,CACpD,EACD,UAAU,QAAQ,EAAE,KACnB,aAkOF,CAAC;AAEF,eAAO,MAAM,UAAU,GACrB,OAAO,aAAa,CAAC,OAAO,CAAC,EAC7B,QAAO,OAAO,GAAG,MAAgB,KAChC,aAAa,CAAC,OAAO,CAyFvB,CAAC;AAEF,eAAO,MAAM,UAAU,GACrB,OAAO,aAAa,CAAC,OAAO,CAAC,EAC7B,QAAO,OAAO,GAAG,MAAgB,KAChC,aAAa,CAAC,OAAO,CAgFvB,CAAC;AAEF,eAAO,MAAM,aAAa,GACxB,UAAU,aAAa,CAAC,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"user-option-utils.d.ts","sourceRoot":"","sources":["../../../../src/charts/utils/user-option-utils.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,KAAK,aAAa,EAAqB,MAAM,SAAS,CAAC;AAKhE,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,YAAY,EAElB,MAAM,eAAe,CAAC;AAevB,eAAO,MAAM,WAAW,GACtB,QAAQ,YAAY,EACpB,QAAO,OAAO,GAAG,MAAgB,EACjC,aAAa,IAAI,CACf,aAAa,EACb,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,CACpD,EACD,UAAU,QAAQ,EAAE,KACnB,aAkOF,CAAC;AAEF,eAAO,MAAM,UAAU,GACrB,OAAO,aAAa,CAAC,OAAO,CAAC,EAC7B,QAAO,OAAO,GAAG,MAAgB,KAChC,aAAa,CAAC,OAAO,CAyFvB,CAAC;AAEF,eAAO,MAAM,UAAU,GACrB,OAAO,aAAa,CAAC,OAAO,CAAC,EAC7B,QAAO,OAAO,GAAG,MAAgB,KAChC,aAAa,CAAC,OAAO,CAgFvB,CAAC;AAEF,KAAK,oBAAoB,GAAG,OAAO,CACjC,WAAW,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,EACtC,OAAO,EAAE,CACV,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,KAAK,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AA4CF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAChC,UAAU,aAAa,CAAC,UAAU,CAAC,KAClC,kBAqBF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAC3B,UAAU,oBAAoB,GAAG,SAAS,KACzC,OAYF,CAAC;AAyDF,eAAO,MAAM,aAAa,GACxB,UAAU,aAAa,CAAC,UAAU,CAAC,EACnC,OAAO,iBAAiB,KACvB,aAAa,CAAC,UAAU,CAwC1B,CAAC;AAEF,KAAK,mBAAmB,GAAG,iBAAiB,GAAG;IAC7C,QAAQ,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;CACtC,CAAC;AAwDF,eAAO,MAAM,YAAY,GACvB,SAAS,aAAa,CAAC,SAAS,CAAC,EACjC,UAAU,mBAAmB,KAC5B,aAAa,CAAC,SAAS,CAyCzB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neo4j-ndl/react-charts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"description": "React implementation of charts from Neo4j Design System",
|
|
6
6
|
"keywords": [
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"react": ">=19.0.0",
|
|
58
58
|
"react-dom": ">=19.0.0",
|
|
59
|
-
"@neo4j-ndl/
|
|
60
|
-
"@neo4j-ndl/
|
|
59
|
+
"@neo4j-ndl/react": "^4.21.1",
|
|
60
|
+
"@neo4j-ndl/base": "^4.20.1"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"classnames": "2.5.1",
|
|
@@ -87,4 +87,4 @@ Import from `@neo4j-ndl/react-charts`.
|
|
|
87
87
|
|
|
88
88
|
| Component | Docs | Accessibility | Examples |
|
|
89
89
|
|-----------|------|---------------|----------|
|
|
90
|
-
| `Chart` | [components/charts.md](components/charts.md) | |
|
|
90
|
+
| `Chart` | [components/charts.md](components/charts.md) | | 23 |
|
|
@@ -21,6 +21,25 @@ Import: `import { Chart } from '@neo4j-ndl/react-charts'`
|
|
|
21
21
|
| `xAxis` | `XAXisOption \| XAXisOption[]` | | | X-axis configuration for the chart. |
|
|
22
22
|
| `yAxis` | `YAXisOption \| YAXisOption[]` | | | Y-axis configuration for the chart. |
|
|
23
23
|
|
|
24
|
+
**Data zoom sliders.** A `dataZoom` slider passed through `option` targets
|
|
25
|
+
the x-axis unless it is bound to an axis explicitly, so on a horizontal bar
|
|
26
|
+
chart it zooms the value axis rather than the categories. Bind the slider to
|
|
27
|
+
the category axis with `yAxisIndex: [0]` (or set `orient: 'vertical'`) to
|
|
28
|
+
page through the bars instead; Needle then lays the slider out vertically on
|
|
29
|
+
the right of the chart and reserves grid space for it. Sliders that target a
|
|
30
|
+
continuous (`value`, `time`, or `log`) axis default to `filterMode: 'none'`
|
|
31
|
+
so out-of-window data is clipped rather than removed, while category-axis
|
|
32
|
+
sliders keep ECharts' `'filter'` default so the opposite value axis rescales
|
|
33
|
+
to the visible data.
|
|
34
|
+
|
|
35
|
+
**Drag-to-zoom.** Dragging in the plot area zooms the axes your `dataZoom`
|
|
36
|
+
config targets: entries bound to a y-axis (`yAxisIndex` or
|
|
37
|
+
`orient: 'vertical'`) make the drag select a y band, entries on both axes
|
|
38
|
+
make it select a rectangle, and without any `dataZoom` config the drag zooms
|
|
39
|
+
the x-axis. Set `toolbox.feature.dataZoom` through `option` to override the
|
|
40
|
+
derived axes explicitly. When every drag-targeted axis is continuous the
|
|
41
|
+
drag defaults to `filterMode: 'none'`, matching the slider rule above.
|
|
42
|
+
|
|
24
43
|
### ChartEmpty
|
|
25
44
|
|
|
26
45
|
| Prop | Type | Required | Default | Description |
|
|
@@ -1984,6 +2003,182 @@ const Component = () => {
|
|
|
1984
2003
|
export default Component;
|
|
1985
2004
|
```
|
|
1986
2005
|
|
|
2006
|
+
### Slider Vertical
|
|
2007
|
+
|
|
2008
|
+
```tsx
|
|
2009
|
+
import { Chart } from '@neo4j-ndl/react-charts';
|
|
2010
|
+
|
|
2011
|
+
const Component = () => {
|
|
2012
|
+
return (
|
|
2013
|
+
// The Chart component requires its parent to have an explicit height.
|
|
2014
|
+
// Without one the chart canvas collapses to 0px and nothing renders.
|
|
2015
|
+
// You can also check the components documentation by hovering over it.
|
|
2016
|
+
<div
|
|
2017
|
+
style={{
|
|
2018
|
+
border: '1px solid silver',
|
|
2019
|
+
borderRadius: '10px',
|
|
2020
|
+
height: '350px',
|
|
2021
|
+
padding: '20px',
|
|
2022
|
+
width: '100%',
|
|
2023
|
+
}}
|
|
2024
|
+
>
|
|
2025
|
+
<Chart
|
|
2026
|
+
legend={{
|
|
2027
|
+
show: true,
|
|
2028
|
+
}}
|
|
2029
|
+
dataset={{
|
|
2030
|
+
dimensions: ['language', 'Repositories'],
|
|
2031
|
+
source: [
|
|
2032
|
+
['TypeScript', 124],
|
|
2033
|
+
['Python', 98],
|
|
2034
|
+
['Java', 87],
|
|
2035
|
+
['Go', 65],
|
|
2036
|
+
['Rust', 52],
|
|
2037
|
+
['Kotlin', 43],
|
|
2038
|
+
['Ruby', 31],
|
|
2039
|
+
['Swift', 27],
|
|
2040
|
+
['Elixir', 14],
|
|
2041
|
+
['Haskell', 8],
|
|
2042
|
+
],
|
|
2043
|
+
}}
|
|
2044
|
+
xAxis={{
|
|
2045
|
+
type: 'value',
|
|
2046
|
+
}}
|
|
2047
|
+
yAxis={{
|
|
2048
|
+
axisTick: {
|
|
2049
|
+
alignWithLabel: true,
|
|
2050
|
+
},
|
|
2051
|
+
type: 'category',
|
|
2052
|
+
}}
|
|
2053
|
+
series={[
|
|
2054
|
+
{
|
|
2055
|
+
encode: {
|
|
2056
|
+
x: 'Repositories',
|
|
2057
|
+
y: 'language',
|
|
2058
|
+
},
|
|
2059
|
+
name: 'Repositories',
|
|
2060
|
+
type: 'bar',
|
|
2061
|
+
},
|
|
2062
|
+
]}
|
|
2063
|
+
option={{
|
|
2064
|
+
// A slider bound only to the category y-axis renders vertically on
|
|
2065
|
+
// the right and pages through the bars. Sliders without an axis
|
|
2066
|
+
// binding target the x-axis, which is the value axis in a
|
|
2067
|
+
// horizontal bar chart.
|
|
2068
|
+
dataZoom: [
|
|
2069
|
+
{
|
|
2070
|
+
type: 'slider',
|
|
2071
|
+
yAxisIndex: [0],
|
|
2072
|
+
},
|
|
2073
|
+
// The inside zoom lets users pinch-zoom and drag-pan the visible
|
|
2074
|
+
// category window directly in the plot area.
|
|
2075
|
+
{
|
|
2076
|
+
type: 'inside',
|
|
2077
|
+
yAxisIndex: [0],
|
|
2078
|
+
},
|
|
2079
|
+
],
|
|
2080
|
+
// Drag-to-zoom in the plot area follows the axes the dataZoom
|
|
2081
|
+
// config targets, so dragging zooms the category y-axis here — in
|
|
2082
|
+
// sync with the slider. Set `toolbox.feature.dataZoom` to override.
|
|
2083
|
+
}}
|
|
2084
|
+
/>
|
|
2085
|
+
</div>
|
|
2086
|
+
);
|
|
2087
|
+
};
|
|
2088
|
+
|
|
2089
|
+
export default Component;
|
|
2090
|
+
```
|
|
2091
|
+
|
|
2092
|
+
### Sliders Both Axes
|
|
2093
|
+
|
|
2094
|
+
```tsx
|
|
2095
|
+
import { Chart } from '@neo4j-ndl/react-charts';
|
|
2096
|
+
|
|
2097
|
+
const sampleData = [
|
|
2098
|
+
['time', 'response time', 'request volume'],
|
|
2099
|
+
...Array.from({ length: 180 }, (_, index) => {
|
|
2100
|
+
const responseTime =
|
|
2101
|
+
38 + Math.sin(index / 6) * 13 + Math.cos(index / 17) * 7;
|
|
2102
|
+
const requestVolume =
|
|
2103
|
+
48 + Math.cos(index / 8) * 18 + Math.sin(index / 23) * 9;
|
|
2104
|
+
|
|
2105
|
+
return [
|
|
2106
|
+
index,
|
|
2107
|
+
Number(responseTime.toFixed(2)),
|
|
2108
|
+
Number(requestVolume.toFixed(2)),
|
|
2109
|
+
];
|
|
2110
|
+
}),
|
|
2111
|
+
];
|
|
2112
|
+
|
|
2113
|
+
const Component = () => {
|
|
2114
|
+
return (
|
|
2115
|
+
// The Chart component requires its parent to have an explicit height.
|
|
2116
|
+
// Without one the chart canvas collapses to 0px and nothing renders.
|
|
2117
|
+
// You can also check the components documentation by hovering over it.
|
|
2118
|
+
<div
|
|
2119
|
+
style={{
|
|
2120
|
+
border: '1px solid silver',
|
|
2121
|
+
borderRadius: '10px',
|
|
2122
|
+
height: '350px',
|
|
2123
|
+
padding: '20px',
|
|
2124
|
+
width: '100%',
|
|
2125
|
+
}}
|
|
2126
|
+
>
|
|
2127
|
+
<Chart
|
|
2128
|
+
legend={{
|
|
2129
|
+
show: true,
|
|
2130
|
+
}}
|
|
2131
|
+
dataset={[
|
|
2132
|
+
{
|
|
2133
|
+
source: sampleData,
|
|
2134
|
+
},
|
|
2135
|
+
]}
|
|
2136
|
+
series={[
|
|
2137
|
+
{
|
|
2138
|
+
encode: { x: 'time', y: 'response time' },
|
|
2139
|
+
name: 'Response time',
|
|
2140
|
+
type: 'line',
|
|
2141
|
+
},
|
|
2142
|
+
{
|
|
2143
|
+
encode: { x: 'time', y: 'request volume' },
|
|
2144
|
+
name: 'Request volume',
|
|
2145
|
+
type: 'line',
|
|
2146
|
+
},
|
|
2147
|
+
]}
|
|
2148
|
+
xAxis={{
|
|
2149
|
+
name: 'Time',
|
|
2150
|
+
type: 'value',
|
|
2151
|
+
}}
|
|
2152
|
+
yAxis={{
|
|
2153
|
+
name: 'Value',
|
|
2154
|
+
type: 'value',
|
|
2155
|
+
}}
|
|
2156
|
+
option={{
|
|
2157
|
+
// A horizontal slider on the x-axis at the bottom and a vertical
|
|
2158
|
+
// one on the y-axis at the right. Grid space is reserved for both
|
|
2159
|
+
// automatically.
|
|
2160
|
+
dataZoom: [
|
|
2161
|
+
{
|
|
2162
|
+
type: 'slider',
|
|
2163
|
+
},
|
|
2164
|
+
{
|
|
2165
|
+
type: 'slider',
|
|
2166
|
+
yAxisIndex: [0],
|
|
2167
|
+
},
|
|
2168
|
+
],
|
|
2169
|
+
// Drag-to-zoom in the plot area follows the axes the dataZoom
|
|
2170
|
+
// config targets: with sliders on both axes the drag selects a
|
|
2171
|
+
// rectangle that zooms both, in sync with the sliders. Set
|
|
2172
|
+
// `toolbox.feature.dataZoom` to override.
|
|
2173
|
+
}}
|
|
2174
|
+
/>
|
|
2175
|
+
</div>
|
|
2176
|
+
);
|
|
2177
|
+
};
|
|
2178
|
+
|
|
2179
|
+
export default Component;
|
|
2180
|
+
```
|
|
2181
|
+
|
|
1987
2182
|
### Threshold Values
|
|
1988
2183
|
|
|
1989
2184
|
```tsx
|