@hitachivantara/uikit-react-viz 6.1.6 → 6.1.7

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.
@@ -1,118 +1,92 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
- import { LineChart } from "echarts/charts";
4
- import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent, DataZoomSliderComponent, DataZoomInsideComponent, MarkLineComponent } from "echarts/components";
5
- import * as echarts from "echarts/core";
6
- import { useData } from "../hooks/useData.js";
7
- import { useDataset } from "../hooks/useDataset.js";
8
- import { useYAxis } from "../hooks/useYAxis.js";
9
- import { useXAxis } from "../hooks/useXAxis.js";
1
+ import { HvBaseChart } from "../BaseChart/BaseChart.js";
10
2
  import { useDataZoom } from "../hooks/useDataZoom.js";
3
+ import { useXAxis } from "../hooks/useXAxis.js";
4
+ import { useYAxis } from "../hooks/useYAxis.js";
11
5
  import { useGrid } from "../hooks/useGrid.js";
6
+ import { useData } from "../hooks/useData.js";
7
+ import { useDataset } from "../hooks/useDataset.js";
12
8
  import { useSeries } from "../hooks/useSeries.js";
13
9
  import { useLegend } from "../hooks/useLegend.js";
14
10
  import { useTooltip } from "../hooks/tooltip/useTooltip.js";
15
11
  import { useOption } from "../hooks/useOption.js";
16
- import { HvBaseChart } from "../BaseChart/BaseChart.js";
12
+ import { forwardRef } from "react";
13
+ import { DataZoomInsideComponent, DataZoomSliderComponent, DatasetComponent, GridComponent, LegendComponent, MarkLineComponent, TooltipComponent } from "echarts/components";
14
+ import * as echarts from "echarts/core";
15
+ import { jsx } from "react/jsx-runtime";
16
+ import { LineChart } from "echarts/charts";
17
+ //#region src/LineChart/LineChart.tsx
17
18
  echarts.use([
18
- LineChart,
19
- DatasetComponent,
20
- GridComponent,
21
- TooltipComponent,
22
- LegendComponent,
23
- DataZoomSliderComponent,
24
- DataZoomInsideComponent,
25
- MarkLineComponent
19
+ LineChart,
20
+ DatasetComponent,
21
+ GridComponent,
22
+ TooltipComponent,
23
+ LegendComponent,
24
+ DataZoomSliderComponent,
25
+ DataZoomInsideComponent,
26
+ MarkLineComponent
26
27
  ]);
