@hitachivantara/uikit-react-viz 5.6.26 → 5.6.28
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/dist/cjs/components/BarChart/BarChart.cjs +82 -80
- package/dist/cjs/components/BarChart/BarChart.cjs.map +1 -1
- package/dist/cjs/components/BaseChart/BaseChart.cjs +42 -36
- package/dist/cjs/components/BaseChart/BaseChart.cjs.map +1 -1
- package/dist/cjs/components/ConfusionMatrix/ConfusionMatrix.cjs +28 -17
- package/dist/cjs/components/ConfusionMatrix/ConfusionMatrix.cjs.map +1 -1
- package/dist/cjs/components/ConfusionMatrix/ConfusionMatrix.styles.cjs +22 -22
- package/dist/cjs/components/ConfusionMatrix/ConfusionMatrix.styles.cjs.map +1 -1
- package/dist/cjs/components/ConfusionMatrix/utils.cjs +32 -23
- package/dist/cjs/components/ConfusionMatrix/utils.cjs.map +1 -1
- package/dist/cjs/components/DonutChart/DonutChart.cjs +60 -59
- package/dist/cjs/components/DonutChart/DonutChart.cjs.map +1 -1
- package/dist/cjs/components/LineChart/LineChart.cjs +80 -81
- package/dist/cjs/components/LineChart/LineChart.cjs.map +1 -1
- package/dist/cjs/hooks/tooltip/styles.cjs +2 -7
- package/dist/cjs/hooks/tooltip/styles.cjs.map +1 -1
- package/dist/cjs/hooks/tooltip/useTooltip.cjs +55 -37
- package/dist/cjs/hooks/tooltip/useTooltip.cjs.map +1 -1
- package/dist/cjs/hooks/useData.cjs +24 -22
- package/dist/cjs/hooks/useData.cjs.map +1 -1
- package/dist/cjs/hooks/useDataZoom.cjs +15 -14
- package/dist/cjs/hooks/useDataZoom.cjs.map +1 -1
- package/dist/cjs/hooks/useDataset.cjs +7 -4
- package/dist/cjs/hooks/useDataset.cjs.map +1 -1
- package/dist/cjs/hooks/useGrid.cjs.map +1 -1
- package/dist/cjs/hooks/useLegend.cjs +5 -7
- package/dist/cjs/hooks/useLegend.cjs.map +1 -1
- package/dist/cjs/hooks/useOption.cjs +1 -4
- package/dist/cjs/hooks/useOption.cjs.map +1 -1
- package/dist/cjs/hooks/useSeries.cjs +14 -4
- package/dist/cjs/hooks/useSeries.cjs.map +1 -1
- package/dist/cjs/hooks/useVisualMap.cjs +11 -1
- package/dist/cjs/hooks/useVisualMap.cjs.map +1 -1
- package/dist/cjs/hooks/useVizTheme.cjs.map +1 -1
- package/dist/cjs/hooks/useXAxis.cjs +17 -10
- package/dist/cjs/hooks/useXAxis.cjs.map +1 -1
- package/dist/cjs/hooks/useYAxis.cjs +41 -44
- package/dist/cjs/hooks/useYAxis.cjs.map +1 -1
- package/dist/cjs/providers/Provider.cjs +3 -11
- package/dist/cjs/providers/Provider.cjs.map +1 -1
- package/dist/cjs/utils/getAgFunc.cjs.map +1 -1
- package/dist/cjs/utils/getAxisType.cjs.map +1 -1
- package/dist/cjs/utils/getGroupKey.cjs.map +1 -1
- package/dist/cjs/utils/getLegendIcon.cjs.map +1 -1
- package/dist/cjs/utils/getMeasure.cjs.map +1 -1
- package/dist/cjs/utils/registerTheme.cjs +15 -4
- package/dist/cjs/utils/registerTheme.cjs.map +1 -1
- package/dist/esm/components/BarChart/BarChart.js +82 -80
- package/dist/esm/components/BarChart/BarChart.js.map +1 -1
- package/dist/esm/components/BaseChart/BaseChart.js +42 -36
- package/dist/esm/components/BaseChart/BaseChart.js.map +1 -1
- package/dist/esm/components/ConfusionMatrix/ConfusionMatrix.js +28 -17
- package/dist/esm/components/ConfusionMatrix/ConfusionMatrix.js.map +1 -1
- package/dist/esm/components/ConfusionMatrix/ConfusionMatrix.styles.js +22 -22
- package/dist/esm/components/ConfusionMatrix/ConfusionMatrix.styles.js.map +1 -1
- package/dist/esm/components/ConfusionMatrix/utils.js +32 -23
- package/dist/esm/components/ConfusionMatrix/utils.js.map +1 -1
- package/dist/esm/components/DonutChart/DonutChart.js +60 -59
- package/dist/esm/components/DonutChart/DonutChart.js.map +1 -1
- package/dist/esm/components/LineChart/LineChart.js +80 -81
- package/dist/esm/components/LineChart/LineChart.js.map +1 -1
- package/dist/esm/hooks/tooltip/styles.js +2 -7
- package/dist/esm/hooks/tooltip/styles.js.map +1 -1
- package/dist/esm/hooks/tooltip/useTooltip.js +55 -37
- package/dist/esm/hooks/tooltip/useTooltip.js.map +1 -1
- package/dist/esm/hooks/useData.js +24 -22
- package/dist/esm/hooks/useData.js.map +1 -1
- package/dist/esm/hooks/useDataZoom.js +15 -14
- package/dist/esm/hooks/useDataZoom.js.map +1 -1
- package/dist/esm/hooks/useDataset.js +7 -4
- package/dist/esm/hooks/useDataset.js.map +1 -1
- package/dist/esm/hooks/useGrid.js.map +1 -1
- package/dist/esm/hooks/useLegend.js +5 -7
- package/dist/esm/hooks/useLegend.js.map +1 -1
- package/dist/esm/hooks/useOption.js +1 -4
- package/dist/esm/hooks/useOption.js.map +1 -1
- package/dist/esm/hooks/useSeries.js +14 -4
- package/dist/esm/hooks/useSeries.js.map +1 -1
- package/dist/esm/hooks/useVisualMap.js +11 -1
- package/dist/esm/hooks/useVisualMap.js.map +1 -1
- package/dist/esm/hooks/useVizTheme.js.map +1 -1
- package/dist/esm/hooks/useXAxis.js +17 -10
- package/dist/esm/hooks/useXAxis.js.map +1 -1
- package/dist/esm/hooks/useYAxis.js +41 -44
- package/dist/esm/hooks/useYAxis.js.map +1 -1
- package/dist/esm/providers/Provider.js +3 -11
- package/dist/esm/providers/Provider.js.map +1 -1
- package/dist/esm/utils/getAgFunc.js.map +1 -1
- package/dist/esm/utils/getAxisType.js.map +1 -1
- package/dist/esm/utils/getGroupKey.js.map +1 -1
- package/dist/esm/utils/getLegendIcon.js.map +1 -1
- package/dist/esm/utils/getMeasure.js.map +1 -1
- package/dist/esm/utils/registerTheme.js +15 -4
- package/dist/esm/utils/registerTheme.js.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDataZoom.js","sources":["../../../src/hooks/useDataZoom.tsx"],"sourcesContent":["import { useMemo } from \"react\";\n\nimport { HvEChartsOption } from \"@viz/types/common\";\n\ninterface HvDataZoomHookProps {\n showHorizontal?: boolean;\n}\n\nexport const useDataZoom = ({ showHorizontal }: HvDataZoomHookProps) => {\n const option = useMemo<Pick<HvEChartsOption, \"dataZoom\">>(() => {\n return {\n dataZoom: [\n {\n show: showHorizontal ?? false,\n type: \"slider\",\n orient: \"horizontal\",\n },\n {\n show: showHorizontal ?? false,\n type: \"inside\",\n orient: \"horizontal\",\n zoomOnMouseWheel: \"shift\",\n moveOnMouseWheel: true,\n },\n ],\n };\n }, [showHorizontal]);\n\n return option;\n};\n"],"names":[
|
|
1
|
+
{"version":3,"file":"useDataZoom.js","sources":["../../../src/hooks/useDataZoom.tsx"],"sourcesContent":["import { useMemo } from \"react\";\n\nimport { HvEChartsOption } from \"@viz/types/common\";\n\ninterface HvDataZoomHookProps {\n showHorizontal?: boolean;\n}\n\nexport const useDataZoom = ({ showHorizontal }: HvDataZoomHookProps) => {\n const option = useMemo<Pick<HvEChartsOption, \"dataZoom\">>(() => {\n return {\n dataZoom: [\n {\n show: showHorizontal ?? false,\n type: \"slider\",\n orient: \"horizontal\",\n },\n {\n show: showHorizontal ?? false,\n type: \"inside\",\n orient: \"horizontal\",\n zoomOnMouseWheel: \"shift\",\n moveOnMouseWheel: true,\n },\n ],\n };\n }, [showHorizontal]);\n\n return option;\n};\n"],"names":[],"mappings":";AAQO,MAAM,cAAc,CAAC,EAAE,qBAA0C;AAChE,QAAA,SAAS,QAA2C,MAAM;AACvD,WAAA;AAAA,MACL,UAAU;AAAA,QACR;AAAA,UACE,MAAM,kBAAkB;AAAA,UACxB,MAAM;AAAA,UACN,QAAQ;AAAA,QACV;AAAA,QACA;AAAA,UACE,MAAM,kBAAkB;AAAA,UACxB,MAAM;AAAA,UACN,QAAQ;AAAA,UACR,kBAAkB;AAAA,UAClB,kBAAkB;AAAA,QACpB;AAAA,MACF;AAAA,IAAA;AAAA,EACF,GACC,CAAC,cAAc,CAAC;AAEZ,SAAA;AACT;"}
|
|
@@ -3,10 +3,13 @@ const useDataset = (data) => {
|
|
|
3
3
|
const option = useMemo(() => {
|
|
4
4
|
return {
|
|
5
5
|
dataset: {
|
|
6
|
-
source: data.columnNames().reduce(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
source: data.columnNames().reduce(
|
|
7
|
+
(acc, c) => ({
|
|
8
|
+
...acc,
|
|
9
|
+
[c]: data.array(c)
|
|
10
|
+
}),
|
|
11
|
+
{}
|
|
12
|
+
)
|
|
10
13
|
}
|
|
11
14
|
};
|
|
12
15
|
}, [data]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDataset.js","sources":["../../../src/hooks/useDataset.tsx"],"sourcesContent":["import { useMemo } from \"react\";\n\nimport { internal } from \"arquero\";\n\nimport { HvEChartsOption } from \"@viz/types/common\";\n\nexport const useDataset = (data: internal.ColumnTable) => {\n const option = useMemo<Pick<HvEChartsOption, \"dataset\">>(() => {\n return {\n dataset: {\n source: data.columnNames().reduce(\n (acc, c) => ({\n ...acc,\n [c]: data.array(c),\n }),\n {}\n ),\n },\n };\n }, [data]);\n\n return option;\n};\n"],"names":[
|
|
1
|
+
{"version":3,"file":"useDataset.js","sources":["../../../src/hooks/useDataset.tsx"],"sourcesContent":["import { useMemo } from \"react\";\n\nimport { internal } from \"arquero\";\n\nimport { HvEChartsOption } from \"@viz/types/common\";\n\nexport const useDataset = (data: internal.ColumnTable) => {\n const option = useMemo<Pick<HvEChartsOption, \"dataset\">>(() => {\n return {\n dataset: {\n source: data.columnNames().reduce(\n (acc, c) => ({\n ...acc,\n [c]: data.array(c),\n }),\n {}\n ),\n },\n };\n }, [data]);\n\n return option;\n};\n"],"names":[],"mappings":";AAMa,MAAA,aAAa,CAAC,SAA+B;AAClD,QAAA,SAAS,QAA0C,MAAM;AACtD,WAAA;AAAA,MACL,SAAS;AAAA,QACP,QAAQ,KAAK,YAAA,EAAc;AAAA,UACzB,CAAC,KAAK,OAAO;AAAA,YACX,GAAG;AAAA,YACH,CAAC,CAAC,GAAG,KAAK,MAAM,CAAC;AAAA,UAAA;AAAA,UAEnB,CAAC;AAAA,QACH;AAAA,MACF;AAAA,IAAA;AAAA,EACF,GACC,CAAC,IAAI,CAAC;AAEF,SAAA;AACT;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGrid.js","sources":["../../../src/hooks/useGrid.tsx"],"sourcesContent":["import { useMemo } from \"react\";\n\nimport { HvChartGrid } from \"@viz/types\";\nimport { HvEChartsOption } from \"@viz/types/common\";\n\ninterface HvGridHookProps {\n top?: HvChartGrid[\"top\"];\n bottom?: HvChartGrid[\"bottom\"];\n left?: HvChartGrid[\"left\"];\n right?: HvChartGrid[\"right\"];\n width?: number | string;\n height?: number | string;\n}\n\nexport const useGrid = ({\n top,\n left,\n right,\n bottom,\n width,\n height,\n}: HvGridHookProps) => {\n const option = useMemo<Pick<HvEChartsOption, \"grid\">>(() => {\n return {\n // if no value is defined we shouldn't pass anything because echarts doesn't behave well otherwise\n grid: {\n ...(top != null && {\n top,\n }),\n ...(bottom != null && {\n bottom,\n }),\n ...(left != null && {\n left,\n }),\n ...(right != null && {\n right,\n }),\n ...(width != null && {\n width,\n }),\n ...(height != null && {\n height,\n }),\n },\n };\n }, [top, left, right, bottom, height, width]);\n\n return option;\n};\n"],"names":[
|
|
1
|
+
{"version":3,"file":"useGrid.js","sources":["../../../src/hooks/useGrid.tsx"],"sourcesContent":["import { useMemo } from \"react\";\n\nimport { HvChartGrid } from \"@viz/types\";\nimport { HvEChartsOption } from \"@viz/types/common\";\n\ninterface HvGridHookProps {\n top?: HvChartGrid[\"top\"];\n bottom?: HvChartGrid[\"bottom\"];\n left?: HvChartGrid[\"left\"];\n right?: HvChartGrid[\"right\"];\n width?: number | string;\n height?: number | string;\n}\n\nexport const useGrid = ({\n top,\n left,\n right,\n bottom,\n width,\n height,\n}: HvGridHookProps) => {\n const option = useMemo<Pick<HvEChartsOption, \"grid\">>(() => {\n return {\n // if no value is defined we shouldn't pass anything because echarts doesn't behave well otherwise\n grid: {\n ...(top != null && {\n top,\n }),\n ...(bottom != null && {\n bottom,\n }),\n ...(left != null && {\n left,\n }),\n ...(right != null && {\n right,\n }),\n ...(width != null && {\n width,\n }),\n ...(height != null && {\n height,\n }),\n },\n };\n }, [top, left, right, bottom, height, width]);\n\n return option;\n};\n"],"names":[],"mappings":";AAcO,MAAM,UAAU,CAAC;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAuB;AACf,QAAA,SAAS,QAAuC,MAAM;AACnD,WAAA;AAAA;AAAA,MAEL,MAAM;AAAA,QACJ,GAAI,OAAO,QAAQ;AAAA,UACjB;AAAA,QACF;AAAA,QACA,GAAI,UAAU,QAAQ;AAAA,UACpB;AAAA,QACF;AAAA,QACA,GAAI,QAAQ,QAAQ;AAAA,UAClB;AAAA,QACF;AAAA,QACA,GAAI,SAAS,QAAQ;AAAA,UACnB;AAAA,QACF;AAAA,QACA,GAAI,SAAS,QAAQ;AAAA,UACnB;AAAA,QACF;AAAA,QACA,GAAI,UAAU,QAAQ;AAAA,UACpB;AAAA,QACF;AAAA,MACF;AAAA,IAAA;AAAA,EACF,GACC,CAAC,KAAK,MAAM,OAAO,QAAQ,QAAQ,KAAK,CAAC;AAErC,SAAA;AACT;"}
|
|
@@ -9,9 +9,7 @@ const useLegend = ({
|
|
|
9
9
|
direction = "horizontal"
|
|
10
10
|
}) => {
|
|
11
11
|
const option = useMemo(() => {
|
|
12
|
-
const position = {
|
|
13
|
-
y: positionProp?.y ?? "top"
|
|
14
|
-
};
|
|
12
|
+
const position = { y: positionProp?.y ?? "top" };
|
|
15
13
|
if (positionProp?.x != null && positionProp?.x !== "center") {
|
|
16
14
|
position[positionProp.x] = positionProp.x;
|
|
17
15
|
} else {
|
|
@@ -24,14 +22,14 @@ const useLegend = ({
|
|
|
24
22
|
formatter,
|
|
25
23
|
orient: direction,
|
|
26
24
|
...position,
|
|
27
|
-
...icon && {
|
|
28
|
-
icon: getLegendIcon(icon)
|
|
29
|
-
},
|
|
25
|
+
...icon && { icon: getLegendIcon(icon) },
|
|
30
26
|
...!icon && {
|
|
31
27
|
data: show !== false && Array.isArray(series) ? series.map((s) => {
|
|
32
28
|
return {
|
|
33
29
|
name: s.name,
|
|
34
|
-
icon: getLegendIcon(
|
|
30
|
+
icon: getLegendIcon(
|
|
31
|
+
s.areaStyle != null ? "square" : "line"
|
|
32
|
+
)
|
|
35
33
|
};
|
|
36
34
|
}) : void 0
|
|
37
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLegend.js","sources":["../../../src/hooks/useLegend.tsx"],"sourcesContent":["import { useMemo } from \"react\";\n\nimport { getLegendIcon } from \"@viz/utils\";\nimport { HvChartLegend, HvChartLegendIcon } from \"@viz/types/legend\";\nimport { HvEChartsOption } from \"@viz/types/common\";\n\ninterface HvLegendHookProps {\n show?: HvChartLegend[\"show\"];\n direction?: HvChartLegend[\"direction\"];\n position?: HvChartLegend[\"position\"];\n series?: Pick<HvEChartsOption, \"series.series\">;\n icon?: HvChartLegendIcon;\n formatter?: string | ((value?: string) => string);\n}\n\nexport const useLegend = ({\n series,\n show,\n icon,\n formatter,\n position: positionProp,\n direction = \"horizontal\",\n}: HvLegendHookProps) => {\n const option = useMemo<Pick<HvEChartsOption, \"legend\">>(() => {\n const position: Record<string, string> = { y: positionProp?.y ?? \"top\" };\n if (positionProp?.x != null && positionProp?.x !== \"center\") {\n position[positionProp.x] = positionProp.x;\n } else {\n position.x = \"center\";\n }\n\n return {\n legend: {\n show: show ?? (Array.isArray(series) && series.length > 1),\n itemGap: 20,\n formatter,\n orient: direction,\n ...position,\n ...(icon && { icon: getLegendIcon(icon) }),\n ...(!icon && {\n data:\n show !== false && Array.isArray(series)\n ? series.map((s) => {\n return {\n name: s.name as string,\n icon: getLegendIcon(\n (s as any).areaStyle != null ? \"square\" : \"line\"\n ),\n };\n })\n : undefined,\n }),\n },\n };\n }, [series, show, icon, formatter, positionProp, direction]);\n\n return option;\n};\n"],"names":[
|
|
1
|
+
{"version":3,"file":"useLegend.js","sources":["../../../src/hooks/useLegend.tsx"],"sourcesContent":["import { useMemo } from \"react\";\n\nimport { getLegendIcon } from \"@viz/utils\";\nimport { HvChartLegend, HvChartLegendIcon } from \"@viz/types/legend\";\nimport { HvEChartsOption } from \"@viz/types/common\";\n\ninterface HvLegendHookProps {\n show?: HvChartLegend[\"show\"];\n direction?: HvChartLegend[\"direction\"];\n position?: HvChartLegend[\"position\"];\n series?: Pick<HvEChartsOption, \"series.series\">;\n icon?: HvChartLegendIcon;\n formatter?: string | ((value?: string) => string);\n}\n\nexport const useLegend = ({\n series,\n show,\n icon,\n formatter,\n position: positionProp,\n direction = \"horizontal\",\n}: HvLegendHookProps) => {\n const option = useMemo<Pick<HvEChartsOption, \"legend\">>(() => {\n const position: Record<string, string> = { y: positionProp?.y ?? \"top\" };\n if (positionProp?.x != null && positionProp?.x !== \"center\") {\n position[positionProp.x] = positionProp.x;\n } else {\n position.x = \"center\";\n }\n\n return {\n legend: {\n show: show ?? (Array.isArray(series) && series.length > 1),\n itemGap: 20,\n formatter,\n orient: direction,\n ...position,\n ...(icon && { icon: getLegendIcon(icon) }),\n ...(!icon && {\n data:\n show !== false && Array.isArray(series)\n ? series.map((s) => {\n return {\n name: s.name as string,\n icon: getLegendIcon(\n (s as any).areaStyle != null ? \"square\" : \"line\"\n ),\n };\n })\n : undefined,\n }),\n },\n };\n }, [series, show, icon, formatter, positionProp, direction]);\n\n return option;\n};\n"],"names":[],"mappings":";;AAeO,MAAM,YAAY,CAAC;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,YAAY;AACd,MAAyB;AACjB,QAAA,SAAS,QAAyC,MAAM;AAC5D,UAAM,WAAmC,EAAE,GAAG,cAAc,KAAK,MAAM;AACvE,QAAI,cAAc,KAAK,QAAQ,cAAc,MAAM,UAAU;AAClD,eAAA,aAAa,CAAC,IAAI,aAAa;AAAA,IAAA,OACnC;AACL,eAAS,IAAI;AAAA,IACf;AAEO,WAAA;AAAA,MACL,QAAQ;AAAA,QACN,MAAM,SAAS,MAAM,QAAQ,MAAM,KAAK,OAAO,SAAS;AAAA,QACxD,SAAS;AAAA,QACT;AAAA,QACA,QAAQ;AAAA,QACR,GAAG;AAAA,QACH,GAAI,QAAQ,EAAE,MAAM,cAAc,IAAI,EAAE;AAAA,QACxC,GAAI,CAAC,QAAQ;AAAA,UACX,MACE,SAAS,SAAS,MAAM,QAAQ,MAAM,IAClC,OAAO,IAAI,CAAC,MAAM;AACT,mBAAA;AAAA,cACL,MAAM,EAAE;AAAA,cACR,MAAM;AAAA,gBACH,EAAU,aAAa,OAAO,WAAW;AAAA,cAC5C;AAAA,YAAA;AAAA,UAEH,CAAA,IACD;AAAA,QACR;AAAA,MACF;AAAA,IAAA;AAAA,EACF,GACC,CAAC,QAAQ,MAAM,MAAM,WAAW,cAAc,SAAS,CAAC;AAEpD,SAAA;AACT;"}
|
|
@@ -10,10 +10,7 @@ const useOption = ({
|
|
|
10
10
|
},
|
|
11
11
|
animation: false
|
|
12
12
|
};
|
|
13
|
-
const opt = {
|
|
14
|
-
...baseOption,
|
|
15
|
-
...optionProp
|
|
16
|
-
};
|
|
13
|
+
const opt = { ...baseOption, ...optionProp };
|
|
17
14
|
return onOptionChange ? onOptionChange(opt) : opt;
|
|
18
15
|
}, [onOptionChange, optionProp]);
|
|
19
16
|
return option;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOption.js","sources":["../../../src/hooks/useOption.ts"],"sourcesContent":["import { useMemo } from \"react\";\n\nimport { HvChartCommonProps, HvEChartsOption } from \"@viz/types/common\";\n\ninterface HvOptionHookProps {\n option: HvEChartsOption;\n onOptionChange?: HvChartCommonProps[\"onOptionChange\"];\n}\n\nexport const useOption = ({\n option: optionProp,\n onOptionChange,\n}: HvOptionHookProps) => {\n const option = useMemo<HvEChartsOption>(() => {\n // Common properties to all charts\n const baseOption = {\n aria: {\n enabled: true,\n },\n animation: false,\n };\n\n const opt = { ...baseOption, ...optionProp };\n\n return onOptionChange ? onOptionChange(opt) : opt;\n }, [onOptionChange, optionProp]);\n\n return option;\n};\n"],"names":[
|
|
1
|
+
{"version":3,"file":"useOption.js","sources":["../../../src/hooks/useOption.ts"],"sourcesContent":["import { useMemo } from \"react\";\n\nimport { HvChartCommonProps, HvEChartsOption } from \"@viz/types/common\";\n\ninterface HvOptionHookProps {\n option: HvEChartsOption;\n onOptionChange?: HvChartCommonProps[\"onOptionChange\"];\n}\n\nexport const useOption = ({\n option: optionProp,\n onOptionChange,\n}: HvOptionHookProps) => {\n const option = useMemo<HvEChartsOption>(() => {\n // Common properties to all charts\n const baseOption = {\n aria: {\n enabled: true,\n },\n animation: false,\n };\n\n const opt = { ...baseOption, ...optionProp };\n\n return onOptionChange ? onOptionChange(opt) : opt;\n }, [onOptionChange, optionProp]);\n\n return option;\n};\n"],"names":[],"mappings":";AASO,MAAM,YAAY,CAAC;AAAA,EACxB,QAAQ;AAAA,EACR;AACF,MAAyB;AACjB,QAAA,SAAS,QAAyB,MAAM;AAE5C,UAAM,aAAa;AAAA,MACjB,MAAM;AAAA,QACJ,SAAS;AAAA,MACX;AAAA,MACA,WAAW;AAAA,IAAA;AAGb,UAAM,MAAM,EAAE,GAAG,YAAY,GAAG,WAAW;AAEpC,WAAA,iBAAiB,eAAe,GAAG,IAAI;AAAA,EAAA,GAC7C,CAAC,gBAAgB,UAAU,CAAC;AAExB,SAAA;AACT;"}
|
|
@@ -74,9 +74,7 @@ const useSeries = ({
|
|
|
74
74
|
...axisOps,
|
|
75
75
|
connectNulls,
|
|
76
76
|
showSymbol,
|
|
77
|
-
areaStyle: isArea ? {
|
|
78
|
-
opacity: aOpacity
|
|
79
|
-
} : void 0
|
|
77
|
+
areaStyle: isArea ? { opacity: aOpacity } : void 0
|
|
80
78
|
};
|
|
81
79
|
}
|
|
82
80
|
}
|
|
@@ -90,7 +88,19 @@ const useSeries = ({
|
|
|
90
88
|
};
|
|
91
89
|
})
|
|
92
90
|
};
|
|
93
|
-
}, [
|
|
91
|
+
}, [
|
|
92
|
+
data,
|
|
93
|
+
groupByKey,
|
|
94
|
+
area,
|
|
95
|
+
stack,
|
|
96
|
+
nameFormatter,
|
|
97
|
+
emptyCellMode,
|
|
98
|
+
areaOpacity,
|
|
99
|
+
measures,
|
|
100
|
+
type,
|
|
101
|
+
horizontal,
|
|
102
|
+
radius
|
|
103
|
+
]);
|
|
94
104
|
return option;
|
|
95
105
|
};
|
|
96
106
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSeries.js","sources":["../../../src/hooks/useSeries.tsx"],"sourcesContent":["import { useMemo } from \"react\";\n\nimport { Arrayable } from \"@hitachivantara/uikit-react-core\";\n\nimport {\n BarSeriesOption,\n LineSeriesOption,\n PieSeriesOption,\n} from \"echarts/charts\";\n\nimport { internal } from \"arquero\";\n\nimport { getGroupKey, getMeasure } from \"@viz/utils\";\nimport {\n HvBarChartMeasures,\n HvChartEmptyCellMode,\n HvDonutChartMeasure,\n HvLineChartMeasures,\n} from \"@viz/types\";\nimport {\n HvAxisChartCommonProps,\n HvChartCommonProps,\n HvEChartsOption,\n} from \"@viz/types/common\";\nimport { BarFullMeasures, LineFullMeasures } from \"@viz/types/measures\";\n\ninterface HvSeriesHookProps {\n type: \"line\" | \"bar\" | \"pie\";\n data: internal.ColumnTable;\n groupBy: HvChartCommonProps[\"groupBy\"];\n measures:\n | Arrayable<HvLineChartMeasures | HvBarChartMeasures>\n | HvDonutChartMeasure;\n area?: boolean;\n areaOpacity?: number;\n emptyCellMode?: HvChartEmptyCellMode;\n stack?: HvAxisChartCommonProps[\"stack\"];\n nameFormatter?: HvAxisChartCommonProps[\"seriesNameFormatter\"];\n horizontal?: boolean;\n radius?: number | string | (number | string)[];\n}\n\nexport const useSeries = ({\n groupBy,\n type,\n data,\n measures,\n nameFormatter,\n stack,\n horizontal = false,\n area = false,\n areaOpacity = 0.5,\n emptyCellMode,\n radius,\n}: HvSeriesHookProps) => {\n const groupByKey = getGroupKey(groupBy);\n\n const option: Pick<HvEChartsOption, \"series\"> = useMemo<\n Pick<HvEChartsOption, \"series\">\n >(() => {\n return {\n series: data\n .columnNames()\n .filter((c) => c !== groupByKey)\n .map<LineSeriesOption | BarSeriesOption | PieSeriesOption>((c) => {\n const measure = getMeasure(c, measures);\n\n let pieOps: PieSeriesOption = {};\n let lineOps: LineSeriesOption = {};\n let barOps: BarSeriesOption = {};\n\n // pie\n if (type === \"pie\") {\n pieOps = {\n encode: {\n value: c,\n itemName: groupByKey,\n },\n labelLine: {\n show: false,\n },\n label: {\n show: false,\n },\n emphasis: {\n label: {\n show: false,\n },\n },\n radius,\n };\n }\n\n // line or bar\n if (type === \"line\" || type === \"bar\") {\n const sampling =\n typeof measure !== \"string\"\n ? (measure as LineFullMeasures | BarFullMeasures).sampling\n : undefined;\n const yAxisId =\n typeof measure !== \"string\"\n ? (measure as LineFullMeasures | BarFullMeasures).yAxis\n : undefined;\n const stackName =\n typeof measure !== \"string\"\n ? (measure as LineFullMeasures | BarFullMeasures).stack ??\n stack ??\n undefined\n : stack ?? undefined;\n\n const axisOps = {\n sampling,\n yAxisId,\n stack: stackName,\n encode: horizontal\n ? {\n x: c,\n y: groupByKey,\n }\n : {\n x: groupByKey,\n y: c,\n },\n };\n\n // bar\n if (type === \"bar\") {\n barOps = {\n ...axisOps,\n barMaxWidth: 90,\n barMinWidth: 3,\n };\n }\n\n // line\n if (type === \"line\") {\n const showSymbol =\n typeof measure !== \"string\"\n ? !(measure as LineFullMeasures).hideSymbol\n : true;\n const connectNulls =\n typeof measure !== \"string\" &&\n (measure as LineFullMeasures).emptyCellMode\n ? (measure as LineFullMeasures).emptyCellMode === \"connect\"\n : emptyCellMode === \"connect\";\n const isArea =\n typeof measure !== \"string\"\n ? (measure as LineFullMeasures).area ?? area\n : area;\n const aOpacity =\n typeof measure !== \"string\"\n ? (measure as LineFullMeasures).areaOpacity ?? areaOpacity\n : areaOpacity;\n\n lineOps = {\n ...axisOps,\n connectNulls,\n showSymbol,\n areaStyle: isArea ? { opacity: aOpacity } : undefined,\n };\n }\n }\n\n return {\n id: `series~${groupByKey}~${c}`,\n type,\n name: nameFormatter ? nameFormatter(c) : c,\n ...pieOps,\n ...barOps,\n ...lineOps,\n } as LineSeriesOption | BarSeriesOption | PieSeriesOption;\n }),\n };\n }, [\n data,\n groupByKey,\n area,\n stack,\n nameFormatter,\n emptyCellMode,\n areaOpacity,\n measures,\n type,\n horizontal,\n radius,\n ]);\n\n return option;\n};\n"],"names":[
|
|
1
|
+
{"version":3,"file":"useSeries.js","sources":["../../../src/hooks/useSeries.tsx"],"sourcesContent":["import { useMemo } from \"react\";\n\nimport { Arrayable } from \"@hitachivantara/uikit-react-core\";\n\nimport {\n BarSeriesOption,\n LineSeriesOption,\n PieSeriesOption,\n} from \"echarts/charts\";\n\nimport { internal } from \"arquero\";\n\nimport { getGroupKey, getMeasure } from \"@viz/utils\";\nimport {\n HvBarChartMeasures,\n HvChartEmptyCellMode,\n HvDonutChartMeasure,\n HvLineChartMeasures,\n} from \"@viz/types\";\nimport {\n HvAxisChartCommonProps,\n HvChartCommonProps,\n HvEChartsOption,\n} from \"@viz/types/common\";\nimport { BarFullMeasures, LineFullMeasures } from \"@viz/types/measures\";\n\ninterface HvSeriesHookProps {\n type: \"line\" | \"bar\" | \"pie\";\n data: internal.ColumnTable;\n groupBy: HvChartCommonProps[\"groupBy\"];\n measures:\n | Arrayable<HvLineChartMeasures | HvBarChartMeasures>\n | HvDonutChartMeasure;\n area?: boolean;\n areaOpacity?: number;\n emptyCellMode?: HvChartEmptyCellMode;\n stack?: HvAxisChartCommonProps[\"stack\"];\n nameFormatter?: HvAxisChartCommonProps[\"seriesNameFormatter\"];\n horizontal?: boolean;\n radius?: number | string | (number | string)[];\n}\n\nexport const useSeries = ({\n groupBy,\n type,\n data,\n measures,\n nameFormatter,\n stack,\n horizontal = false,\n area = false,\n areaOpacity = 0.5,\n emptyCellMode,\n radius,\n}: HvSeriesHookProps) => {\n const groupByKey = getGroupKey(groupBy);\n\n const option: Pick<HvEChartsOption, \"series\"> = useMemo<\n Pick<HvEChartsOption, \"series\">\n >(() => {\n return {\n series: data\n .columnNames()\n .filter((c) => c !== groupByKey)\n .map<LineSeriesOption | BarSeriesOption | PieSeriesOption>((c) => {\n const measure = getMeasure(c, measures);\n\n let pieOps: PieSeriesOption = {};\n let lineOps: LineSeriesOption = {};\n let barOps: BarSeriesOption = {};\n\n // pie\n if (type === \"pie\") {\n pieOps = {\n encode: {\n value: c,\n itemName: groupByKey,\n },\n labelLine: {\n show: false,\n },\n label: {\n show: false,\n },\n emphasis: {\n label: {\n show: false,\n },\n },\n radius,\n };\n }\n\n // line or bar\n if (type === \"line\" || type === \"bar\") {\n const sampling =\n typeof measure !== \"string\"\n ? (measure as LineFullMeasures | BarFullMeasures).sampling\n : undefined;\n const yAxisId =\n typeof measure !== \"string\"\n ? (measure as LineFullMeasures | BarFullMeasures).yAxis\n : undefined;\n const stackName =\n typeof measure !== \"string\"\n ? (measure as LineFullMeasures | BarFullMeasures).stack ??\n stack ??\n undefined\n : stack ?? undefined;\n\n const axisOps = {\n sampling,\n yAxisId,\n stack: stackName,\n encode: horizontal\n ? {\n x: c,\n y: groupByKey,\n }\n : {\n x: groupByKey,\n y: c,\n },\n };\n\n // bar\n if (type === \"bar\") {\n barOps = {\n ...axisOps,\n barMaxWidth: 90,\n barMinWidth: 3,\n };\n }\n\n // line\n if (type === \"line\") {\n const showSymbol =\n typeof measure !== \"string\"\n ? !(measure as LineFullMeasures).hideSymbol\n : true;\n const connectNulls =\n typeof measure !== \"string\" &&\n (measure as LineFullMeasures).emptyCellMode\n ? (measure as LineFullMeasures).emptyCellMode === \"connect\"\n : emptyCellMode === \"connect\";\n const isArea =\n typeof measure !== \"string\"\n ? (measure as LineFullMeasures).area ?? area\n : area;\n const aOpacity =\n typeof measure !== \"string\"\n ? (measure as LineFullMeasures).areaOpacity ?? areaOpacity\n : areaOpacity;\n\n lineOps = {\n ...axisOps,\n connectNulls,\n showSymbol,\n areaStyle: isArea ? { opacity: aOpacity } : undefined,\n };\n }\n }\n\n return {\n id: `series~${groupByKey}~${c}`,\n type,\n name: nameFormatter ? nameFormatter(c) : c,\n ...pieOps,\n ...barOps,\n ...lineOps,\n } as LineSeriesOption | BarSeriesOption | PieSeriesOption;\n }),\n };\n }, [\n data,\n groupByKey,\n area,\n stack,\n nameFormatter,\n emptyCellMode,\n areaOpacity,\n measures,\n type,\n horizontal,\n radius,\n ]);\n\n return option;\n};\n"],"names":[],"mappings":";;;AA0CO,MAAM,YAAY,CAAC;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,OAAO;AAAA,EACP,cAAc;AAAA,EACd;AAAA,EACA;AACF,MAAyB;AACjB,QAAA,aAAa,YAAY,OAAO;AAEhC,QAAA,SAA0C,QAE9C,MAAM;AACC,WAAA;AAAA,MACL,QAAQ,KACL,YAAY,EACZ,OAAO,CAAC,MAAM,MAAM,UAAU,EAC9B,IAA0D,CAAC,MAAM;AAC1D,cAAA,UAAU,WAAW,GAAG,QAAQ;AAEtC,YAAI,SAA0B,CAAA;AAC9B,YAAI,UAA4B,CAAA;AAChC,YAAI,SAA0B,CAAA;AAG9B,YAAI,SAAS,OAAO;AACT,mBAAA;AAAA,YACP,QAAQ;AAAA,cACN,OAAO;AAAA,cACP,UAAU;AAAA,YACZ;AAAA,YACA,WAAW;AAAA,cACT,MAAM;AAAA,YACR;AAAA,YACA,OAAO;AAAA,cACL,MAAM;AAAA,YACR;AAAA,YACA,UAAU;AAAA,cACR,OAAO;AAAA,gBACL,MAAM;AAAA,cACR;AAAA,YACF;AAAA,YACA;AAAA,UAAA;AAAA,QAEJ;AAGI,YAAA,SAAS,UAAU,SAAS,OAAO;AACrC,gBAAM,WACJ,OAAO,YAAY,WACd,QAA+C,WAChD;AACN,gBAAM,UACJ,OAAO,YAAY,WACd,QAA+C,QAChD;AACA,gBAAA,YACJ,OAAO,YAAY,WACd,QAA+C,SAChD,SACA,SACA,SAAS;AAEf,gBAAM,UAAU;AAAA,YACd;AAAA,YACA;AAAA,YACA,OAAO;AAAA,YACP,QAAQ,aACJ;AAAA,cACE,GAAG;AAAA,cACH,GAAG;AAAA,YAAA,IAEL;AAAA,cACE,GAAG;AAAA,cACH,GAAG;AAAA,YACL;AAAA,UAAA;AAIN,cAAI,SAAS,OAAO;AACT,qBAAA;AAAA,cACP,GAAG;AAAA,cACH,aAAa;AAAA,cACb,aAAa;AAAA,YAAA;AAAA,UAEjB;AAGA,cAAI,SAAS,QAAQ;AACnB,kBAAM,aACJ,OAAO,YAAY,WACf,CAAE,QAA6B,aAC/B;AACA,kBAAA,eACJ,OAAO,YAAY,YAClB,QAA6B,gBACzB,QAA6B,kBAAkB,YAChD,kBAAkB;AACxB,kBAAM,SACJ,OAAO,YAAY,WACd,QAA6B,QAAQ,OACtC;AACN,kBAAM,WACJ,OAAO,YAAY,WACd,QAA6B,eAAe,cAC7C;AAEI,sBAAA;AAAA,cACR,GAAG;AAAA,cACH;AAAA,cACA;AAAA,cACA,WAAW,SAAS,EAAE,SAAS,aAAa;AAAA,YAAA;AAAA,UAEhD;AAAA,QACF;AAEO,eAAA;AAAA,UACL,IAAI,UAAU,UAAU,IAAI,CAAC;AAAA,UAC7B;AAAA,UACA,MAAM,gBAAgB,cAAc,CAAC,IAAI;AAAA,UACzC,GAAG;AAAA,UACH,GAAG;AAAA,UACH,GAAG;AAAA,QAAA;AAAA,MACL,CACD;AAAA,IAAA;AAAA,EACL,GACC;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,CACD;AAEM,SAAA;AACT;"}
|
|
@@ -36,7 +36,17 @@ const useVisualMap = ({
|
|
|
36
36
|
left: positionProp?.x || "center"
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
-
}, [
|
|
39
|
+
}, [
|
|
40
|
+
colorScale,
|
|
41
|
+
direction,
|
|
42
|
+
max,
|
|
43
|
+
min,
|
|
44
|
+
pieces,
|
|
45
|
+
positionProp?.x,
|
|
46
|
+
positionProp?.y,
|
|
47
|
+
show,
|
|
48
|
+
type
|
|
49
|
+
]);
|
|
40
50
|
return option;
|
|
41
51
|
};
|
|
42
52
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useVisualMap.js","sources":["../../../src/hooks/useVisualMap.tsx"],"sourcesContent":["import { useMemo } from \"react\";\n\nimport { getLegendIcon } from \"@viz/utils\";\nimport { HvChartLegend } from \"@viz/types\";\nimport { HvEChartsOption } from \"@viz/types/common\";\n\nexport interface HvVisualMapHookProps {\n show?: boolean;\n pieces?: Record<string, string | number>[];\n max?: number;\n min?: number;\n colorScale?: string[];\n type?: \"continuous\" | \"piecewise\";\n // Uses the same props as the legend\n position?: HvChartLegend[\"position\"];\n direction?: HvChartLegend[\"direction\"];\n}\n\nexport const useVisualMap = ({\n show = true,\n direction = \"horizontal\",\n type = \"continuous\",\n pieces,\n max,\n min,\n colorScale,\n position: positionProp,\n}: HvVisualMapHookProps) => {\n const option = useMemo<Pick<HvEChartsOption, \"visualMap\">>(() => {\n return {\n visualMap: {\n type,\n show,\n ...(pieces && {\n pieces,\n }),\n ...(type === \"piecewise\" && {\n itemSymbol: getLegendIcon(\"square\"),\n itemGap: 20,\n itemHeight: 16,\n itemWidth: 16,\n }),\n ...(colorScale && {\n max,\n min,\n inRange: {\n color: colorScale,\n },\n }),\n orient: direction,\n top: positionProp?.y || \"top\",\n left: positionProp?.x || \"center\",\n },\n };\n }, [\n colorScale,\n direction,\n max,\n min,\n pieces,\n positionProp?.x,\n positionProp?.y,\n show,\n type,\n ]);\n\n return option;\n};\n"],"names":[
|
|
1
|
+
{"version":3,"file":"useVisualMap.js","sources":["../../../src/hooks/useVisualMap.tsx"],"sourcesContent":["import { useMemo } from \"react\";\n\nimport { getLegendIcon } from \"@viz/utils\";\nimport { HvChartLegend } from \"@viz/types\";\nimport { HvEChartsOption } from \"@viz/types/common\";\n\nexport interface HvVisualMapHookProps {\n show?: boolean;\n pieces?: Record<string, string | number>[];\n max?: number;\n min?: number;\n colorScale?: string[];\n type?: \"continuous\" | \"piecewise\";\n // Uses the same props as the legend\n position?: HvChartLegend[\"position\"];\n direction?: HvChartLegend[\"direction\"];\n}\n\nexport const useVisualMap = ({\n show = true,\n direction = \"horizontal\",\n type = \"continuous\",\n pieces,\n max,\n min,\n colorScale,\n position: positionProp,\n}: HvVisualMapHookProps) => {\n const option = useMemo<Pick<HvEChartsOption, \"visualMap\">>(() => {\n return {\n visualMap: {\n type,\n show,\n ...(pieces && {\n pieces,\n }),\n ...(type === \"piecewise\" && {\n itemSymbol: getLegendIcon(\"square\"),\n itemGap: 20,\n itemHeight: 16,\n itemWidth: 16,\n }),\n ...(colorScale && {\n max,\n min,\n inRange: {\n color: colorScale,\n },\n }),\n orient: direction,\n top: positionProp?.y || \"top\",\n left: positionProp?.x || \"center\",\n },\n };\n }, [\n colorScale,\n direction,\n max,\n min,\n pieces,\n positionProp?.x,\n positionProp?.y,\n show,\n type,\n ]);\n\n return option;\n};\n"],"names":[],"mappings":";;AAkBO,MAAM,eAAe,CAAC;AAAA,EAC3B,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AACZ,MAA4B;AACpB,QAAA,SAAS,QAA4C,MAAM;AACxD,WAAA;AAAA,MACL,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA,GAAI,UAAU;AAAA,UACZ;AAAA,QACF;AAAA,QACA,GAAI,SAAS,eAAe;AAAA,UAC1B,YAAY,cAAc,QAAQ;AAAA,UAClC,SAAS;AAAA,UACT,YAAY;AAAA,UACZ,WAAW;AAAA,QACb;AAAA,QACA,GAAI,cAAc;AAAA,UAChB;AAAA,UACA;AAAA,UACA,SAAS;AAAA,YACP,OAAO;AAAA,UACT;AAAA,QACF;AAAA,QACA,QAAQ;AAAA,QACR,KAAK,cAAc,KAAK;AAAA,QACxB,MAAM,cAAc,KAAK;AAAA,MAC3B;AAAA,IAAA;AAAA,EACF,GACC;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc;AAAA,IACd,cAAc;AAAA,IACd;AAAA,IACA;AAAA,EAAA,CACD;AAEM,SAAA;AACT;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useVizTheme.js","sources":["../../../src/hooks/useVizTheme.ts"],"sourcesContent":["import { useContext } from \"react\";\n\nimport { HvVizContext, HvVizContextValue } from \"@viz/providers\";\n\nexport const useVizTheme = (): HvVizContextValue => {\n return useContext(HvVizContext);\n};\n"],"names":[
|
|
1
|
+
{"version":3,"file":"useVizTheme.js","sources":["../../../src/hooks/useVizTheme.ts"],"sourcesContent":["import { useContext } from \"react\";\n\nimport { HvVizContext, HvVizContextValue } from \"@viz/providers\";\n\nexport const useVizTheme = (): HvVizContextValue => {\n return useContext(HvVizContext);\n};\n"],"names":[],"mappings":";;AAIO,MAAM,cAAc,MAAyB;AAClD,SAAO,WAAW,YAAY;AAChC;"}
|
|
@@ -14,9 +14,7 @@ const useXAxis = ({
|
|
|
14
14
|
position,
|
|
15
15
|
nameProps
|
|
16
16
|
}) => {
|
|
17
|
-
const {
|
|
18
|
-
colors
|
|
19
|
-
} = useTheme();
|
|
17
|
+
const { colors } = useTheme();
|
|
20
18
|
const option = useMemo(() => {
|
|
21
19
|
const nameStyleKeys = nameProps ? Object.keys(nameProps).filter((key) => key !== "location") : void 0;
|
|
22
20
|
const nameStyle = nameProps && nameStyleKeys ? nameStyleKeys.reduce((acc, curr) => {
|
|
@@ -43,15 +41,24 @@ const useXAxis = ({
|
|
|
43
41
|
...nameStyle && {
|
|
44
42
|
nameTextStyle: nameStyle
|
|
45
43
|
},
|
|
46
|
-
...data && {
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
...position && {
|
|
50
|
-
position
|
|
51
|
-
}
|
|
44
|
+
...data && { data },
|
|
45
|
+
...position && { position }
|
|
52
46
|
}
|
|
53
47
|
};
|
|
54
|
-
}, [
|
|
48
|
+
}, [
|
|
49
|
+
nameProps,
|
|
50
|
+
id,
|
|
51
|
+
type,
|
|
52
|
+
name,
|
|
53
|
+
scale,
|
|
54
|
+
labelRotation,
|
|
55
|
+
labelFormatter,
|
|
56
|
+
maxValue,
|
|
57
|
+
minValue,
|
|
58
|
+
data,
|
|
59
|
+
position,
|
|
60
|
+
colors
|
|
61
|
+
]);
|
|
55
62
|
return option;
|
|
56
63
|
};
|
|
57
64
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useXAxis.js","sources":["../../../src/hooks/useXAxis.tsx"],"sourcesContent":["import { useMemo } from \"react\";\n\nimport { useTheme } from \"@hitachivantara/uikit-react-core\";\n\nimport { getAxisType } from \"@viz/utils\";\nimport { HvChartXAxis, HvEChartsOption } from \"@viz/types/common\";\n\ninterface HvXAxisHookProps extends HvChartXAxis {\n scale?: boolean;\n data?: string[];\n}\n\nexport const useXAxis = ({\n id,\n type = \"categorical\",\n labelFormatter,\n labelRotation,\n name,\n maxValue,\n minValue,\n scale = false,\n data,\n position,\n nameProps,\n}: HvXAxisHookProps) => {\n const { colors } = useTheme();\n\n const option = useMemo<Pick<HvEChartsOption, \"xAxis\">>(() => {\n const nameStyleKeys = nameProps\n ? Object.keys(nameProps).filter((key) => key !== \"location\")\n : undefined;\n const nameStyle =\n nameProps && nameStyleKeys\n ? nameStyleKeys.reduce((acc, curr) => {\n return {\n ...acc,\n [curr]:\n curr === \"color\"\n ? colors?.[nameProps[curr] as string] || nameProps[curr]\n : nameProps[curr],\n };\n }, {})\n : undefined;\n\n return {\n xAxis: {\n id,\n type: getAxisType(type),\n name,\n scale,\n axisLabel: {\n rotate: labelRotation ?? 0,\n formatter: labelFormatter,\n },\n max: maxValue === \"max\" ? \"dataMax\" : maxValue,\n min: minValue === \"min\" ? \"dataMin\" : minValue,\n ...(nameProps?.location && {\n nameLocation: nameProps.location,\n }),\n ...(nameStyle && {\n nameTextStyle: nameStyle,\n }),\n ...(data && { data }),\n ...(position && { position }),\n },\n };\n }, [\n nameProps,\n id,\n type,\n name,\n scale,\n labelRotation,\n labelFormatter,\n maxValue,\n minValue,\n data,\n position,\n colors,\n ]);\n\n return option;\n};\n"],"names":[
|
|
1
|
+
{"version":3,"file":"useXAxis.js","sources":["../../../src/hooks/useXAxis.tsx"],"sourcesContent":["import { useMemo } from \"react\";\n\nimport { useTheme } from \"@hitachivantara/uikit-react-core\";\n\nimport { getAxisType } from \"@viz/utils\";\nimport { HvChartXAxis, HvEChartsOption } from \"@viz/types/common\";\n\ninterface HvXAxisHookProps extends HvChartXAxis {\n scale?: boolean;\n data?: string[];\n}\n\nexport const useXAxis = ({\n id,\n type = \"categorical\",\n labelFormatter,\n labelRotation,\n name,\n maxValue,\n minValue,\n scale = false,\n data,\n position,\n nameProps,\n}: HvXAxisHookProps) => {\n const { colors } = useTheme();\n\n const option = useMemo<Pick<HvEChartsOption, \"xAxis\">>(() => {\n const nameStyleKeys = nameProps\n ? Object.keys(nameProps).filter((key) => key !== \"location\")\n : undefined;\n const nameStyle =\n nameProps && nameStyleKeys\n ? nameStyleKeys.reduce((acc, curr) => {\n return {\n ...acc,\n [curr]:\n curr === \"color\"\n ? colors?.[nameProps[curr] as string] || nameProps[curr]\n : nameProps[curr],\n };\n }, {})\n : undefined;\n\n return {\n xAxis: {\n id,\n type: getAxisType(type),\n name,\n scale,\n axisLabel: {\n rotate: labelRotation ?? 0,\n formatter: labelFormatter,\n },\n max: maxValue === \"max\" ? \"dataMax\" : maxValue,\n min: minValue === \"min\" ? \"dataMin\" : minValue,\n ...(nameProps?.location && {\n nameLocation: nameProps.location,\n }),\n ...(nameStyle && {\n nameTextStyle: nameStyle,\n }),\n ...(data && { data }),\n ...(position && { position }),\n },\n };\n }, [\n nameProps,\n id,\n type,\n name,\n scale,\n labelRotation,\n labelFormatter,\n maxValue,\n minValue,\n data,\n position,\n colors,\n ]);\n\n return option;\n};\n"],"names":[],"mappings":";;;AAYO,MAAM,WAAW,CAAC;AAAA,EACvB;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AACF,MAAwB;AAChB,QAAA,EAAE,WAAW;AAEb,QAAA,SAAS,QAAwC,MAAM;AACrD,UAAA,gBAAgB,YAClB,OAAO,KAAK,SAAS,EAAE,OAAO,CAAC,QAAQ,QAAQ,UAAU,IACzD;AACJ,UAAM,YACJ,aAAa,gBACT,cAAc,OAAO,CAAC,KAAK,SAAS;AAC3B,aAAA;AAAA,QACL,GAAG;AAAA,QACH,CAAC,IAAI,GACH,SAAS,UACL,SAAS,UAAU,IAAI,CAAW,KAAK,UAAU,IAAI,IACrD,UAAU,IAAI;AAAA,MAAA;AAAA,IACtB,GACC,CAAE,CAAA,IACL;AAEC,WAAA;AAAA,MACL,OAAO;AAAA,QACL;AAAA,QACA,MAAM,YAAY,IAAI;AAAA,QACtB;AAAA,QACA;AAAA,QACA,WAAW;AAAA,UACT,QAAQ,iBAAiB;AAAA,UACzB,WAAW;AAAA,QACb;AAAA,QACA,KAAK,aAAa,QAAQ,YAAY;AAAA,QACtC,KAAK,aAAa,QAAQ,YAAY;AAAA,QACtC,GAAI,WAAW,YAAY;AAAA,UACzB,cAAc,UAAU;AAAA,QAC1B;AAAA,QACA,GAAI,aAAa;AAAA,UACf,eAAe;AAAA,QACjB;AAAA,QACA,GAAI,QAAQ,EAAE,KAAK;AAAA,QACnB,GAAI,YAAY,EAAE,SAAS;AAAA,MAC7B;AAAA,IAAA;AAAA,EACF,GACC;AAAA,IACD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,CACD;AAEM,SAAA;AACT;"}
|
|
@@ -5,52 +5,49 @@ const useYAxis = ({
|
|
|
5
5
|
axes,
|
|
6
6
|
defaultType = "continuous"
|
|
7
7
|
}) => {
|
|
8
|
-
const {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const createAxis = useCallback(({
|
|
12
|
-
id,
|
|
13
|
-
type,
|
|
14
|
-
name,
|
|
15
|
-
labelFormatter,
|
|
16
|
-
labelRotation,
|
|
17
|
-
maxValue,
|
|
18
|
-
minValue,
|
|
19
|
-
nameProps,
|
|
20
|
-
data,
|
|
21
|
-
position
|
|
22
|
-
}) => {
|
|
23
|
-
const nameStyleKeys = nameProps ? Object.keys(nameProps).filter((key) => key !== "location") : void 0;
|
|
24
|
-
const nameStyle = nameProps && nameStyleKeys ? nameStyleKeys.reduce((acc, curr) => {
|
|
25
|
-
return {
|
|
26
|
-
...acc,
|
|
27
|
-
[curr]: curr === "color" ? colors?.[nameProps[curr]] || nameProps[curr] : nameProps[curr]
|
|
28
|
-
};
|
|
29
|
-
}, {}) : void 0;
|
|
30
|
-
return {
|
|
8
|
+
const { colors } = useTheme();
|
|
9
|
+
const createAxis = useCallback(
|
|
10
|
+
({
|
|
31
11
|
id,
|
|
32
|
-
type
|
|
12
|
+
type,
|
|
33
13
|
name,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
14
|
+
labelFormatter,
|
|
15
|
+
labelRotation,
|
|
16
|
+
maxValue,
|
|
17
|
+
minValue,
|
|
18
|
+
nameProps,
|
|
19
|
+
data,
|
|
20
|
+
position
|
|
21
|
+
}) => {
|
|
22
|
+
const nameStyleKeys = nameProps ? Object.keys(nameProps).filter((key) => key !== "location") : void 0;
|
|
23
|
+
const nameStyle = nameProps && nameStyleKeys ? nameStyleKeys.reduce((acc, curr) => {
|
|
24
|
+
return {
|
|
25
|
+
...acc,
|
|
26
|
+
[curr]: curr === "color" ? colors?.[nameProps[curr]] || nameProps[curr] : nameProps[curr]
|
|
27
|
+
};
|
|
28
|
+
}, {}) : void 0;
|
|
29
|
+
return {
|
|
30
|
+
id,
|
|
31
|
+
type: getAxisType(type) ?? getAxisType(defaultType),
|
|
32
|
+
name,
|
|
33
|
+
axisLabel: {
|
|
34
|
+
rotate: labelRotation ?? 0,
|
|
35
|
+
formatter: labelFormatter
|
|
36
|
+
},
|
|
37
|
+
max: maxValue === "max" ? "dataMax" : maxValue,
|
|
38
|
+
min: minValue === "min" ? "dataMin" : minValue,
|
|
39
|
+
...nameProps?.location && {
|
|
40
|
+
nameLocation: nameProps?.location
|
|
41
|
+
},
|
|
42
|
+
...nameStyle && {
|
|
43
|
+
nameTextStyle: nameStyle
|
|
44
|
+
},
|
|
45
|
+
...data && { data },
|
|
46
|
+
...position && { position }
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
[colors, defaultType]
|
|
50
|
+
);
|
|
54
51
|
const option = useMemo(() => {
|
|
55
52
|
return {
|
|
56
53
|
yAxis: Array.isArray(axes) ? axes.map((axis) => createAxis(axis)) : [createAxis({})]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useYAxis.js","sources":["../../../src/hooks/useYAxis.tsx"],"sourcesContent":["import { useMemo, useCallback } from \"react\";\n\nimport { useTheme } from \"@hitachivantara/uikit-react-core\";\n\nimport { getAxisType } from \"@viz/utils\";\nimport { HvChartAxisType } from \"@viz/types\";\nimport { HvChartYAxis, HvEChartsOption } from \"@viz/types/common\";\n\ninterface YAxis extends HvChartYAxis {\n data?: string[];\n}\n\ninterface HvYAxisHookProps {\n axes?: YAxis[];\n defaultType?: HvChartAxisType;\n}\n\nexport const useYAxis = ({\n axes,\n defaultType = \"continuous\",\n}: HvYAxisHookProps) => {\n const { colors } = useTheme();\n\n const createAxis = useCallback(\n ({\n id,\n type,\n name,\n labelFormatter,\n labelRotation,\n maxValue,\n minValue,\n nameProps,\n data,\n position,\n }: YAxis) => {\n const nameStyleKeys = nameProps\n ? Object.keys(nameProps).filter((key) => key !== \"location\")\n : undefined;\n const nameStyle =\n nameProps && nameStyleKeys\n ? nameStyleKeys.reduce((acc, curr) => {\n return {\n ...acc,\n [curr]:\n curr === \"color\"\n ? colors?.[nameProps[curr] as string] || nameProps[curr]\n : nameProps[curr],\n };\n }, {})\n : undefined;\n\n return {\n id,\n type: getAxisType(type) ?? getAxisType(defaultType),\n name,\n axisLabel: {\n rotate: labelRotation ?? 0,\n formatter: labelFormatter,\n },\n max: maxValue === \"max\" ? \"dataMax\" : maxValue,\n min: minValue === \"min\" ? \"dataMin\" : minValue,\n ...(nameProps?.location && {\n nameLocation: nameProps?.location,\n }),\n ...(nameStyle && {\n nameTextStyle: nameStyle,\n }),\n ...(data && { data }),\n ...(position && { position }),\n };\n },\n [colors, defaultType]\n );\n\n const option = useMemo<Pick<HvEChartsOption, \"yAxis\">>(() => {\n return {\n yAxis: Array.isArray(axes)\n ? axes.map((axis) => createAxis(axis))\n : [createAxis({})],\n };\n }, [axes, createAxis]);\n\n return option;\n};\n"],"names":[
|
|
1
|
+
{"version":3,"file":"useYAxis.js","sources":["../../../src/hooks/useYAxis.tsx"],"sourcesContent":["import { useMemo, useCallback } from \"react\";\n\nimport { useTheme } from \"@hitachivantara/uikit-react-core\";\n\nimport { getAxisType } from \"@viz/utils\";\nimport { HvChartAxisType } from \"@viz/types\";\nimport { HvChartYAxis, HvEChartsOption } from \"@viz/types/common\";\n\ninterface YAxis extends HvChartYAxis {\n data?: string[];\n}\n\ninterface HvYAxisHookProps {\n axes?: YAxis[];\n defaultType?: HvChartAxisType;\n}\n\nexport const useYAxis = ({\n axes,\n defaultType = \"continuous\",\n}: HvYAxisHookProps) => {\n const { colors } = useTheme();\n\n const createAxis = useCallback(\n ({\n id,\n type,\n name,\n labelFormatter,\n labelRotation,\n maxValue,\n minValue,\n nameProps,\n data,\n position,\n }: YAxis) => {\n const nameStyleKeys = nameProps\n ? Object.keys(nameProps).filter((key) => key !== \"location\")\n : undefined;\n const nameStyle =\n nameProps && nameStyleKeys\n ? nameStyleKeys.reduce((acc, curr) => {\n return {\n ...acc,\n [curr]:\n curr === \"color\"\n ? colors?.[nameProps[curr] as string] || nameProps[curr]\n : nameProps[curr],\n };\n }, {})\n : undefined;\n\n return {\n id,\n type: getAxisType(type) ?? getAxisType(defaultType),\n name,\n axisLabel: {\n rotate: labelRotation ?? 0,\n formatter: labelFormatter,\n },\n max: maxValue === \"max\" ? \"dataMax\" : maxValue,\n min: minValue === \"min\" ? \"dataMin\" : minValue,\n ...(nameProps?.location && {\n nameLocation: nameProps?.location,\n }),\n ...(nameStyle && {\n nameTextStyle: nameStyle,\n }),\n ...(data && { data }),\n ...(position && { position }),\n };\n },\n [colors, defaultType]\n );\n\n const option = useMemo<Pick<HvEChartsOption, \"yAxis\">>(() => {\n return {\n yAxis: Array.isArray(axes)\n ? axes.map((axis) => createAxis(axis))\n : [createAxis({})],\n };\n }, [axes, createAxis]);\n\n return option;\n};\n"],"names":[],"mappings":";;;AAiBO,MAAM,WAAW,CAAC;AAAA,EACvB;AAAA,EACA,cAAc;AAChB,MAAwB;AAChB,QAAA,EAAE,WAAW;AAEnB,QAAM,aAAa;AAAA,IACjB,CAAC;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA,MACW;AACL,YAAA,gBAAgB,YAClB,OAAO,KAAK,SAAS,EAAE,OAAO,CAAC,QAAQ,QAAQ,UAAU,IACzD;AACJ,YAAM,YACJ,aAAa,gBACT,cAAc,OAAO,CAAC,KAAK,SAAS;AAC3B,eAAA;AAAA,UACL,GAAG;AAAA,UACH,CAAC,IAAI,GACH,SAAS,UACL,SAAS,UAAU,IAAI,CAAW,KAAK,UAAU,IAAI,IACrD,UAAU,IAAI;AAAA,QAAA;AAAA,MACtB,GACC,CAAE,CAAA,IACL;AAEC,aAAA;AAAA,QACL;AAAA,QACA,MAAM,YAAY,IAAI,KAAK,YAAY,WAAW;AAAA,QAClD;AAAA,QACA,WAAW;AAAA,UACT,QAAQ,iBAAiB;AAAA,UACzB,WAAW;AAAA,QACb;AAAA,QACA,KAAK,aAAa,QAAQ,YAAY;AAAA,QACtC,KAAK,aAAa,QAAQ,YAAY;AAAA,QACtC,GAAI,WAAW,YAAY;AAAA,UACzB,cAAc,WAAW;AAAA,QAC3B;AAAA,QACA,GAAI,aAAa;AAAA,UACf,eAAe;AAAA,QACjB;AAAA,QACA,GAAI,QAAQ,EAAE,KAAK;AAAA,QACnB,GAAI,YAAY,EAAE,SAAS;AAAA,MAAA;AAAA,IAE/B;AAAA,IACA,CAAC,QAAQ,WAAW;AAAA,EAAA;AAGhB,QAAA,SAAS,QAAwC,MAAM;AACpD,WAAA;AAAA,MACL,OAAO,MAAM,QAAQ,IAAI,IACrB,KAAK,IAAI,CAAC,SAAS,WAAW,IAAI,CAAC,IACnC,CAAC,WAAW,CAAE,CAAA,CAAC;AAAA,IAAA;AAAA,EACrB,GACC,CAAC,MAAM,UAAU,CAAC;AAEd,SAAA;AACT;"}
|
|
@@ -5,19 +5,11 @@ import { registerTheme } from "../utils/registerTheme.js";
|
|
|
5
5
|
const HvVizContext = createContext({
|
|
6
6
|
theme: void 0
|
|
7
7
|
});
|
|
8
|
-
const HvVizProvider = ({
|
|
9
|
-
|
|
10
|
-
}) => {
|
|
11
|
-
const {
|
|
12
|
-
activeTheme,
|
|
13
|
-
selectedMode,
|
|
14
|
-
selectedTheme
|
|
15
|
-
} = useTheme();
|
|
8
|
+
const HvVizProvider = ({ children }) => {
|
|
9
|
+
const { activeTheme, selectedMode, selectedTheme } = useTheme();
|
|
16
10
|
const value = useMemo(() => {
|
|
17
11
|
registerTheme(selectedTheme, selectedMode, activeTheme);
|
|
18
|
-
return {
|
|
19
|
-
theme: `${selectedTheme}-${selectedMode}`
|
|
20
|
-
};
|
|
12
|
+
return { theme: `${selectedTheme}-${selectedMode}` };
|
|
21
13
|
}, [selectedTheme, selectedMode, activeTheme]);
|
|
22
14
|
return /* @__PURE__ */ jsx(HvVizContext.Provider, { value, children });
|
|
23
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.js","sources":["../../../src/providers/Provider.tsx"],"sourcesContent":["import { createContext, useMemo } from \"react\";\n\nimport { useTheme } from \"@hitachivantara/uikit-react-core\";\n\nimport { registerTheme } from \"@viz/utils\";\n\nexport interface HvVizContextValue {\n /**\n * Current theme\n */\n theme?: string;\n}\n\nexport const HvVizContext = createContext<HvVizContextValue>({\n theme: undefined,\n});\n\nexport interface HvVizProviderProps {\n /**\n * Component tree.\n */\n children?: React.ReactNode;\n}\n\n/**\n * Enables theming capabilities for visualizations.\n *\n * Without this provider the visualizations will not comply to the UI Kit themes.\n *\n * This provider should always be used in combination with the `HvProvider` from\n * the core package since the former uses the themes provided by the latter.\n *\n * `HvVizProvider` should always be used after `HvProvider` like so to work properly:\n *\n * ```\n * <HvProvider>\n * <HvVizProvider>\n * (...)\n * </HvVizProvider>\n * </HvProvider>\n * ```\n */\nexport const HvVizProvider = ({ children }: HvVizProviderProps) => {\n const { activeTheme, selectedMode, selectedTheme } = useTheme();\n\n const value = useMemo(() => {\n registerTheme(selectedTheme, selectedMode, activeTheme);\n\n return { theme: `${selectedTheme}-${selectedMode}` };\n }, [selectedTheme, selectedMode, activeTheme]);\n\n return (\n <HvVizContext.Provider value={value}>{children}</HvVizContext.Provider>\n );\n};\n"],"names":[
|
|
1
|
+
{"version":3,"file":"Provider.js","sources":["../../../src/providers/Provider.tsx"],"sourcesContent":["import { createContext, useMemo } from \"react\";\n\nimport { useTheme } from \"@hitachivantara/uikit-react-core\";\n\nimport { registerTheme } from \"@viz/utils\";\n\nexport interface HvVizContextValue {\n /**\n * Current theme\n */\n theme?: string;\n}\n\nexport const HvVizContext = createContext<HvVizContextValue>({\n theme: undefined,\n});\n\nexport interface HvVizProviderProps {\n /**\n * Component tree.\n */\n children?: React.ReactNode;\n}\n\n/**\n * Enables theming capabilities for visualizations.\n *\n * Without this provider the visualizations will not comply to the UI Kit themes.\n *\n * This provider should always be used in combination with the `HvProvider` from\n * the core package since the former uses the themes provided by the latter.\n *\n * `HvVizProvider` should always be used after `HvProvider` like so to work properly:\n *\n * ```\n * <HvProvider>\n * <HvVizProvider>\n * (...)\n * </HvVizProvider>\n * </HvProvider>\n * ```\n */\nexport const HvVizProvider = ({ children }: HvVizProviderProps) => {\n const { activeTheme, selectedMode, selectedTheme } = useTheme();\n\n const value = useMemo(() => {\n registerTheme(selectedTheme, selectedMode, activeTheme);\n\n return { theme: `${selectedTheme}-${selectedMode}` };\n }, [selectedTheme, selectedMode, activeTheme]);\n\n return (\n <HvVizContext.Provider value={value}>{children}</HvVizContext.Provider>\n );\n};\n"],"names":[],"mappings":";;;;AAaO,MAAM,eAAe,cAAiC;AAAA,EAC3D,OAAO;AACT,CAAC;AA2BM,MAAM,gBAAgB,CAAC,EAAE,eAAmC;AACjE,QAAM,EAAE,aAAa,cAAc,kBAAkB,SAAS;AAExD,QAAA,QAAQ,QAAQ,MAAM;AACZ,kBAAA,eAAe,cAAc,WAAW;AAEtD,WAAO,EAAE,OAAO,GAAG,aAAa,IAAI,YAAY;EAC/C,GAAA,CAAC,eAAe,cAAc,WAAW,CAAC;AAE7C,SACG,oBAAA,aAAa,UAAb,EAAsB,OAAe,SAAS,CAAA;AAEnD;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAgFunc.js","sources":["../../../src/utils/getAgFunc.ts"],"sourcesContent":["import { HvChartAggregation } from \"@viz/types\";\n\nexport const getAgFunc = (func: HvChartAggregation, field: string) =>\n func === \"count\" ? \"count()\" : `${func}(d[\"${field}\"])`;\n"],"names":[
|
|
1
|
+
{"version":3,"file":"getAgFunc.js","sources":["../../../src/utils/getAgFunc.ts"],"sourcesContent":["import { HvChartAggregation } from \"@viz/types\";\n\nexport const getAgFunc = (func: HvChartAggregation, field: string) =>\n func === \"count\" ? \"count()\" : `${func}(d[\"${field}\"])`;\n"],"names":[],"mappings":"AAEa,MAAA,YAAY,CAAC,MAA0B,UAClD,SAAS,UAAU,YAAY,GAAG,IAAI,OAAO,KAAK;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAxisType.js","sources":["../../../src/utils/getAxisType.ts"],"sourcesContent":["import { HvChartAxisType } from \"@viz/types\";\n\nexport const getAxisType = (type?: HvChartAxisType) => {\n switch (type) {\n case \"categorical\":\n return \"category\";\n case \"time\":\n return \"time\";\n case \"continuous\":\n return \"value\";\n default:\n return undefined;\n }\n};\n"],"names":[
|
|
1
|
+
{"version":3,"file":"getAxisType.js","sources":["../../../src/utils/getAxisType.ts"],"sourcesContent":["import { HvChartAxisType } from \"@viz/types\";\n\nexport const getAxisType = (type?: HvChartAxisType) => {\n switch (type) {\n case \"categorical\":\n return \"category\";\n case \"time\":\n return \"time\";\n case \"continuous\":\n return \"value\";\n default:\n return undefined;\n }\n};\n"],"names":[],"mappings":"AAEa,MAAA,cAAc,CAAC,SAA2B;AACrD,UAAQ,MAAM;AAAA,IACZ,KAAK;AACI,aAAA;AAAA,IACT,KAAK;AACI,aAAA;AAAA,IACT,KAAK;AACI,aAAA;AAAA,IACT;AACS,aAAA;AAAA,EACX;AACF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getGroupKey.js","sources":["../../../src/utils/getGroupKey.ts"],"sourcesContent":["import { HvChartCommonProps } from \"@viz/types/common\";\n\nexport const getGroupKey = (groupBy: HvChartCommonProps[\"groupBy\"]) =>\n Array.isArray(groupBy) ? groupBy.join(\"_\") : groupBy;\n"],"names":[
|
|
1
|
+
{"version":3,"file":"getGroupKey.js","sources":["../../../src/utils/getGroupKey.ts"],"sourcesContent":["import { HvChartCommonProps } from \"@viz/types/common\";\n\nexport const getGroupKey = (groupBy: HvChartCommonProps[\"groupBy\"]) =>\n Array.isArray(groupBy) ? groupBy.join(\"_\") : groupBy;\n"],"names":[],"mappings":"AAEa,MAAA,cAAc,CAAC,YAC1B,MAAM,QAAQ,OAAO,IAAI,QAAQ,KAAK,GAAG,IAAI;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLegendIcon.js","sources":["../../../src/utils/getLegendIcon.ts"],"sourcesContent":["import { HvChartLegendIcon } from \"@viz/types/legend\";\n\nexport const getLegendIcon = (icon: HvChartLegendIcon) => {\n switch (icon) {\n case \"square\":\n return \"path://M0,0L16,0L16,16L0,16L0,0Z\";\n case \"line\":\n default:\n return \"path://M0,0L16,0L16,2L0,2Z\";\n }\n};\n"],"names":[
|
|
1
|
+
{"version":3,"file":"getLegendIcon.js","sources":["../../../src/utils/getLegendIcon.ts"],"sourcesContent":["import { HvChartLegendIcon } from \"@viz/types/legend\";\n\nexport const getLegendIcon = (icon: HvChartLegendIcon) => {\n switch (icon) {\n case \"square\":\n return \"path://M0,0L16,0L16,16L0,16L0,0Z\";\n case \"line\":\n default:\n return \"path://M0,0L16,0L16,2L0,2Z\";\n }\n};\n"],"names":[],"mappings":"AAEa,MAAA,gBAAgB,CAAC,SAA4B;AACxD,UAAQ,MAAM;AAAA,IACZ,KAAK;AACI,aAAA;AAAA,IACT,KAAK;AAAA,IACL;AACS,aAAA;AAAA,EACX;AACF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMeasure.js","sources":["../../../src/utils/getMeasure.ts"],"sourcesContent":["import { Arrayable } from \"@hitachivantara/uikit-react-core\";\n\nimport {\n HvBarChartMeasures,\n HvDonutChartMeasure,\n HvLineChartMeasures,\n} from \"@viz/types\";\n\nexport const getMeasure = (\n name: string,\n msr: Arrayable<HvLineChartMeasures | HvBarChartMeasures> | HvDonutChartMeasure\n): HvLineChartMeasures | HvBarChartMeasures | HvDonutChartMeasure => {\n const measureName = name.split(\"_\")[0];\n const measuresArray = Array.isArray(msr) ? msr : [msr];\n // find the measure in measures array or return the first one\n return (\n measuresArray.find((m) => {\n if (typeof m === \"string\") {\n return m === measureName;\n }\n return m.field === measureName;\n }) ?? measuresArray[0]\n );\n};\n"],"names":[
|
|
1
|
+
{"version":3,"file":"getMeasure.js","sources":["../../../src/utils/getMeasure.ts"],"sourcesContent":["import { Arrayable } from \"@hitachivantara/uikit-react-core\";\n\nimport {\n HvBarChartMeasures,\n HvDonutChartMeasure,\n HvLineChartMeasures,\n} from \"@viz/types\";\n\nexport const getMeasure = (\n name: string,\n msr: Arrayable<HvLineChartMeasures | HvBarChartMeasures> | HvDonutChartMeasure\n): HvLineChartMeasures | HvBarChartMeasures | HvDonutChartMeasure => {\n const measureName = name.split(\"_\")[0];\n const measuresArray = Array.isArray(msr) ? msr : [msr];\n // find the measure in measures array or return the first one\n return (\n measuresArray.find((m) => {\n if (typeof m === \"string\") {\n return m === measureName;\n }\n return m.field === measureName;\n }) ?? measuresArray[0]\n );\n};\n"],"names":[],"mappings":"AAQa,MAAA,aAAa,CACxB,MACA,QACmE;AACnE,QAAM,cAAc,KAAK,MAAM,GAAG,EAAE,CAAC;AACrC,QAAM,gBAAgB,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,GAAG;AAGnD,SAAA,cAAc,KAAK,CAAC,MAAM;AACpB,QAAA,OAAO,MAAM,UAAU;AACzB,aAAO,MAAM;AAAA,IACf;AACA,WAAO,EAAE,UAAU;AAAA,EAAA,CACpB,KAAK,cAAc,CAAC;AAEzB;"}
|
|
@@ -37,7 +37,20 @@ const registerTheme = (name, mode, themeStructure) => {
|
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
echarts.registerTheme(`${name}-${mode}`, {
|
|
40
|
-
color: [
|
|
40
|
+
color: [
|
|
41
|
+
themeStructure?.colors.modes[mode].cat1,
|
|
42
|
+
themeStructure?.colors.modes[mode].cat2,
|
|
43
|
+
themeStructure?.colors.modes[mode].cat3,
|
|
44
|
+
themeStructure?.colors.modes[mode].cat4,
|
|
45
|
+
themeStructure?.colors.modes[mode].cat5,
|
|
46
|
+
themeStructure?.colors.modes[mode].cat6,
|
|
47
|
+
themeStructure?.colors.modes[mode].cat7,
|
|
48
|
+
themeStructure?.colors.modes[mode].cat8,
|
|
49
|
+
themeStructure?.colors.modes[mode].cat9,
|
|
50
|
+
themeStructure?.colors.modes[mode].cat10,
|
|
51
|
+
themeStructure?.colors.modes[mode].cat11,
|
|
52
|
+
themeStructure?.colors.modes[mode].cat12
|
|
53
|
+
],
|
|
41
54
|
legend: {
|
|
42
55
|
textStyle: {
|
|
43
56
|
...baseText
|
|
@@ -57,9 +70,7 @@ const registerTheme = (name, mode, themeStructure) => {
|
|
|
57
70
|
}
|
|
58
71
|
},
|
|
59
72
|
dataZoom: {
|
|
60
|
-
textStyle: {
|
|
61
|
-
...baseText
|
|
62
|
-
}
|
|
73
|
+
textStyle: { ...baseText }
|
|
63
74
|
},
|
|
64
75
|
categoryAxis: {
|
|
65
76
|
...customAxis
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registerTheme.js","sources":["../../../src/utils/registerTheme.ts"],"sourcesContent":["import { HvTheme } from \"@hitachivantara/uikit-react-core\";\nimport * as echarts from \"echarts/core\";\n\nexport const registerTheme = (\n name: string,\n mode: string,\n themeStructure?: HvTheme\n) => {\n const baseText = {\n color: themeStructure?.colors.modes[mode].secondary,\n fontWeight: themeStructure?.fontWeights.normal,\n fontSize: themeStructure?.fontSizes.sm,\n fontFamily: themeStructure?.fontFamily.body,\n };\n\n const customAxis = {\n nameTextStyle: {\n ...baseText,\n color: themeStructure?.colors.modes[mode].secondary_80,\n },\n axisLine: {\n show: true,\n lineStyle: {\n color: themeStructure?.colors.modes[mode].atmo3,\n },\n },\n axisTick: {\n show: true,\n lineStyle: {\n color: themeStructure?.colors.modes[mode].atmo3,\n },\n },\n axisLabel: {\n color: themeStructure?.colors.modes[mode].secondary_80,\n fontWeight: themeStructure?.fontWeights.normal,\n fontSize: themeStructure?.fontSizes.sm,\n fontFamily: themeStructure?.fontFamily.body,\n },\n splitLine: {\n show: true,\n lineStyle: {\n color: themeStructure?.colors.modes[mode].atmo3,\n },\n },\n };\n\n echarts.registerTheme(`${name}-${mode}`, {\n color: [\n themeStructure?.colors.modes[mode].cat1,\n themeStructure?.colors.modes[mode].cat2,\n themeStructure?.colors.modes[mode].cat3,\n themeStructure?.colors.modes[mode].cat4,\n themeStructure?.colors.modes[mode].cat5,\n themeStructure?.colors.modes[mode].cat6,\n themeStructure?.colors.modes[mode].cat7,\n themeStructure?.colors.modes[mode].cat8,\n themeStructure?.colors.modes[mode].cat9,\n themeStructure?.colors.modes[mode].cat10,\n themeStructure?.colors.modes[mode].cat11,\n themeStructure?.colors.modes[mode].cat12,\n ],\n legend: {\n textStyle: {\n ...baseText,\n },\n },\n tooltip: {\n borderWidth: 0,\n padding: 0,\n textStyle: {\n ...baseText,\n },\n axisPointer: {\n lineStyle: {\n color: themeStructure?.colors.modes[mode].secondary,\n width: 1,\n },\n },\n },\n dataZoom: {\n textStyle: { ...baseText },\n },\n categoryAxis: {\n ...customAxis,\n },\n valueAxis: {\n ...customAxis,\n },\n logAxis: {\n ...customAxis,\n },\n timeAxis: {\n ...customAxis,\n },\n line: {\n lineStyle: {\n width: 2,\n },\n },\n visualMap: {\n textStyle: {\n ...baseText,\n },\n },\n heatmap: {\n label: {\n fontWeight: baseText.fontWeight,\n fontSize: baseText.fontSize,\n fontFamily: baseText.fontFamily,\n },\n itemStyle: {\n borderColor: themeStructure?.colors.modes[mode].atmo3,\n borderWidth: 1,\n },\n },\n });\n};\n"],"names":[
|
|
1
|
+
{"version":3,"file":"registerTheme.js","sources":["../../../src/utils/registerTheme.ts"],"sourcesContent":["import { HvTheme } from \"@hitachivantara/uikit-react-core\";\nimport * as echarts from \"echarts/core\";\n\nexport const registerTheme = (\n name: string,\n mode: string,\n themeStructure?: HvTheme\n) => {\n const baseText = {\n color: themeStructure?.colors.modes[mode].secondary,\n fontWeight: themeStructure?.fontWeights.normal,\n fontSize: themeStructure?.fontSizes.sm,\n fontFamily: themeStructure?.fontFamily.body,\n };\n\n const customAxis = {\n nameTextStyle: {\n ...baseText,\n color: themeStructure?.colors.modes[mode].secondary_80,\n },\n axisLine: {\n show: true,\n lineStyle: {\n color: themeStructure?.colors.modes[mode].atmo3,\n },\n },\n axisTick: {\n show: true,\n lineStyle: {\n color: themeStructure?.colors.modes[mode].atmo3,\n },\n },\n axisLabel: {\n color: themeStructure?.colors.modes[mode].secondary_80,\n fontWeight: themeStructure?.fontWeights.normal,\n fontSize: themeStructure?.fontSizes.sm,\n fontFamily: themeStructure?.fontFamily.body,\n },\n splitLine: {\n show: true,\n lineStyle: {\n color: themeStructure?.colors.modes[mode].atmo3,\n },\n },\n };\n\n echarts.registerTheme(`${name}-${mode}`, {\n color: [\n themeStructure?.colors.modes[mode].cat1,\n themeStructure?.colors.modes[mode].cat2,\n themeStructure?.colors.modes[mode].cat3,\n themeStructure?.colors.modes[mode].cat4,\n themeStructure?.colors.modes[mode].cat5,\n themeStructure?.colors.modes[mode].cat6,\n themeStructure?.colors.modes[mode].cat7,\n themeStructure?.colors.modes[mode].cat8,\n themeStructure?.colors.modes[mode].cat9,\n themeStructure?.colors.modes[mode].cat10,\n themeStructure?.colors.modes[mode].cat11,\n themeStructure?.colors.modes[mode].cat12,\n ],\n legend: {\n textStyle: {\n ...baseText,\n },\n },\n tooltip: {\n borderWidth: 0,\n padding: 0,\n textStyle: {\n ...baseText,\n },\n axisPointer: {\n lineStyle: {\n color: themeStructure?.colors.modes[mode].secondary,\n width: 1,\n },\n },\n },\n dataZoom: {\n textStyle: { ...baseText },\n },\n categoryAxis: {\n ...customAxis,\n },\n valueAxis: {\n ...customAxis,\n },\n logAxis: {\n ...customAxis,\n },\n timeAxis: {\n ...customAxis,\n },\n line: {\n lineStyle: {\n width: 2,\n },\n },\n visualMap: {\n textStyle: {\n ...baseText,\n },\n },\n heatmap: {\n label: {\n fontWeight: baseText.fontWeight,\n fontSize: baseText.fontSize,\n fontFamily: baseText.fontFamily,\n },\n itemStyle: {\n borderColor: themeStructure?.colors.modes[mode].atmo3,\n borderWidth: 1,\n },\n },\n });\n};\n"],"names":[],"mappings":";AAGO,MAAM,gBAAgB,CAC3B,MACA,MACA,mBACG;AACH,QAAM,WAAW;AAAA,IACf,OAAO,gBAAgB,OAAO,MAAM,IAAI,EAAE;AAAA,IAC1C,YAAY,gBAAgB,YAAY;AAAA,IACxC,UAAU,gBAAgB,UAAU;AAAA,IACpC,YAAY,gBAAgB,WAAW;AAAA,EAAA;AAGzC,QAAM,aAAa;AAAA,IACjB,eAAe;AAAA,MACb,GAAG;AAAA,MACH,OAAO,gBAAgB,OAAO,MAAM,IAAI,EAAE;AAAA,IAC5C;AAAA,IACA,UAAU;AAAA,MACR,MAAM;AAAA,MACN,WAAW;AAAA,QACT,OAAO,gBAAgB,OAAO,MAAM,IAAI,EAAE;AAAA,MAC5C;AAAA,IACF;AAAA,IACA,UAAU;AAAA,MACR,MAAM;AAAA,MACN,WAAW;AAAA,QACT,OAAO,gBAAgB,OAAO,MAAM,IAAI,EAAE;AAAA,MAC5C;AAAA,IACF;AAAA,IACA,WAAW;AAAA,MACT,OAAO,gBAAgB,OAAO,MAAM,IAAI,EAAE;AAAA,MAC1C,YAAY,gBAAgB,YAAY;AAAA,MACxC,UAAU,gBAAgB,UAAU;AAAA,MACpC,YAAY,gBAAgB,WAAW;AAAA,IACzC;AAAA,IACA,WAAW;AAAA,MACT,MAAM;AAAA,MACN,WAAW;AAAA,QACT,OAAO,gBAAgB,OAAO,MAAM,IAAI,EAAE;AAAA,MAC5C;AAAA,IACF;AAAA,EAAA;AAGF,UAAQ,cAAc,GAAG,IAAI,IAAI,IAAI,IAAI;AAAA,IACvC,OAAO;AAAA,MACL,gBAAgB,OAAO,MAAM,IAAI,EAAE;AAAA,MACnC,gBAAgB,OAAO,MAAM,IAAI,EAAE;AAAA,MACnC,gBAAgB,OAAO,MAAM,IAAI,EAAE;AAAA,MACnC,gBAAgB,OAAO,MAAM,IAAI,EAAE;AAAA,MACnC,gBAAgB,OAAO,MAAM,IAAI,EAAE;AAAA,MACnC,gBAAgB,OAAO,MAAM,IAAI,EAAE;AAAA,MACnC,gBAAgB,OAAO,MAAM,IAAI,EAAE;AAAA,MACnC,gBAAgB,OAAO,MAAM,IAAI,EAAE;AAAA,MACnC,gBAAgB,OAAO,MAAM,IAAI,EAAE;AAAA,MACnC,gBAAgB,OAAO,MAAM,IAAI,EAAE;AAAA,MACnC,gBAAgB,OAAO,MAAM,IAAI,EAAE;AAAA,MACnC,gBAAgB,OAAO,MAAM,IAAI,EAAE;AAAA,IACrC;AAAA,IACA,QAAQ;AAAA,MACN,WAAW;AAAA,QACT,GAAG;AAAA,MACL;AAAA,IACF;AAAA,IACA,SAAS;AAAA,MACP,aAAa;AAAA,MACb,SAAS;AAAA,MACT,WAAW;AAAA,QACT,GAAG;AAAA,MACL;AAAA,MACA,aAAa;AAAA,QACX,WAAW;AAAA,UACT,OAAO,gBAAgB,OAAO,MAAM,IAAI,EAAE;AAAA,UAC1C,OAAO;AAAA,QACT;AAAA,MACF;AAAA,IACF;AAAA,IACA,UAAU;AAAA,MACR,WAAW,EAAE,GAAG,SAAS;AAAA,IAC3B;AAAA,IACA,cAAc;AAAA,MACZ,GAAG;AAAA,IACL;AAAA,IACA,WAAW;AAAA,MACT,GAAG;AAAA,IACL;AAAA,IACA,SAAS;AAAA,MACP,GAAG;AAAA,IACL;AAAA,IACA,UAAU;AAAA,MACR,GAAG;AAAA,IACL;AAAA,IACA,MAAM;AAAA,MACJ,WAAW;AAAA,QACT,OAAO;AAAA,MACT;AAAA,IACF;AAAA,IACA,WAAW;AAAA,MACT,WAAW;AAAA,QACT,GAAG;AAAA,MACL;AAAA,IACF;AAAA,IACA,SAAS;AAAA,MACP,OAAO;AAAA,QACL,YAAY,SAAS;AAAA,QACrB,UAAU,SAAS;AAAA,QACnB,YAAY,SAAS;AAAA,MACvB;AAAA,MACA,WAAW;AAAA,QACT,aAAa,gBAAgB,OAAO,MAAM,IAAI,EAAE;AAAA,QAChD,aAAa;AAAA,MACf;AAAA,IACF;AAAA,EAAA,CACD;AACH;"}
|