27
- const HvLineChart = forwardRef(
28
- function HvLineChart2(props, ref) {
29
- const {
30
- area = false,
31
- emptyCellMode = "void",
32
- areaOpacity = 0.5,
33
- yAxis,
34
- xAxis,
35
- horizontalRangeSlider,
36
- grid,
37
- data,
38
- groupBy,
39
- splitBy,
40
- sortBy,
41
- filters,
42
- measures,
43
- stack,
44
- seriesNameFormatter,
45
- legend,
46
- classes,
47
- tooltip,
48
- width,
49
- height,
50
- onOptionChange,
51
- ...others
52
- } = props;
53
- const { data: chartData, mapping: measuresMapping } = useData({
54
- data,
55
- groupBy,
56
- measures,
57
- splitBy,
58
- sortBy,
59
- filters
60
- });
61
- const chartDataset = useDataset(chartData);
62
- const chartYAxis = useYAxis({
63
- axes: Array.isArray(yAxis) || yAxis == null ? yAxis : [yAxis]
64
- });
65
- const chartXAxis = useXAxis({ ...xAxis, scale: true });
66
- const chartSlider = useDataZoom({
67
- showHorizontal: horizontalRangeSlider?.show
68
- });
69
- const chartGrid = useGrid({ ...grid });
70
- const chartSeries = useSeries({
71
- type: "line",
72
- data: chartData,
73
- groupBy,
74
- measuresMapping,
75
- area,
76
- areaOpacity,
77
- emptyCellMode,
78
- stack,
79
- nameFormatter: seriesNameFormatter
80
- });
81
- const chartLegend = useLegend({
82
- ...legend,
83
- series: chartSeries.series
84
- });
85
- const chartTooltip = useTooltip({
86
- ...tooltip,
87
- trigger: "axis",
88
- measuresMapping,
89
- classes
90
- });
91
- const option = useOption({
92
- option: {
93
- ...chartYAxis,
94
- ...chartXAxis,
95
- ...chartSlider,
96
- ...chartGrid,
97
- ...chartDataset,
98
- ...chartSeries,
99
- ...chartLegend,
100
- ...chartTooltip
101
- },
102
- onOptionChange
103
- });
104
- return /* @__PURE__ */ jsx(
105
- HvBaseChart,
106
- {
107
- ref,
108
- option,
109
- width,
110
- height,
111
- ...others
112
- }
113
- );
114
- }
115
- );
116
- export {
117
- HvLineChart
118
- };
28
+ /**
29
+ * A line chart or line plot or line graph is a type of chart which displays information as a series of data points
30
+ * connected by straight line segments.
31
+ */
32
+ var HvLineChart = forwardRef(function HvLineChart(props, ref) {
33
+ const { area = false, emptyCellMode = "void", areaOpacity = .5, yAxis, xAxis, horizontalRangeSlider, grid, data, groupBy, splitBy, sortBy, filters, measures, stack, seriesNameFormatter, legend, classes, tooltip, width, height, onOptionChange, ...others } = props;
34
+ const { data: chartData, mapping: measuresMapping } = useData({
35
+ data,
36
+ groupBy,
37
+ measures,
38
+ splitBy,
39
+ sortBy,
40
+ filters
41
+ });
42
+ const chartDataset = useDataset(chartData);
43
+ const chartYAxis = useYAxis({ axes: Array.isArray(yAxis) || yAxis == null ? yAxis : [yAxis] });
44
+ const chartXAxis = useXAxis({
45
+ ...xAxis,
46
+ scale: true
47
+ });
48
+ const chartSlider = useDataZoom({ showHorizontal: horizontalRangeSlider?.show });
49
+ const chartGrid = useGrid({ ...grid });
50
+ const chartSeries = useSeries({
51
+ type: "line",
52
+ data: chartData,
53
+ groupBy,
54
+ measuresMapping,
55
+ area,
56
+ areaOpacity,
57
+ emptyCellMode,
58
+ stack,
59
+ nameFormatter: seriesNameFormatter
60
+ });
61
+ const chartLegend = useLegend({
62
+ ...legend,
63
+ series: chartSeries.series
64
+ });
65
+ const chartTooltip = useTooltip({
66
+ ...tooltip,
67
+ trigger: "axis",
68
+ measuresMapping,
69
+ classes
70
+ });
71
+ return /* @__PURE__ */ jsx(HvBaseChart, {
72
+ ref,
73
+ option: useOption({
74
+ option: {
75
+ ...chartYAxis,
76
+ ...chartXAxis,
77
+ ...chartSlider,
78
+ ...chartGrid,
79
+ ...chartDataset,
80
+ ...chartSeries,
81
+ ...chartLegend,
82
+ ...chartTooltip
83
+ },
84
+ onOptionChange
85
+ }),
86
+ width,
87
+ height,
88
+ ...others
89
+ });
90
+ });
91
+ //#endregion
92
+ export { HvLineChart };
@@ -1,110 +1,88 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
- import { ScatterChart } from "echarts/charts";
4
- import { DatasetComponent, GridComponent, TooltipComponent, LegendComponent, DataZoomSliderComponent, DataZoomInsideComponent, MarkLineComponent } from "echarts/components";
5
- import * as echarts from "echarts/core";
6
- import { useData } from "../hooks/useData.js";
7
- import { useDataset } from "../hooks/useDataset.js";
8
- import { useYAxis } from "../hooks/useYAxis.js";
9
- import { useXAxis } from "../hooks/useXAxis.js";
1
+ import { HvBaseChart } from "../BaseChart/BaseChart.js";
10
2
  import { useDataZoom } from "../hooks/useDataZoom.js";
3
+ import { useXAxis } from "../hooks/useXAxis.js";
4
+ import { useYAxis } from "../hooks/useYAxis.js";
11
5
  import { useGrid } from "../hooks/useGrid.js";
6
+ import { useData } from "../hooks/useData.js";
7
+ import { useDataset } from "../hooks/useDataset.js";
12
8
  import { useSeries } from "../hooks/useSeries.js";
13
9
  import { useLegend } from "../hooks/useLegend.js";
14
10
  import { useTooltip } from "../hooks/tooltip/useTooltip.js";
15
11
  import { useOption } from "../hooks/useOption.js";
16
- import { HvBaseChart } from "../BaseChart/BaseChart.js";
12
+ import { forwardRef } from "react";
13
+ import { DataZoomInsideComponent, DataZoomSliderComponent, DatasetComponent, GridComponent, LegendComponent, MarkLineComponent, TooltipComponent } from "echarts/components";
14
+ import * as echarts from "echarts/core";
15
+ import { jsx } from "react/jsx-runtime";
16
+ import { ScatterChart } from "echarts/charts";
17
+ //#region src/ScatterPlot/ScatterPlot.tsx
17
18
  echarts.use([
18
- ScatterChart,
19
- DatasetComponent,
20
- GridComponent,
21
- TooltipComponent,
22
- LegendComponent,
23
- DataZoomSliderComponent,
24
- DataZoomInsideComponent,
25
- MarkLineComponent
19
+ ScatterChart,
20
+ DatasetComponent,
21
+ GridComponent,
22
+ TooltipComponent,
23
+ LegendComponent,
24
+ DataZoomSliderComponent,
25
+ DataZoomInsideComponent,
26
+ MarkLineComponent
26
27
  ]);
27
- const HvScatterPlot = forwardRef(
28
- function HvScatterPlot2(props, ref) {
29
- const {
30
- yAxis,
31
- xAxis,
32
- horizontalRangeSlider,
33
- grid,
34
- data,
35
- groupBy,
36
- splitBy,
37
- sortBy,
38
- filters,
39
- measures,
40
- seriesNameFormatter,
41
- legend,
42
- classes,
43
- tooltip,
44
- width,
45
- height,
46
- onOptionChange,
47
- ...others
48
- } = props;
49
- const { data: chartData, mapping: measuresMapping } = useData({
50
- data,
51
- groupBy,
52
- measures,
53
- splitBy,
54
- sortBy,
55
- filters
56
- });
57
- const chartDataset = useDataset(chartData);
58
- const chartYAxis = useYAxis({
59
- axes: Array.isArray(yAxis) || yAxis == null ? yAxis : [yAxis]
60
- });
61
- const chartXAxis = useXAxis({ type: "continuous", ...xAxis });
62
- const chartSlider = useDataZoom({
63
- showHorizontal: horizontalRangeSlider?.show
64
- });
65
- const chartGrid = useGrid({ ...grid });
66
- const chartSeries = useSeries({
67
- type: "scatter",
68
- data: chartData,
69
- groupBy,
70
- measuresMapping,
71
- nameFormatter: seriesNameFormatter
72
- });
73
- const chartLegend = useLegend({
74
- ...legend,
75
- series: chartSeries.series
76
- });
77
- const chartTooltip = useTooltip({
78
- ...tooltip,
79
- trigger: "axis",
80
- measuresMapping,
81
- classes
82
- });
83
- const option = useOption({
84
- option: {
85
- ...chartYAxis,
86
- ...chartXAxis,
87
- ...chartSlider,
88
- ...chartGrid,
89
- ...chartDataset,
90
- ...chartSeries,
91
- ...chartLegend,
92
- ...chartTooltip
93
- },
94
- onOptionChange
95
- });
96
- return /* @__PURE__ */ jsx(
97
- HvBaseChart,
98
- {
99
- ref,
100
- option,
101
- width,
102
- height,
103
- ...others
104
- }
105
- );
106
- }
107
- );
108
- export {
109
- HvScatterPlot
110
- };
28
+ /**
29
+ * A scatter plot is a type of chart which displays dots to represent two numeric variables.
30
+ * This type of chart is used to determine the relationship between two variables.
31
+ */
32
+ var HvScatterPlot = forwardRef(function HvScatterPlot(props, ref) {
33
+ const { yAxis, xAxis, horizontalRangeSlider, grid, data, groupBy, splitBy, sortBy, filters, measures, seriesNameFormatter, legend, classes, tooltip, width, height, onOptionChange, ...others } = props;
34
+ const { data: chartData, mapping: measuresMapping } = useData({
35
+ data,
36
+ groupBy,
37
+ measures,
38
+ splitBy,
39
+ sortBy,
40
+ filters
41
+ });
42
+ const chartDataset = useDataset(chartData);
43
+ const chartYAxis = useYAxis({ axes: Array.isArray(yAxis) || yAxis == null ? yAxis : [yAxis] });
44
+ const chartXAxis = useXAxis({
45
+ type: "continuous",
46
+ ...xAxis
47
+ });
48
+ const chartSlider = useDataZoom({ showHorizontal: horizontalRangeSlider?.show });
49
+ const chartGrid = useGrid({ ...grid });
50
+ const chartSeries = useSeries({
51
+ type: "scatter",
52
+ data: chartData,
53
+ groupBy,
54
+ measuresMapping,
55
+ nameFormatter: seriesNameFormatter
56
+ });
57
+ const chartLegend = useLegend({
58
+ ...legend,
59
+ series: chartSeries.series
60
+ });
61
+ const chartTooltip = useTooltip({
62
+ ...tooltip,
63
+ trigger: "axis",
64
+ measuresMapping,
65
+ classes
66
+ });
67
+ return /* @__PURE__ */ jsx(HvBaseChart, {
68
+ ref,
69
+ option: useOption({
70
+ option: {
71
+ ...chartYAxis,
72
+ ...chartXAxis,
73
+ ...chartSlider,
74
+ ...chartGrid,
75
+ ...chartDataset,
76
+ ...chartSeries,
77
+ ...chartLegend,
78
+ ...chartTooltip
79
+ },
80
+ onOptionChange
81
+ }),
82
+ width,
83
+ height,
84
+ ...others
85
+ });
86
+ });
87
+ //#endregion
88
+ export { HvScatterPlot };
@@ -1,54 +1,40 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ import { HvBaseChart } from "../BaseChart/BaseChart.js";
2
+ import { useTooltip } from "../hooks/tooltip/useTooltip.js";
3
+ import { useOption } from "../hooks/useOption.js";
2
4
  import { forwardRef } from "react";
3
- import { TreemapChart } from "echarts/charts";
4
5
  import { TooltipComponent } from "echarts/components";
5
6
  import * as echarts from "echarts/core";
6
- import { useTooltip } from "../hooks/tooltip/useTooltip.js";
7
- import { useOption } from "../hooks/useOption.js";
8
- import { HvBaseChart } from "../BaseChart/BaseChart.js";
7
+ import { jsx } from "react/jsx-runtime";
8
+ import { TreemapChart } from "echarts/charts";
9
+ //#region src/Treemap/Treemap.tsx
9
10
  echarts.use([TreemapChart, TooltipComponent]);
10
- const HvTreemapChart = forwardRef(
11
- function HvTreemapChart2(props, ref) {
12
- const {
13
- name,
14
- data,
15
- classes,
16
- width,
17
- height,
18
- tooltip,
19
- onOptionChange,
20
- ...others
21
- } = props;
22
- const chartTooltip = useTooltip({
23
- ...tooltip,
24
- type: "single",
25
- classes
26
- });
27
- const option = useOption({
28
- option: {
29
- series: [
30
- {
31
- name,
32
- type: "treemap",
33
- data
34
- }
35
- ],
36
- ...chartTooltip
37
- },
38
- onOptionChange
39
- });
40
- return /* @__PURE__ */ jsx(
41
- HvBaseChart,
42
- {
43
- ref,
44
- option,
45
- width,
46
- height,
47
- ...others
48
- }
49
- );
50
- }
51
- );
52
- export {
53
- HvTreemapChart
54
- };
11
+ /**
12
+ * A tree map chart visually represents hierarchical data using nested rectangles, with each rectangle's size proportional to the value it represents.
13
+ */
14
+ var HvTreemapChart = forwardRef(function HvTreemapChart(props, ref) {
15
+ const { name, data, classes, width, height, tooltip, onOptionChange, ...others } = props;
16
+ const chartTooltip = useTooltip({
17
+ ...tooltip,
18
+ type: "single",
19
+ classes
20
+ });
21
+ return /* @__PURE__ */ jsx(HvBaseChart, {
22
+ ref,
23
+ option: useOption({
24
+ option: {
25
+ series: [{
26
+ name,
27
+ type: "treemap",
28
+ data
29
+ }],
30
+ ...chartTooltip
31
+ },
32
+ onOptionChange
33
+ }),
34
+ width,
35
+ height,
36
+ ...others
37
+ });
38
+ });
39
+ //#endregion
40
+ export { HvTreemapChart };
@@ -1,80 +1,79 @@
1
1
  import { createClasses } from "@hitachivantara/uikit-react-utils";
2
2
  import { theme } from "@hitachivantara/uikit-styles";
3
- const { useClasses, staticClasses } = createClasses("HvChartTooltip", {
4
- /** Single tooltip styles */
5
- singleTooltipRoot: {
6
- width: "fit-content",
7
- boxShadow: theme.colors.shadow,
8
- backgroundColor: theme.colors.bgContainer,
9
- padding: theme.space.sm,
10
- display: "flex"
11
- },
12
- singleTooltipTitle: {
13
- fontFamily: theme.fontFamily.body,
14
- fontWeight: theme.fontWeights.semibold,
15
- fontSize: theme.fontSizes.sm,
16
- color: theme.colors.text
17
- },
18
- singleTooltipValue: {
19
- fontFamily: theme.fontFamily.body,
20
- fontWeight: theme.fontWeights.normal,
21
- fontSize: theme.fontSizes.sm,
22
- color: theme.colors.text,
23
- marginLeft: theme.space.xs
24
- },
25
- /** Multiple tooltip styles */
26
- multipleTooltipRoot: {
27
- width: "fit-content",
28
- boxShadow: theme.colors.shadow,
29
- backgroundColor: theme.colors.bgContainer
30
- },
31
- multipleTooltipTitleContainer: {
32
- padding: `15px ${theme.space.sm}`,
33
- borderBottom: `3px solid ${theme.colors.bgPage}`
34
- },
35
- multipleTooltipTitle: {
36
- fontFamily: theme.fontFamily.body,
37
- fontWeight: theme.fontWeights.semibold,
38
- fontSize: theme.fontSizes.sm,
39
- color: theme.colors.text
40
- },
41
- multipleTooltipValuesContainer: {
42
- display: "flex",
43
- flexDirection: "column",
44
- padding: theme.space.sm,
45
- "& > *:not(:last-child)": { paddingBottom: theme.space.sm }
46
- },
47
- multipleTooltipSeriesContainer: {
48
- display: "flex",
49
- flexDirection: "row",
50
- justifyContent: "space-between",
51
- alignItems: "center"
52
- },
53
- multipleTooltipSeriesNameContainer: {
54
- display: "flex",
55
- flexDirection: "row",
56
- alignItems: "center",
57
- marginRight: theme.space.sm
58
- },
59
- multipleTooltipSeriesColor: {
60
- width: "10px",
61
- height: "10px",
62
- marginRight: "5px"
63
- },
64
- multipleTooltipSeriesName: {
65
- fontFamily: theme.fontFamily.body,
66
- fontWeight: theme.fontWeights.semibold,
67
- fontSize: theme.fontSizes.sm,
68
- color: theme.colors.text
69
- },
70
- multipleTooltipSeriesValue: {
71
- fontFamily: theme.fontFamily.body,
72
- fontWeight: theme.fontWeights.normal,
73
- fontSize: theme.fontSizes.sm,
74
- color: theme.colors.text
75
- }
3
+ //#region src/hooks/tooltip/styles.tsx
4
+ var { useClasses, staticClasses } = createClasses("HvChartTooltip", {
5
+ /** Single tooltip styles */
6
+ singleTooltipRoot: {
7
+ width: "fit-content",
8
+ boxShadow: theme.colors.shadow,
9
+ backgroundColor: theme.colors.bgContainer,
10
+ padding: theme.space.sm,
11
+ display: "flex"
12
+ },
13
+ singleTooltipTitle: {
14
+ fontFamily: theme.fontFamily.body,
15
+ fontWeight: theme.fontWeights.semibold,
16
+ fontSize: theme.fontSizes.sm,
17
+ color: theme.colors.text
18
+ },
19
+ singleTooltipValue: {
20
+ fontFamily: theme.fontFamily.body,
21
+ fontWeight: theme.fontWeights.normal,
22
+ fontSize: theme.fontSizes.sm,
23
+ color: theme.colors.text,
24
+ marginLeft: theme.space.xs
25
+ },
26
+ /** Multiple tooltip styles */
27
+ multipleTooltipRoot: {
28
+ width: "fit-content",
29
+ boxShadow: theme.colors.shadow,
30
+ backgroundColor: theme.colors.bgContainer
31
+ },
32
+ multipleTooltipTitleContainer: {
33
+ padding: `15px ${theme.space.sm}`,
34
+ borderBottom: `3px solid ${theme.colors.bgPage}`
35
+ },
36
+ multipleTooltipTitle: {
37
+ fontFamily: theme.fontFamily.body,
38
+ fontWeight: theme.fontWeights.semibold,
39
+ fontSize: theme.fontSizes.sm,
40
+ color: theme.colors.text
41
+ },
42
+ multipleTooltipValuesContainer: {
43
+ display: "flex",
44
+ flexDirection: "column",
45
+ padding: theme.space.sm,
46
+ "& > *:not(:last-child)": { paddingBottom: theme.space.sm }
47
+ },
48
+ multipleTooltipSeriesContainer: {
49
+ display: "flex",
50
+ flexDirection: "row",
51
+ justifyContent: "space-between",
52
+ alignItems: "center"
53
+ },
54
+ multipleTooltipSeriesNameContainer: {
55
+ display: "flex",
56
+ flexDirection: "row",
57
+ alignItems: "center",
58
+ marginRight: theme.space.sm
59
+ },
60
+ multipleTooltipSeriesColor: {
61
+ width: "10px",
62
+ height: "10px",
63
+ marginRight: "5px"
64
+ },
65
+ multipleTooltipSeriesName: {
66
+ fontFamily: theme.fontFamily.body,
67
+ fontWeight: theme.fontWeights.semibold,
68
+ fontSize: theme.fontSizes.sm,
69
+ color: theme.colors.text
70
+ },
71
+ multipleTooltipSeriesValue: {
72
+ fontFamily: theme.fontFamily.body,
73
+ fontWeight: theme.fontWeights.normal,
74
+ fontSize: theme.fontSizes.sm,
75
+ color: theme.colors.text
76
+ }
76
77
  });
77
- export {
78
- staticClasses,
79
- useClasses
80
- };
78
+ //#endregion
79
+ export { useClasses };