@fluentui/react-charting 5.23.25 → 5.23.26
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/CHANGELOG.json +22 -1
- package/CHANGELOG.md +12 -2
- package/dist/react-charting.d.ts +4 -10
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +1 -5
- package/lib/components/DeclarativeChart/DeclarativeChart.d.ts +4 -10
- package/lib/components/DeclarativeChart/DeclarativeChart.js +26 -17
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +0 -4
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +14 -5
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib/components/Legends/Legends.base.d.ts +0 -5
- package/lib/components/Legends/Legends.base.js +1 -12
- package/lib/components/Legends/Legends.base.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.d.ts +4 -10
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +27 -18
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +0 -4
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +14 -5
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib-amd/components/Legends/Legends.base.d.ts +0 -5
- package/lib-amd/components/Legends/Legends.base.js +1 -12
- package/lib-amd/components/Legends/Legends.base.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.d.ts +4 -10
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +27 -18
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +0 -4
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +14 -5
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib-commonjs/components/Legends/Legends.base.d.ts +0 -5
- package/lib-commonjs/components/Legends/Legends.base.js +1 -12
- package/lib-commonjs/components/Legends/Legends.base.js.map +1 -1
- package/package.json +1 -1
|
@@ -1603,13 +1603,9 @@ export const PieChart: React_2.FunctionComponent<IPieChartProps>;
|
|
|
1603
1603
|
// @public
|
|
1604
1604
|
export const SankeyChart: React_2.FunctionComponent<ISankeyChartProps>;
|
|
1605
1605
|
|
|
1606
|
-
// @public
|
|
1606
|
+
// @public
|
|
1607
1607
|
export interface Schema {
|
|
1608
|
-
accesibilityLabels?: {
|
|
1609
|
-
[key: string]: string;
|
|
1610
|
-
};
|
|
1611
1608
|
plotlySchema: any;
|
|
1612
|
-
selectedLegends?: string[];
|
|
1613
1609
|
}
|
|
1614
1610
|
|
|
1615
1611
|
// @public (undocumented)
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
export declare const UseIsDarkTheme: () => boolean;
|
|
3
|
+
/**
|
|
4
|
+
* DeclarativeChart schema.
|
|
5
|
+
* {@docCategory DeclarativeChart}
|
|
6
|
+
*/
|
|
3
7
|
export interface Schema {
|
|
4
8
|
/**
|
|
5
9
|
* Plotly schema represented as JSON object
|
|
6
10
|
*/
|
|
7
11
|
plotlySchema: any;
|
|
8
|
-
/**
|
|
9
|
-
* The legends selected by the user to persist in the chart
|
|
10
|
-
*/
|
|
11
|
-
selectedLegends?: string[];
|
|
12
|
-
/**
|
|
13
|
-
* Dictionary for localizing the accessibility labels
|
|
14
|
-
*/
|
|
15
|
-
accesibilityLabels?: {
|
|
16
|
-
[key: string]: string;
|
|
17
|
-
};
|
|
18
12
|
}
|
|
19
13
|
/**
|
|
20
14
|
* DeclarativeChart props.
|
|
@@ -13,7 +13,7 @@ import { SankeyChart } from '../SankeyChart/SankeyChart';
|
|
|
13
13
|
import { GaugeChart } from '../GaugeChart/index';
|
|
14
14
|
import { GroupedVerticalBarChart } from '../GroupedVerticalBarChart/index';
|
|
15
15
|
import { VerticalBarChart } from '../VerticalBarChart/index';
|
|
16
|
-
import { useTheme } from '@fluentui/react';
|
|
16
|
+
import { useTheme } from '@fluentui/react/lib/Theme';
|
|
17
17
|
export var UseIsDarkTheme = function () {
|
|
18
18
|
var _a;
|
|
19
19
|
var theme = useTheme();
|
|
@@ -28,47 +28,56 @@ var useColorMapping = function () {
|
|
|
28
28
|
* {@docCategory DeclarativeChart}
|
|
29
29
|
*/
|
|
30
30
|
export var DeclarativeChart = React.forwardRef(function (props, forwardedRef) {
|
|
31
|
-
var _a, _b, _c
|
|
31
|
+
var _a, _b, _c;
|
|
32
32
|
var plotlySchema = props.chartSchema.plotlySchema;
|
|
33
|
-
var
|
|
33
|
+
var data = plotlySchema.data, layout = plotlySchema.layout, selectedLegends = plotlySchema.selectedLegends;
|
|
34
|
+
var xValues = data[0].x;
|
|
34
35
|
var isXDate = isDateArray(xValues);
|
|
35
36
|
var isXNumber = isNumberArray(xValues);
|
|
36
37
|
var colorMap = useColorMapping();
|
|
37
38
|
var isDarkTheme = UseIsDarkTheme();
|
|
38
|
-
|
|
39
|
+
var _d = React.useState(selectedLegends !== null && selectedLegends !== void 0 ? selectedLegends : []), activeLegends = _d[0], setActiveLegends = _d[1];
|
|
40
|
+
var onActiveLegendsChange = function (keys) {
|
|
41
|
+
setActiveLegends(keys);
|
|
42
|
+
if (props.onSchemaChange) {
|
|
43
|
+
props.onSchemaChange({ plotlySchema: { data: data, layout: layout, selectedLegends: keys } });
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
var legendProps = __assign({ canSelectMultipleLegends: false, onChange: onActiveLegendsChange }, (activeLegends.length > 0 && { selectedLegend: activeLegends[0] }));
|
|
47
|
+
switch (data[0].type) {
|
|
39
48
|
case 'pie':
|
|
40
|
-
return React.createElement(DonutChart, __assign({}, transformPlotlyJsonToDonutProps(plotlySchema, colorMap, isDarkTheme)));
|
|
49
|
+
return (React.createElement(DonutChart, __assign({}, transformPlotlyJsonToDonutProps(plotlySchema, colorMap, isDarkTheme), { legendProps: legendProps })));
|
|
41
50
|
case 'bar':
|
|
42
|
-
var orientation_1 =
|
|
51
|
+
var orientation_1 = data[0].orientation;
|
|
43
52
|
if (orientation_1 === 'h') {
|
|
44
|
-
return (React.createElement(HorizontalBarChartWithAxis, __assign({}, transformPlotlyJsonToHorizontalBarWithAxisProps(plotlySchema, colorMap, isDarkTheme))));
|
|
53
|
+
return (React.createElement(HorizontalBarChartWithAxis, __assign({}, transformPlotlyJsonToHorizontalBarWithAxisProps(plotlySchema, colorMap, isDarkTheme), { legendProps: legendProps })));
|
|
45
54
|
}
|
|
46
55
|
else {
|
|
47
56
|
if (['group', 'overlay'].includes((_a = plotlySchema === null || plotlySchema === void 0 ? void 0 : plotlySchema.layout) === null || _a === void 0 ? void 0 : _a.barmode)) {
|
|
48
|
-
return React.createElement(GroupedVerticalBarChart, __assign({}, transformPlotlyJsonToGVBCProps(plotlySchema, colorMap, isDarkTheme)));
|
|
57
|
+
return (React.createElement(GroupedVerticalBarChart, __assign({}, transformPlotlyJsonToGVBCProps(plotlySchema, colorMap, isDarkTheme), { legendProps: legendProps })));
|
|
49
58
|
}
|
|
50
|
-
return React.createElement(VerticalStackedBarChart, __assign({}, transformPlotlyJsonToVSBCProps(plotlySchema, colorMap, isDarkTheme)));
|
|
59
|
+
return (React.createElement(VerticalStackedBarChart, __assign({}, transformPlotlyJsonToVSBCProps(plotlySchema, colorMap, isDarkTheme), { legendProps: legendProps })));
|
|
51
60
|
}
|
|
52
61
|
case 'scatter':
|
|
53
|
-
var isAreaChart =
|
|
62
|
+
var isAreaChart = data.some(function (series) { return series.fill === 'tonexty'; });
|
|
54
63
|
if (isXDate || isXNumber) {
|
|
55
64
|
if (isAreaChart) {
|
|
56
|
-
return React.createElement(AreaChart, __assign({}, transformPlotlyJsonToScatterChartProps(
|
|
65
|
+
return (React.createElement(AreaChart, __assign({}, transformPlotlyJsonToScatterChartProps({ data: data, layout: layout }, true, colorMap, isDarkTheme), { legendProps: legendProps })));
|
|
57
66
|
}
|
|
58
|
-
return React.createElement(LineChart, __assign({}, transformPlotlyJsonToScatterChartProps(
|
|
67
|
+
return (React.createElement(LineChart, __assign({}, transformPlotlyJsonToScatterChartProps({ data: data, layout: layout }, false, colorMap, isDarkTheme), { legendProps: legendProps })));
|
|
59
68
|
}
|
|
60
|
-
return React.createElement(VerticalStackedBarChart, __assign({}, transformPlotlyJsonToVSBCProps(plotlySchema, colorMap, isDarkTheme)));
|
|
69
|
+
return (React.createElement(VerticalStackedBarChart, __assign({}, transformPlotlyJsonToVSBCProps(plotlySchema, colorMap, isDarkTheme), { legendProps: legendProps })));
|
|
61
70
|
case 'heatmap':
|
|
62
|
-
return React.createElement(HeatMapChart, __assign({}, transformPlotlyJsonToHeatmapProps(plotlySchema)));
|
|
71
|
+
return React.createElement(HeatMapChart, __assign({}, transformPlotlyJsonToHeatmapProps(plotlySchema), { legendProps: legendProps }));
|
|
63
72
|
case 'sankey':
|
|
64
73
|
return React.createElement(SankeyChart, __assign({}, transformPlotlyJsonToSankeyProps(plotlySchema, colorMap, isDarkTheme)));
|
|
65
74
|
case 'indicator':
|
|
66
|
-
if ((
|
|
67
|
-
return React.createElement(GaugeChart, __assign({}, transformPlotlyJsonToGaugeProps(plotlySchema, colorMap, isDarkTheme)));
|
|
75
|
+
if ((_c = (_b = data === null || data === void 0 ? void 0 : data[0]) === null || _b === void 0 ? void 0 : _b.mode) === null || _c === void 0 ? void 0 : _c.includes('gauge')) {
|
|
76
|
+
return (React.createElement(GaugeChart, __assign({}, transformPlotlyJsonToGaugeProps(plotlySchema, colorMap, isDarkTheme), { legendProps: legendProps })));
|
|
68
77
|
}
|
|
69
78
|
return React.createElement("div", null, "Unsupported Schema");
|
|
70
79
|
case 'histogram':
|
|
71
|
-
return React.createElement(VerticalBarChart, __assign({}, transformPlotlyJsonToVBCProps(plotlySchema, colorMap, isDarkTheme)));
|
|
80
|
+
return (React.createElement(VerticalBarChart, __assign({}, transformPlotlyJsonToVBCProps(plotlySchema, colorMap, isDarkTheme), { legendProps: legendProps })));
|
|
72
81
|
default:
|
|
73
82
|
return React.createElement("div", null, "Unsupported Schema");
|
|
74
83
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeclarativeChart.js","sourceRoot":"../src/","sources":["components/DeclarativeChart/DeclarativeChart.tsx"],"names":[],"mappings":";AAAA,yDAAyD;AACzD,uDAAuD;AACvD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EACL,+BAA+B,EAC/B,8BAA8B,EAC9B,sCAAsC,EACtC,+CAA+C,EAC/C,WAAW,EACX,aAAa,EACb,iCAAiC,EACjC,gCAAgC,EAChC,+BAA+B,EAC/B,8BAA8B,EAC9B,6BAA6B,GAC9B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,uB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AA,MAAA,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,IAAI,0CAAG,CAAC,CAAC,0CAAE,IAAI,0CAAE,QAAQ,CAAC,OAAO,CAAC,EAAE;gBACpD,OAAO,oBAAC,UAAU,eAAK,+BAA+B,CAAC,YAAY,EAAE,QAAQ,EAAE,WAAW,CAAC,EAAI,CAAC;aACjG;YACD,OAAO,sDAA6B,CAAC;QACvC,KAAK,WAAW;YACd,OAAO,oBAAC,gBAAgB,eAAK,6BAA6B,CAAC,YAAY,EAAE,QAAQ,EAAE,WAAW,CAAC,EAAI,CAAC;QACtG;YACE,OAAO,sDAA6B,CAAC;KACxC;AACH,CAAC,CAAC,CAAC;AACH,gBAAgB,CAAC,WAAW,GAAG,kBAAkB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as React from 'react';\nimport { DonutChart } from '../DonutChart/index';\nimport { VerticalStackedBarChart } from '../VerticalStackedBarChart/index';\nimport {\n transformPlotlyJsonToDonutProps,\n transformPlotlyJsonToVSBCProps,\n transformPlotlyJsonToScatterChartProps,\n transformPlotlyJsonToHorizontalBarWithAxisProps,\n isDateArray,\n isNumberArray,\n transformPlotlyJsonToHeatmapProps,\n transformPlotlyJsonToSankeyProps,\n transformPlotlyJsonToGaugeProps,\n transformPlotlyJsonToGVBCProps,\n transformPlotlyJsonToVBCProps,\n} from './PlotlySchemaAdapter';\nimport { LineChart } from '../LineChart/index';\nimport { HorizontalBarChartWithAxis } from '../HorizontalBarChartWithAxis/index';\nimport { AreaChart } from '../AreaChart/index';\nimport { HeatMapChart } from '../HeatMapChart/index';\nimport { SankeyChart } from '../SankeyChart/SankeyChart';\nimport { GaugeChart } from '../GaugeChart/index';\nimport { GroupedVerticalBarChart } from '../GroupedVerticalBarChart/index';\nimport { VerticalBarChart } from '../VerticalBarChart/index';\n\nimport { useTheme } from '@fluentui/react';\n\nexport const UseIsDarkTheme = (): boolean => {\n const theme = useTheme();\n return theme?.isInverted ?? false;\n};\n\nexport interface Schema {\n /**\n * Plotly schema represented as JSON object\n */\n plotlySchema: any;\n\n /**\n * The legends selected by the user to persist in the chart\n */\n selectedLegends?: string[];\n\n /**\n * Dictionary for localizing the accessibility labels\n */\n accesibilityLabels?: { [key: string]: string };\n}\n\n/**\n * DeclarativeChart props.\n * {@docCategory DeclarativeChart}\n */\nexport interface DeclarativeChartProps extends React.RefAttributes<HTMLDivElement> {\n /**\n * The schema representing the chart data, layout and configuration\n */\n chartSchema: Schema;\n\n /**\n * Callback when an event occurs\n */\n onSchemaChange?: (eventData: Schema) => void;\n}\n\nconst useColorMapping = () => {\n const colorMap = React.useRef(new Map<string, string>());\n return colorMap;\n};\n\n/**\n * DeclarativeChart component.\n * {@docCategory DeclarativeChart}\n */\nexport const DeclarativeChart: React.FunctionComponent<DeclarativeChartProps> = React.forwardRef<\n HTMLDivElement,\n DeclarativeChartProps\n>((props, forwardedRef) => {\n const { plotlySchema } = props.chartSchema;\n const xValues = plotlySchema.data[0].x;\n const isXDate = isDateArray(xValues);\n const isXNumber = isNumberArray(xValues);\n const colorMap = useColorMapping();\n const isDarkTheme = UseIsDarkTheme();\n\n switch (plotlySchema.data[0].type) {\n case 'pie':\n return <DonutChart {...transformPlotlyJsonToDonutProps(plotlySchema, colorMap, isDarkTheme)} />;\n case 'bar':\n const orientation = plotlySchema.data[0].orientation;\n if (orientation === 'h') {\n return (\n <HorizontalBarChartWithAxis\n {...transformPlotlyJsonToHorizontalBarWithAxisProps(plotlySchema, colorMap, isDarkTheme)}\n />\n );\n } else {\n if (['group', 'overlay'].includes(plotlySchema?.layout?.barmode)) {\n return <GroupedVerticalBarChart {...transformPlotlyJsonToGVBCProps(plotlySchema, colorMap, isDarkTheme)} />;\n }\n return <VerticalStackedBarChart {...transformPlotlyJsonToVSBCProps(plotlySchema, colorMap, isDarkTheme)} />;\n }\n case 'scatter':\n const isAreaChart = plotlySchema.data.some((series: any) => series.fill === 'tonexty');\n if (isXDate || isXNumber) {\n if (isAreaChart) {\n return <AreaChart {...transformPlotlyJsonToScatterChartProps(plotlySchema, true, colorMap, isDarkTheme)} />;\n }\n return <LineChart {...transformPlotlyJsonToScatterChartProps(plotlySchema, false, colorMap, isDarkTheme)} />;\n }\n return <VerticalStackedBarChart {...transformPlotlyJsonToVSBCProps(plotlySchema, colorMap, isDarkTheme)} />;\n case 'heatmap':\n return <HeatMapChart {...transformPlotlyJsonToHeatmapProps(plotlySchema)} />;\n case 'sankey':\n return <SankeyChart {...transformPlotlyJsonToSankeyProps(plotlySchema, colorMap, isDarkTheme)} />;\n case 'indicator':\n if (plotlySchema?.data?.[0]?.mode?.includes('gauge')) {\n return <GaugeChart {...transformPlotlyJsonToGaugeProps(plotlySchema, colorMap, isDarkTheme)} />;\n }\n return <div>Unsupported Schema</div>;\n case 'histogram':\n return <VerticalBarChart {...transformPlotlyJsonToVBCProps(plotlySchema, colorMap, isDarkTheme)} />;\n default:\n return <div>Unsupported Schema</div>;\n }\n});\nDeclarativeChart.displayName = 'DeclarativeChart';\n"]}
|
|
1
|
+
{"version":3,"file":"DeclarativeChart.js","sourceRoot":"../src/","sources":["components/DeclarativeChart/DeclarativeChart.tsx"],"names":[],"mappings":";AAAA,yDAAyD;AACzD,uDAAuD;AACvD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EACL,+BAA+B,EAC/B,8BAA8B,EAC9B,sCAAsC,EACtC,+CAA+C,EAC/C,WAAW,EACX,aAAa,EACb,iCAAiC,EACjC,gCAAgC,EAChC,+BAA+B,EAC/B,8BAA8B,EAC9B,6BAA6B,GAC9B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,0BAA0B,EAAE,M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AAJ,IAAI,uBAAJ,IAAI,CAAG,CAAC,CAAC,0CAAE,IAAI,0CAAE,QAAQ,CAAC,OAAO,CAAC,EAAE;gBACtC,OAAO,CACL,oBAAC,UAAU,eACL,+BAA+B,CAAC,YAAY,EAAE,QAAQ,EAAE,WAAW,CAAC,IACxE,WAAW,EAAE,WAAW,IACxB,CACH,CAAC;aACH;YACD,OAAO,sDAA6B,CAAC;QACvC,KAAK,WAAW;YACd,OAAO,CACL,oBAAC,gBAAgB,eACX,6BAA6B,CAAC,YAAY,EAAE,QAAQ,EAAE,WAAW,CAAC,IACtE,WAAW,EAAE,WAAW,IACxB,CACH,CAAC;QACJ;YACE,OAAO,sDAA6B,CAAC;KACxC;AACH,CAAC,CAAC,CAAC;AACH,gBAAgB,CAAC,WAAW,GAAG,kBAAkB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as React from 'react';\nimport { DonutChart } from '../DonutChart/index';\nimport { VerticalStackedBarChart } from '../VerticalStackedBarChart/index';\nimport {\n transformPlotlyJsonToDonutProps,\n transformPlotlyJsonToVSBCProps,\n transformPlotlyJsonToScatterChartProps,\n transformPlotlyJsonToHorizontalBarWithAxisProps,\n isDateArray,\n isNumberArray,\n transformPlotlyJsonToHeatmapProps,\n transformPlotlyJsonToSankeyProps,\n transformPlotlyJsonToGaugeProps,\n transformPlotlyJsonToGVBCProps,\n transformPlotlyJsonToVBCProps,\n} from './PlotlySchemaAdapter';\nimport { LineChart } from '../LineChart/index';\nimport { HorizontalBarChartWithAxis } from '../HorizontalBarChartWithAxis/index';\nimport { AreaChart } from '../AreaChart/index';\nimport { HeatMapChart } from '../HeatMapChart/index';\nimport { SankeyChart } from '../SankeyChart/SankeyChart';\nimport { GaugeChart } from '../GaugeChart/index';\nimport { GroupedVerticalBarChart } from '../GroupedVerticalBarChart/index';\nimport { VerticalBarChart } from '../VerticalBarChart/index';\nimport { useTheme } from '@fluentui/react/lib/Theme';\n\nexport const UseIsDarkTheme = (): boolean => {\n const theme = useTheme();\n return theme?.isInverted ?? false;\n};\n\n/**\n * DeclarativeChart schema.\n * {@docCategory DeclarativeChart}\n */\nexport interface Schema {\n /**\n * Plotly schema represented as JSON object\n */\n plotlySchema: any;\n}\n\n/**\n * DeclarativeChart props.\n * {@docCategory DeclarativeChart}\n */\nexport interface DeclarativeChartProps extends React.RefAttributes<HTMLDivElement> {\n /**\n * The schema representing the chart data, layout and configuration\n */\n chartSchema: Schema;\n\n /**\n * Callback when an event occurs\n */\n onSchemaChange?: (eventData: Schema) => void;\n}\n\nconst useColorMapping = () => {\n const colorMap = React.useRef(new Map<string, string>());\n return colorMap;\n};\n\n/**\n * DeclarativeChart component.\n * {@docCategory DeclarativeChart}\n */\nexport const DeclarativeChart: React.FunctionComponent<DeclarativeChartProps> = React.forwardRef<\n HTMLDivElement,\n DeclarativeChartProps\n>((props, forwardedRef) => {\n const { plotlySchema } = props.chartSchema;\n const { data, layout, selectedLegends } = plotlySchema;\n const xValues = data[0].x;\n const isXDate = isDateArray(xValues);\n const isXNumber = isNumberArray(xValues);\n const colorMap = useColorMapping();\n const isDarkTheme = UseIsDarkTheme();\n\n const [activeLegends, setActiveLegends] = React.useState<string[]>(selectedLegends ?? []);\n const onActiveLegendsChange = (keys: string[]) => {\n setActiveLegends(keys);\n if (props.onSchemaChange) {\n props.onSchemaChange({ plotlySchema: { data, layout, selectedLegends: keys } });\n }\n };\n\n const legendProps = {\n canSelectMultipleLegends: false,\n onChange: onActiveLegendsChange,\n ...(activeLegends.length > 0 && { selectedLegend: activeLegends[0] }),\n };\n\n switch (data[0].type) {\n case 'pie':\n return (\n <DonutChart\n {...transformPlotlyJsonToDonutProps(plotlySchema, colorMap, isDarkTheme)}\n legendProps={legendProps}\n />\n );\n case 'bar':\n const orientation = data[0].orientation;\n if (orientation === 'h') {\n return (\n <HorizontalBarChartWithAxis\n {...transformPlotlyJsonToHorizontalBarWithAxisProps(plotlySchema, colorMap, isDarkTheme)}\n legendProps={legendProps}\n />\n );\n } else {\n if (['group', 'overlay'].includes(plotlySchema?.layout?.barmode)) {\n return (\n <GroupedVerticalBarChart\n {...transformPlotlyJsonToGVBCProps(plotlySchema, colorMap, isDarkTheme)}\n legendProps={legendProps}\n />\n );\n }\n return (\n <VerticalStackedBarChart\n {...transformPlotlyJsonToVSBCProps(plotlySchema, colorMap, isDarkTheme)}\n legendProps={legendProps}\n />\n );\n }\n case 'scatter':\n const isAreaChart = data.some((series: any) => series.fill === 'tonexty');\n if (isXDate || isXNumber) {\n if (isAreaChart) {\n return (\n <AreaChart\n {...transformPlotlyJsonToScatterChartProps({ data, layout }, true, colorMap, isDarkTheme)}\n legendProps={legendProps}\n />\n );\n }\n return (\n <LineChart\n {...transformPlotlyJsonToScatterChartProps({ data, layout }, false, colorMap, isDarkTheme)}\n legendProps={legendProps}\n />\n );\n }\n return (\n <VerticalStackedBarChart\n {...transformPlotlyJsonToVSBCProps(plotlySchema, colorMap, isDarkTheme)}\n legendProps={legendProps}\n />\n );\n case 'heatmap':\n return <HeatMapChart {...transformPlotlyJsonToHeatmapProps(plotlySchema)} legendProps={legendProps} />;\n case 'sankey':\n return <SankeyChart {...transformPlotlyJsonToSankeyProps(plotlySchema, colorMap, isDarkTheme)} />;\n case 'indicator':\n if (data?.[0]?.mode?.includes('gauge')) {\n return (\n <GaugeChart\n {...transformPlotlyJsonToGaugeProps(plotlySchema, colorMap, isDarkTheme)}\n legendProps={legendProps}\n />\n );\n }\n return <div>Unsupported Schema</div>;\n case 'histogram':\n return (\n <VerticalBarChart\n {...transformPlotlyJsonToVBCProps(plotlySchema, colorMap, isDarkTheme)}\n legendProps={legendProps}\n />\n );\n default:\n return <div>Unsupported Schema</div>;\n }\n});\nDeclarativeChart.displayName = 'DeclarativeChart';\n"]}
|
|
@@ -436,10 +436,6 @@ var baseContainer, baseAttrName;
|
|
|
436
436
|
export function findArrayAttributes(trace) {
|
|
437
437
|
// Init basecontainer and baseAttrName
|
|
438
438
|
crawlIntoTrace(baseContainer, 0, '');
|
|
439
|
-
for (var _i = 0, arrayAttributes_1 = arrayAttributes; _i < arrayAttributes_1.length; _i++) {
|
|
440
|
-
var attribute = arrayAttributes_1[_i];
|
|
441
|
-
console.log(attribute);
|
|
442
|
-
}
|
|
443
439
|
}
|
|
444
440
|
function crawlIntoTrace(container, i, astrPartial) {
|
|
445
441
|
var item = container[stack[i]];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlotlySchemaAdapter.js","sourceRoot":"../src/","sources":["components/DeclarativeChart/PlotlySchemaAdapter.ts"],"names":[],"mappings":";AAMA,OAAO,EAAE,GAAG,IAAI,KAAK,EAAE,MAAM,IAAI,QAAQ,EAAE,GAAG,IAAI,KAAK,EAAE,GAAG,IAAI,KAAK,EAAE,GAAG,IAAI,KAAK,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,UAAU,CAAC;AACxH,OAAO,EAAE,WAAW,IAAI,aAAa,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,MAAM,IAAI,QAAQ,EAAE,cAAc,IAAI,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAmBnF,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAKtD,IAAM,MAAM,GAAG,UAAC,KAAU,IAAc,OAAA,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAzB,CAAyB,CAAC;AAClE,IAAM,QAAQ,GAAG,UAAC,KAAU,IAAc,OAAA,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,EAA5C,CAA4C,CAAC;AACvF,MAAM,CAAC,IAAM,WAAW,GAAG,UAAC,KAAY,IAAc,OAAA,mBAAmB,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,EAAjD,CAAiD,CAAC;AACxG,MAAM,CAAC,IAAM,aAAa,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,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,cAAc,GAAG,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;qBACjE;iBACF;aACF;SACF;aAAM,IAAI,aAAa,CAAC,IAAI,CAAC,EAAE;YAC9B,cAAc,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,cAAc,GAAG,GAAG,CAAC,CAAC;SACnD;KACF;AACH,CAAC","sourcesContent":["/* eslint-disable one-var */\n/* eslint-disable vars-on-top */\n/* eslint-disable no-var */\n/* eslint-disable no-console */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as React from 'react';\nimport { bin as d3Bin, extent as d3Extent, sum as d3Sum, min as d3Min, max as d3Max, merge as d3Merge } from 'd3-array';\nimport { scaleLinear as d3ScaleLinear } from 'd3-scale';\nimport { format as d3Format, precisionFixed as d3PrecisionFixed } from 'd3-format';\nimport { IDonutChartProps } from '../DonutChart/index';\nimport {\n IChartDataPoint,\n IChartProps,\n IHorizontalBarChartWithAxisDataPoint,\n ILineChartPoints,\n IVerticalStackedChartProps,\n IHeatMapChartData,\n IHeatMapChartDataPoint,\n IGroupedVerticalBarChartData,\n IVerticalBarChartDataPoint,\n} from '../../types/IDataPoint';\nimport { ISankeyChartProps } from '../SankeyChart/index';\nimport { IVerticalStackedBarChartProps } from '../VerticalStackedBarChart/index';\nimport { IHorizontalBarChartWithAxisProps } from '../HorizontalBarChartWithAxis/index';\nimport { ILineChartProps } from '../LineChart/index';\nimport { IAreaChartProps } from '../AreaChart/index';\nimport { IHeatMapChartProps } from '../HeatMapChart/index';\nimport { getNextColor } from '../../utilities/colors';\nimport { IGaugeChartProps, IGaugeChartSegment } from '../GaugeChart/index';\nimport { IGroupedVerticalBarChartProps } from '../GroupedVerticalBarChart/index';\nimport { IVerticalBarChartProps } from '../VerticalBarChart/index';\n\nconst isDate = (value: any): boolean => !isNaN(Date.parse(value));\nconst isNumber = (value: any): boolean => !isNaN(parseFloat(value)) && isFinite(value);\nexport const isDateArray = (array: any[]): boolean => isArrayOrTypedArray(array) && array.every(isDate);\nexport const isNumberArray = (array: any[]): boolean => isArrayOrTypedArray(array) && array.every(isNumber);\n\nexport const getColor = (\n legendLabel: string,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): string => {\n if (!colorMap.current.has(legendLabel)) {\n const nextColor = getNextColor(colorMap.current.size + 1, 0, isDarkTheme);\n colorMap.current.set(legendLabel, nextColor);\n return nextColor;\n }\n\n return colorMap.current.get(legendLabel) as string;\n};\n\nexport const transformPlotlyJsonToDonutProps = (\n jsonObj: any,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): IDonutChartProps => {\n const { data, layout } = jsonObj;\n const firstData = data[0];\n\n const donutData = firstData.labels?.map((label: string, index: number): IChartDataPoint => {\n const color = getColor(label, colorMap, isDarkTheme);\n return {\n legend: label,\n data: firstData.values?.[index],\n color,\n };\n });\n\n const width: number = layout?.width || 440;\n const height: number = layout?.height || 220;\n const hideLabels = firstData.textinfo ? !['value', 'percent'].includes(firstData.textinfo) : false;\n const donutMarginHorizontal = hideLabels ? 0 : 80;\n const donutMarginVertical = 40 + (hideLabels ? 0 : 40);\n const innerRadius: number = firstData.hole\n ? firstData.hole * (Math.min(width - donutMarginHorizontal, height - donutMarginVertical) / 2)\n : 0;\n\n const styles: IDonutChartProps['styles'] = {\n root: {\n '[class^=\"arcLabel\"]': {\n fontSize: firstData.textfont?.size,\n },\n },\n };\n\n return {\n data: {\n chartTitle: layout?.title,\n chartData: donutData,\n },\n hideLegend: layout?.showlegend === false ? true : false,\n width,\n height,\n innerRadius,\n hideLabels,\n showLabelsInPercent: firstData.textinfo ? firstData.textinfo === 'percent' : true,\n styles,\n };\n};\n\nexport const transformPlotlyJsonToVSBCProps = (\n jsonObj: any,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): IVerticalStackedBarChartProps => {\n const { data, layout } = jsonObj;\n const mapXToDataPoints: { [key: string]: IVerticalStackedChartProps } = {};\n let yMaxValue = 0;\n\n data.forEach((series: any, index1: number) => {\n series.x?.forEach((x: string | number, index2: number) => {\n if (!mapXToDataPoints[x]) {\n mapXToDataPoints[x] = { xAxisPoint: x, chartData: [], lineData: [] };\n }\n const legend: string = series.name || `Series ${index1 + 1}`;\n if (series.type === 'bar') {\n const color = getColor(legend, colorMap, isDarkTheme);\n mapXToDataPoints[x].chartData.push({\n legend,\n data: series.y?.[index2],\n color,\n });\n } else if (series.type === 'line') {\n const color = getColor(legend, colorMap, isDarkTheme);\n mapXToDataPoints[x].lineData!.push({\n legend,\n y: series.y?.[index2],\n color,\n });\n }\n\n yMaxValue = Math.max(yMaxValue, series.y?.[index2]);\n });\n });\n\n return {\n data: Object.values(mapXToDataPoints),\n chartTitle: layout?.title,\n // width: layout?.width,\n // height: layout?.height,\n barWidth: 'auto',\n yMaxValue,\n };\n};\n\nexport const transformPlotlyJsonToGVBCProps = (\n jsonObj: any,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): IGroupedVerticalBarChartProps => {\n const { data, layout } = jsonObj;\n const mapXToDataPoints: Record<string, IGroupedVerticalBarChartData> = {};\n\n data.forEach((series: any, index1: number) => {\n series.x?.forEach((x: string | number, index2: number) => {\n if (!mapXToDataPoints[x]) {\n mapXToDataPoints[x] = { name: x.toString(), series: [] };\n }\n if (series.type === 'bar') {\n const legend: string = series.name || `Series ${index1 + 1}`;\n const color = getColor(legend, colorMap, isDarkTheme);\n\n mapXToDataPoints[x].series.push({\n key: legend,\n data: series.y?.[index2],\n color,\n legend,\n });\n }\n });\n });\n\n return {\n data: Object.values(mapXToDataPoints),\n chartTitle: layout?.title,\n // width: layout?.width,\n // height: layout?.height,\n barwidth: 'auto',\n };\n};\n\nexport const transformPlotlyJsonToVBCProps = (\n jsonObj: any,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): IVerticalBarChartProps => {\n const { data, layout } = jsonObj;\n const vbcData: IVerticalBarChartDataPoint[] = [];\n\n data.forEach((series: any, index: number) => {\n if (!series.x) {\n return;\n }\n\n const scale = d3ScaleLinear()\n .domain(d3Extent<number>(series.x) as [number, number])\n .nice();\n let [xMin, xMax] = scale.domain();\n\n xMin = typeof series.xbins?.start === 'number' ? series.xbins.start : xMin;\n xMax = typeof series.xbins?.end === 'number' ? series.xbins.end : xMax;\n\n const bin = d3Bin().domain([xMin, xMax]);\n\n if (typeof series.xbins?.size === 'number') {\n const thresholds: number[] = [];\n let th = xMin;\n const precision = d3PrecisionFixed(series.xbins.size);\n const format = d3Format(`.${precision}f`);\n\n while (th < xMax + series.xbins.size) {\n thresholds.push(parseFloat(format(th)));\n th += series.xbins.size;\n }\n\n xMin = thresholds[0];\n xMax = thresholds[thresholds.length - 1];\n bin.domain([xMin, xMax]).thresholds(thresholds);\n }\n\n const buckets = bin(series.x);\n // If the start or end of xbins is specified, then the number of datapoints may become less than x.length\n const totalDataPoints = d3Merge(buckets).length;\n\n buckets.forEach(bucket => {\n const legend = series.name || `Series ${index + 1}`;\n const color = getColor(legend, colorMap, isDarkTheme);\n let y = bucket.length;\n\n if (series.histnorm === 'percent') {\n y = (bucket.length / totalDataPoints) * 100;\n } else if (series.histnorm === 'probability') {\n y = bucket.length / totalDataPoints;\n } else if (series.histnorm === 'density') {\n y = bucket.x0 === bucket.x1 ? 0 : bucket.length / (bucket.x1! - bucket.x0!);\n } else if (series.histnorm === 'probability density') {\n y = bucket.x0 === bucket.x1 ? 0 : bucket.length / (totalDataPoints * (bucket.x1! - bucket.x0!));\n } else if (series.histfunc === 'sum') {\n y = d3Sum(bucket);\n } else if (series.histfunc === 'avg') {\n y = bucket.length === 0 ? 0 : d3Sum(bucket) / bucket.length;\n } else if (series.histfunc === 'min') {\n y = d3Min(bucket)!;\n } else if (series.histfunc === 'max') {\n y = d3Max(bucket)!;\n }\n\n vbcData.push({\n x: (bucket.x1! + bucket.x0!) / 2,\n y,\n legend,\n color,\n xAxisCalloutData: `[${bucket.x0} - ${bucket.x1})`,\n });\n });\n });\n\n return {\n data: vbcData,\n chartTitle: layout?.title,\n // width: layout?.width,\n // height: layout?.height,\n hideLegend: true,\n barWidth: 24,\n supportNegativeData: true,\n };\n};\n\nexport const transformPlotlyJsonToScatterChartProps = (\n jsonObj: any,\n isAreaChart: boolean,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): ILineChartProps | IAreaChartProps => {\n const { data, layout } = jsonObj;\n\n const chartData: ILineChartPoints[] = data.map((series: any, index: number) => {\n const xValues = series.x;\n const isString = typeof xValues[0] === 'string';\n const isXDate = isDateArray(xValues);\n const isXNumber = isNumberArray(xValues);\n const legend = series.name || `Series ${index + 1}`;\n const lineColor = getColor(legend, colorMap, isDarkTheme);\n\n return {\n legend,\n data: xValues.map((x: string | number, i: number) => ({\n x: isString ? (isXDate ? new Date(x) : isXNumber ? parseFloat(x as string) : x) : x,\n y: series.y[i],\n })),\n color: lineColor,\n };\n });\n\n const chartProps: IChartProps = {\n chartTitle: layout.title || '',\n lineChartData: chartData,\n };\n\n if (isAreaChart) {\n return {\n data: chartProps,\n supportNegativeData: true,\n } as IAreaChartProps;\n } else {\n return {\n data: chartProps,\n supportNegativeData: true,\n } as ILineChartProps;\n }\n};\n\nexport const transformPlotlyJsonToHorizontalBarWithAxisProps = (\n jsonObj: any,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): IHorizontalBarChartWithAxisProps => {\n const { data, layout } = jsonObj;\n\n const chartData: IHorizontalBarChartWithAxisDataPoint[] = data\n .map((series: any, index: number) => {\n return series.y.map((yValue: string, i: number) => {\n const color = getColor(yValue, colorMap, isDarkTheme);\n return {\n x: series.x[i],\n y: yValue,\n legend: yValue,\n color,\n };\n });\n })\n .flat();\n\n const chartHeight = layout.height || 450;\n const margin = layout.margin?.l || 0;\n const padding = layout.margin?.pad || 0;\n const availableHeight = chartHeight - margin - padding;\n const numberOfBars = data[0].y.length;\n const scalingFactor = 0.01;\n const gapFactor = 1 / (1 + scalingFactor * numberOfBars);\n const barHeight = availableHeight / (numberOfBars * (1 + gapFactor));\n\n return {\n data: chartData,\n chartTitle: layout.title || '',\n barHeight,\n showYAxisLables: true,\n styles: {\n root: {\n height: chartHeight,\n width: layout.width || 600,\n },\n },\n };\n};\n\nexport const transformPlotlyJsonToHeatmapProps = (jsonObj: any): IHeatMapChartProps => {\n const { data, layout } = jsonObj;\n const firstData = data[0];\n const heatmapDataPoints: IHeatMapChartDataPoint[] = [];\n let zMin = Number.POSITIVE_INFINITY;\n let zMax = Number.NEGATIVE_INFINITY;\n\n firstData.x?.forEach((xVal: any, xIdx: number) => {\n firstData.y?.forEach((yVal: any, yIdx: number) => {\n const zVal = firstData.z?.[yIdx]?.[xIdx];\n\n heatmapDataPoints.push({\n x: layout.xaxis?.type === 'date' ? new Date(xVal) : xVal,\n y: layout.yaxis?.type === 'date' ? new Date(yVal) : yVal,\n value: zVal,\n });\n\n zMin = Math.min(zMin, zVal);\n zMax = Math.max(zMax, zVal);\n });\n });\n const heatmapData: IHeatMapChartData = {\n legend: firstData.name || '',\n data: heatmapDataPoints,\n value: 0,\n };\n\n // Convert normalized values to actual values\n const domainValuesForColorScale: number[] = firstData.colorscale\n ? firstData.colorscale.map((arr: any) => arr[0] * (zMax - zMin) + zMin)\n : [];\n const rangeValuesForColorScale: string[] = firstData.colorscale ? firstData.colorscale.map((arr: any) => arr[1]) : [];\n\n return {\n data: [heatmapData],\n domainValuesForColorScale,\n rangeValuesForColorScale,\n hideLegend: true,\n };\n};\n\nexport const transformPlotlyJsonToSankeyProps = (\n jsonObj: any,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): ISankeyChartProps => {\n const { data, layout } = jsonObj;\n const { link, node } = data[0];\n const validLinks = link.value\n .map((val: number, index: number) => ({\n value: val,\n source: link.source[index],\n target: link.target[index],\n }))\n // eslint-disable-next-line @typescript-eslint/no-shadow\n //@ts-expect-error Dynamic link object. Ignore for now.\n // Filter out negative nodes, unequal nodes and self-references (circular links)\n .filter(x => x.source > 0 && x.target > 0 && x.source !== x.target);\n\n const sankeyChartData = {\n nodes: node.label.map((label: string, index: number) => {\n const color = getColor(label, colorMap, isDarkTheme);\n\n return {\n nodeId: index,\n name: label,\n color,\n };\n }),\n links: validLinks.map((validLink: any, index: number) => {\n return {\n ...validLink,\n };\n }),\n };\n\n const width: number = layout?.width || 440;\n const height: number = layout?.height || 220;\n const styles: ISankeyChartProps['styles'] = {\n root: {\n fontSize: layout.font?.size,\n },\n };\n const shouldResize: number = width + height;\n return {\n data: {\n chartTitle: layout?.title,\n SankeyChartData: sankeyChartData,\n },\n width,\n height,\n styles,\n shouldResize,\n enableReflow: true,\n };\n};\n\nexport const transformPlotlyJsonToGaugeProps = (\n jsonObj: any,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): IGaugeChartProps => {\n const { data, layout } = jsonObj;\n const firstData = data[0];\n\n const segments = firstData.gauge?.steps?.map((step: any, index: number): IGaugeChartSegment => {\n const legend = step.name || `Segment ${index + 1}`;\n const color = getColor(legend, colorMap, isDarkTheme);\n return {\n legend,\n size: step.range?.[1] - step.range?.[0],\n color,\n };\n });\n\n let sublabel: string | undefined;\n let sublabelColor: string | undefined;\n if (typeof firstData.delta?.reference === 'number') {\n const diff = firstData.value - firstData.delta.reference;\n if (diff >= 0) {\n sublabel = `\\u25B2 ${diff}`;\n const color = getColor(firstData.delta.increasing?.color || '', colorMap, isDarkTheme);\n sublabelColor = color;\n } else {\n sublabel = `\\u25BC ${Math.abs(diff)}`;\n const color = getColor(firstData.delta.decreasing?.color || '', colorMap, isDarkTheme);\n sublabelColor = color;\n }\n }\n\n const styles: IGaugeChartProps['styles'] = {\n sublabel: {\n fill: sublabelColor,\n },\n };\n\n return {\n segments,\n chartValue: firstData.value,\n chartTitle: firstData.title?.text,\n sublabel,\n // range values can be null\n minValue: firstData.gauge?.axis?.range?.[0] ?? undefined,\n maxValue: firstData.gauge?.axis?.range?.[1] ?? undefined,\n chartValueFormat: () => firstData.value,\n width: layout?.width,\n height: layout?.height,\n hideLegend: true,\n styles,\n };\n};\n\nfunction isTypedArray(a: any) {\n return ArrayBuffer.isView(a) && !(a instanceof DataView);\n}\n\nfunction isArrayOrTypedArray(a: any) {\n return Array.isArray(a) || isTypedArray(a);\n}\n\nfunction isPlainObject(obj: any) {\n if (window && window.process && window.process.versions) {\n return Object.prototype.toString.call(obj) === '[object Object]';\n }\n\n return (\n Object.prototype.toString.call(obj) === '[object Object]' &&\n Object.getPrototypeOf(obj).hasOwnProperty('hasOwnProperty')\n );\n}\n\nvar arrayAttributes: any[] = [];\nvar stack: any[] = [];\nvar isArrayStack: any[] = [];\nvar baseContainer: any, baseAttrName: any;\n/**\n * Interate iteratively through the trace object and find all the array attributes.\n * 1 trace record = 1 series of data\n * @param trace\n */\nexport function findArrayAttributes(trace: any) {\n // Init basecontainer and baseAttrName\n crawlIntoTrace(baseContainer, 0, '');\n for (const attribute of arrayAttributes) {\n console.log(attribute);\n }\n}\n\nfunction crawlIntoTrace(container: any, i: number, astrPartial: any) {\n var item = container[stack[i]];\n var newAstrPartial = astrPartial + stack[i];\n if (i === stack.length - 1) {\n if (isArrayOrTypedArray(item)) {\n arrayAttributes.push(baseAttrName + newAstrPartial);\n }\n } else {\n if (isArrayStack[i]) {\n if (Array.isArray(item)) {\n for (var j = 0; j < item.length; j++) {\n if (isPlainObject(item[j])) {\n crawlIntoTrace(item[j], i + 1, newAstrPartial + '[' + j + '].');\n }\n }\n }\n } else if (isPlainObject(item)) {\n crawlIntoTrace(item, i + 1, newAstrPartial + '.');\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PlotlySchemaAdapter.js","sourceRoot":"../src/","sources":["components/DeclarativeChart/PlotlySchemaAdapter.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,GAAG,IAAI,KAAK,EAAE,MAAM,IAAI,QAAQ,EAAE,GAA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AAE,WAAgB;IACjE,IAAI,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/B,IAAI,cAAc,GAAG,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC5C,IAAI,CAAC,KAAK,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;QAC1B,IAAI,mBAAmB,CAAC,IAAI,CAAC,EAAE;YAC7B,eAAe,CAAC,IAAI,CAAC,YAAY,GAAG,cAAc,CAAC,CAAC;SACrD;KACF;SAAM;QACL,IAAI,YAAY,CAAC,CAAC,CAAC,EAAE;YACnB,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;gBACvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBACpC,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;wBAC1B,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,cAAc,GAAG,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;qBACjE;iBACF;aACF;SACF;aAAM,IAAI,aAAa,CAAC,IAAI,CAAC,EAAE;YAC9B,cAAc,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,cAAc,GAAG,GAAG,CAAC,CAAC;SACnD;KACF;AACH,CAAC","sourcesContent":["/* eslint-disable one-var */\n/* eslint-disable vars-on-top */\n/* eslint-disable no-var */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as React from 'react';\nimport { bin as d3Bin, extent as d3Extent, sum as d3Sum, min as d3Min, max as d3Max, merge as d3Merge } from 'd3-array';\nimport { scaleLinear as d3ScaleLinear } from 'd3-scale';\nimport { format as d3Format, precisionFixed as d3PrecisionFixed } from 'd3-format';\nimport { IDonutChartProps } from '../DonutChart/index';\nimport {\n IChartDataPoint,\n IChartProps,\n IHorizontalBarChartWithAxisDataPoint,\n ILineChartPoints,\n IVerticalStackedChartProps,\n IHeatMapChartData,\n IHeatMapChartDataPoint,\n IGroupedVerticalBarChartData,\n IVerticalBarChartDataPoint,\n} from '../../types/IDataPoint';\nimport { ISankeyChartProps } from '../SankeyChart/index';\nimport { IVerticalStackedBarChartProps } from '../VerticalStackedBarChart/index';\nimport { IHorizontalBarChartWithAxisProps } from '../HorizontalBarChartWithAxis/index';\nimport { ILineChartProps } from '../LineChart/index';\nimport { IAreaChartProps } from '../AreaChart/index';\nimport { IHeatMapChartProps } from '../HeatMapChart/index';\nimport { getNextColor } from '../../utilities/colors';\nimport { IGaugeChartProps, IGaugeChartSegment } from '../GaugeChart/index';\nimport { IGroupedVerticalBarChartProps } from '../GroupedVerticalBarChart/index';\nimport { IVerticalBarChartProps } from '../VerticalBarChart/index';\n\nconst isDate = (value: any): boolean => !isNaN(Date.parse(value));\nconst isNumber = (value: any): boolean => !isNaN(parseFloat(value)) && isFinite(value);\nexport const isDateArray = (array: any[]): boolean => isArrayOrTypedArray(array) && array.every(isDate);\nexport const isNumberArray = (array: any[]): boolean => isArrayOrTypedArray(array) && array.every(isNumber);\n\nexport const getColor = (\n legendLabel: string,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): string => {\n if (!colorMap.current.has(legendLabel)) {\n const nextColor = getNextColor(colorMap.current.size + 1, 0, isDarkTheme);\n colorMap.current.set(legendLabel, nextColor);\n return nextColor;\n }\n\n return colorMap.current.get(legendLabel) as string;\n};\n\nexport const transformPlotlyJsonToDonutProps = (\n jsonObj: any,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): IDonutChartProps => {\n const { data, layout } = jsonObj;\n const firstData = data[0];\n\n const donutData = firstData.labels?.map((label: string, index: number): IChartDataPoint => {\n const color = getColor(label, colorMap, isDarkTheme);\n return {\n legend: label,\n data: firstData.values?.[index],\n color,\n };\n });\n\n const width: number = layout?.width || 440;\n const height: number = layout?.height || 220;\n const hideLabels = firstData.textinfo ? !['value', 'percent'].includes(firstData.textinfo) : false;\n const donutMarginHorizontal = hideLabels ? 0 : 80;\n const donutMarginVertical = 40 + (hideLabels ? 0 : 40);\n const innerRadius: number = firstData.hole\n ? firstData.hole * (Math.min(width - donutMarginHorizontal, height - donutMarginVertical) / 2)\n : 0;\n\n const styles: IDonutChartProps['styles'] = {\n root: {\n '[class^=\"arcLabel\"]': {\n fontSize: firstData.textfont?.size,\n },\n },\n };\n\n return {\n data: {\n chartTitle: layout?.title,\n chartData: donutData,\n },\n hideLegend: layout?.showlegend === false ? true : false,\n width,\n height,\n innerRadius,\n hideLabels,\n showLabelsInPercent: firstData.textinfo ? firstData.textinfo === 'percent' : true,\n styles,\n };\n};\n\nexport const transformPlotlyJsonToVSBCProps = (\n jsonObj: any,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): IVerticalStackedBarChartProps => {\n const { data, layout } = jsonObj;\n const mapXToDataPoints: { [key: string]: IVerticalStackedChartProps } = {};\n let yMaxValue = 0;\n\n data.forEach((series: any, index1: number) => {\n series.x?.forEach((x: string | number, index2: number) => {\n if (!mapXToDataPoints[x]) {\n mapXToDataPoints[x] = { xAxisPoint: x, chartData: [], lineData: [] };\n }\n const legend: string = series.name || `Series ${index1 + 1}`;\n if (series.type === 'bar') {\n const color = getColor(legend, colorMap, isDarkTheme);\n mapXToDataPoints[x].chartData.push({\n legend,\n data: series.y?.[index2],\n color,\n });\n } else if (series.type === 'line') {\n const color = getColor(legend, colorMap, isDarkTheme);\n mapXToDataPoints[x].lineData!.push({\n legend,\n y: series.y?.[index2],\n color,\n });\n }\n\n yMaxValue = Math.max(yMaxValue, series.y?.[index2]);\n });\n });\n\n return {\n data: Object.values(mapXToDataPoints),\n chartTitle: layout?.title,\n // width: layout?.width,\n // height: layout?.height,\n barWidth: 'auto',\n yMaxValue,\n };\n};\n\nexport const transformPlotlyJsonToGVBCProps = (\n jsonObj: any,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): IGroupedVerticalBarChartProps => {\n const { data, layout } = jsonObj;\n const mapXToDataPoints: Record<string, IGroupedVerticalBarChartData> = {};\n\n data.forEach((series: any, index1: number) => {\n series.x?.forEach((x: string | number, index2: number) => {\n if (!mapXToDataPoints[x]) {\n mapXToDataPoints[x] = { name: x.toString(), series: [] };\n }\n if (series.type === 'bar') {\n const legend: string = series.name || `Series ${index1 + 1}`;\n const color = getColor(legend, colorMap, isDarkTheme);\n\n mapXToDataPoints[x].series.push({\n key: legend,\n data: series.y?.[index2],\n color,\n legend,\n });\n }\n });\n });\n\n return {\n data: Object.values(mapXToDataPoints),\n chartTitle: layout?.title,\n // width: layout?.width,\n // height: layout?.height,\n barwidth: 'auto',\n };\n};\n\nexport const transformPlotlyJsonToVBCProps = (\n jsonObj: any,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): IVerticalBarChartProps => {\n const { data, layout } = jsonObj;\n const vbcData: IVerticalBarChartDataPoint[] = [];\n\n data.forEach((series: any, index: number) => {\n if (!series.x) {\n return;\n }\n\n const scale = d3ScaleLinear()\n .domain(d3Extent<number>(series.x) as [number, number])\n .nice();\n let [xMin, xMax] = scale.domain();\n\n xMin = typeof series.xbins?.start === 'number' ? series.xbins.start : xMin;\n xMax = typeof series.xbins?.end === 'number' ? series.xbins.end : xMax;\n\n const bin = d3Bin().domain([xMin, xMax]);\n\n if (typeof series.xbins?.size === 'number') {\n const thresholds: number[] = [];\n let th = xMin;\n const precision = d3PrecisionFixed(series.xbins.size);\n const format = d3Format(`.${precision}f`);\n\n while (th < xMax + series.xbins.size) {\n thresholds.push(parseFloat(format(th)));\n th += series.xbins.size;\n }\n\n xMin = thresholds[0];\n xMax = thresholds[thresholds.length - 1];\n bin.domain([xMin, xMax]).thresholds(thresholds);\n }\n\n const buckets = bin(series.x);\n // If the start or end of xbins is specified, then the number of datapoints may become less than x.length\n const totalDataPoints = d3Merge(buckets).length;\n\n buckets.forEach(bucket => {\n const legend = series.name || `Series ${index + 1}`;\n const color = getColor(legend, colorMap, isDarkTheme);\n let y = bucket.length;\n\n if (series.histnorm === 'percent') {\n y = (bucket.length / totalDataPoints) * 100;\n } else if (series.histnorm === 'probability') {\n y = bucket.length / totalDataPoints;\n } else if (series.histnorm === 'density') {\n y = bucket.x0 === bucket.x1 ? 0 : bucket.length / (bucket.x1! - bucket.x0!);\n } else if (series.histnorm === 'probability density') {\n y = bucket.x0 === bucket.x1 ? 0 : bucket.length / (totalDataPoints * (bucket.x1! - bucket.x0!));\n } else if (series.histfunc === 'sum') {\n y = d3Sum(bucket);\n } else if (series.histfunc === 'avg') {\n y = bucket.length === 0 ? 0 : d3Sum(bucket) / bucket.length;\n } else if (series.histfunc === 'min') {\n y = d3Min(bucket)!;\n } else if (series.histfunc === 'max') {\n y = d3Max(bucket)!;\n }\n\n vbcData.push({\n x: (bucket.x1! + bucket.x0!) / 2,\n y,\n legend,\n color,\n xAxisCalloutData: `[${bucket.x0} - ${bucket.x1})`,\n });\n });\n });\n\n return {\n data: vbcData,\n chartTitle: layout?.title,\n // width: layout?.width,\n // height: layout?.height,\n hideLegend: true,\n barWidth: 24,\n supportNegativeData: true,\n };\n};\n\nexport const transformPlotlyJsonToScatterChartProps = (\n jsonObj: any,\n isAreaChart: boolean,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): ILineChartProps | IAreaChartProps => {\n const { data, layout } = jsonObj;\n\n const chartData: ILineChartPoints[] = data.map((series: any, index: number) => {\n const xValues = series.x;\n const isString = typeof xValues[0] === 'string';\n const isXDate = isDateArray(xValues);\n const isXNumber = isNumberArray(xValues);\n const legend = series.name || `Series ${index + 1}`;\n const lineColor = getColor(legend, colorMap, isDarkTheme);\n\n return {\n legend,\n data: xValues.map((x: string | number, i: number) => ({\n x: isString ? (isXDate ? new Date(x) : isXNumber ? parseFloat(x as string) : x) : x,\n y: series.y[i],\n })),\n color: lineColor,\n };\n });\n\n const chartProps: IChartProps = {\n chartTitle: layout.title || '',\n lineChartData: chartData,\n };\n\n if (isAreaChart) {\n return {\n data: chartProps,\n supportNegativeData: true,\n } as IAreaChartProps;\n } else {\n return {\n data: chartProps,\n supportNegativeData: true,\n } as ILineChartProps;\n }\n};\n\nexport const transformPlotlyJsonToHorizontalBarWithAxisProps = (\n jsonObj: any,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): IHorizontalBarChartWithAxisProps => {\n const { data, layout } = jsonObj;\n\n const chartData: IHorizontalBarChartWithAxisDataPoint[] = data\n .map((series: any, index: number) => {\n return series.y.map((yValue: string, i: number) => {\n const color = getColor(yValue, colorMap, isDarkTheme);\n return {\n x: series.x[i],\n y: yValue,\n legend: yValue,\n color,\n };\n });\n })\n .flat();\n\n const chartHeight = layout.height || 450;\n const margin = layout.margin?.l || 0;\n const padding = layout.margin?.pad || 0;\n const availableHeight = chartHeight - margin - padding;\n const numberOfBars = data[0].y.length;\n const scalingFactor = 0.01;\n const gapFactor = 1 / (1 + scalingFactor * numberOfBars);\n const barHeight = availableHeight / (numberOfBars * (1 + gapFactor));\n\n return {\n data: chartData,\n chartTitle: layout.title || '',\n barHeight,\n showYAxisLables: true,\n styles: {\n root: {\n height: chartHeight,\n width: layout.width || 600,\n },\n },\n };\n};\n\nexport const transformPlotlyJsonToHeatmapProps = (jsonObj: any): IHeatMapChartProps => {\n const { data, layout } = jsonObj;\n const firstData = data[0];\n const heatmapDataPoints: IHeatMapChartDataPoint[] = [];\n let zMin = Number.POSITIVE_INFINITY;\n let zMax = Number.NEGATIVE_INFINITY;\n\n firstData.x?.forEach((xVal: any, xIdx: number) => {\n firstData.y?.forEach((yVal: any, yIdx: number) => {\n const zVal = firstData.z?.[yIdx]?.[xIdx];\n\n heatmapDataPoints.push({\n x: layout.xaxis?.type === 'date' ? new Date(xVal) : xVal,\n y: layout.yaxis?.type === 'date' ? new Date(yVal) : yVal,\n value: zVal,\n });\n\n zMin = Math.min(zMin, zVal);\n zMax = Math.max(zMax, zVal);\n });\n });\n const heatmapData: IHeatMapChartData = {\n legend: firstData.name || '',\n data: heatmapDataPoints,\n value: 0,\n };\n\n // Convert normalized values to actual values\n const domainValuesForColorScale: number[] = firstData.colorscale\n ? firstData.colorscale.map((arr: any) => arr[0] * (zMax - zMin) + zMin)\n : [];\n const rangeValuesForColorScale: string[] = firstData.colorscale ? firstData.colorscale.map((arr: any) => arr[1]) : [];\n\n return {\n data: [heatmapData],\n domainValuesForColorScale,\n rangeValuesForColorScale,\n hideLegend: true,\n };\n};\n\nexport const transformPlotlyJsonToSankeyProps = (\n jsonObj: any,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): ISankeyChartProps => {\n const { data, layout } = jsonObj;\n const { link, node } = data[0];\n const validLinks = link.value\n .map((val: number, index: number) => ({\n value: val,\n source: link.source[index],\n target: link.target[index],\n }))\n // eslint-disable-next-line @typescript-eslint/no-shadow\n //@ts-expect-error Dynamic link object. Ignore for now.\n // Filter out negative nodes, unequal nodes and self-references (circular links)\n .filter(x => x.source > 0 && x.target > 0 && x.source !== x.target);\n\n const sankeyChartData = {\n nodes: node.label.map((label: string, index: number) => {\n const color = getColor(label, colorMap, isDarkTheme);\n\n return {\n nodeId: index,\n name: label,\n color,\n };\n }),\n links: validLinks.map((validLink: any, index: number) => {\n return {\n ...validLink,\n };\n }),\n };\n\n const width: number = layout?.width || 440;\n const height: number = layout?.height || 220;\n const styles: ISankeyChartProps['styles'] = {\n root: {\n fontSize: layout.font?.size,\n },\n };\n const shouldResize: number = width + height;\n return {\n data: {\n chartTitle: layout?.title,\n SankeyChartData: sankeyChartData,\n },\n width,\n height,\n styles,\n shouldResize,\n enableReflow: true,\n };\n};\n\nexport const transformPlotlyJsonToGaugeProps = (\n jsonObj: any,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): IGaugeChartProps => {\n const { data, layout } = jsonObj;\n const firstData = data[0];\n\n const segments = firstData.gauge?.steps?.map((step: any, index: number): IGaugeChartSegment => {\n const legend = step.name || `Segment ${index + 1}`;\n const color = getColor(legend, colorMap, isDarkTheme);\n return {\n legend,\n size: step.range?.[1] - step.range?.[0],\n color,\n };\n });\n\n let sublabel: string | undefined;\n let sublabelColor: string | undefined;\n if (typeof firstData.delta?.reference === 'number') {\n const diff = firstData.value - firstData.delta.reference;\n if (diff >= 0) {\n sublabel = `\\u25B2 ${diff}`;\n const color = getColor(firstData.delta.increasing?.color || '', colorMap, isDarkTheme);\n sublabelColor = color;\n } else {\n sublabel = `\\u25BC ${Math.abs(diff)}`;\n const color = getColor(firstData.delta.decreasing?.color || '', colorMap, isDarkTheme);\n sublabelColor = color;\n }\n }\n\n const styles: IGaugeChartProps['styles'] = {\n sublabel: {\n fill: sublabelColor,\n },\n };\n\n return {\n segments,\n chartValue: firstData.value,\n chartTitle: firstData.title?.text,\n sublabel,\n // range values can be null\n minValue: firstData.gauge?.axis?.range?.[0] ?? undefined,\n maxValue: firstData.gauge?.axis?.range?.[1] ?? undefined,\n chartValueFormat: () => firstData.value,\n width: layout?.width,\n height: layout?.height,\n hideLegend: true,\n styles,\n };\n};\n\nfunction isTypedArray(a: any) {\n return ArrayBuffer.isView(a) && !(a instanceof DataView);\n}\n\nfunction isArrayOrTypedArray(a: any) {\n return Array.isArray(a) || isTypedArray(a);\n}\n\nfunction isPlainObject(obj: any) {\n if (window && window.process && window.process.versions) {\n return Object.prototype.toString.call(obj) === '[object Object]';\n }\n\n return (\n Object.prototype.toString.call(obj) === '[object Object]' &&\n Object.getPrototypeOf(obj).hasOwnProperty('hasOwnProperty')\n );\n}\n\nvar arrayAttributes: any[] = [];\nvar stack: any[] = [];\nvar isArrayStack: any[] = [];\nvar baseContainer: any, baseAttrName: any;\n/**\n * Interate iteratively through the trace object and find all the array attributes.\n * 1 trace record = 1 series of data\n * @param trace\n */\nexport function findArrayAttributes(trace: any) {\n // Init basecontainer and baseAttrName\n crawlIntoTrace(baseContainer, 0, '');\n}\n\nfunction crawlIntoTrace(container: any, i: number, astrPartial: any) {\n var item = container[stack[i]];\n var newAstrPartial = astrPartial + stack[i];\n if (i === stack.length - 1) {\n if (isArrayOrTypedArray(item)) {\n arrayAttributes.push(baseAttrName + newAstrPartial);\n }\n } else {\n if (isArrayStack[i]) {\n if (Array.isArray(item)) {\n for (var j = 0; j < item.length; j++) {\n if (isPlainObject(item[j])) {\n crawlIntoTrace(item[j], i + 1, newAstrPartial + '[' + j + '].');\n }\n }\n }\n } else if (isPlainObject(item)) {\n crawlIntoTrace(item, i + 1, newAstrPartial + '.');\n }\n }\n}\n"]}
|
|
@@ -13,7 +13,7 @@ var getClassNames = classNamesFunction();
|
|
|
13
13
|
var HorizontalBarChartWithAxisBase = /** @class */ (function (_super) {
|
|
14
14
|
__extends(HorizontalBarChartWithAxisBase, _super);
|
|
15
15
|
function HorizontalBarChartWithAxisBase(props) {
|
|
16
|
-
var _a, _b;
|
|
16
|
+
var _a, _b, _c;
|
|
17
17
|
var _this = _super.call(this, props) || this;
|
|
18
18
|
_this._isRtl = getRTL();
|
|
19
19
|
_this._getDomainNRangeValues = function (points, margins, width, chartType, isRTL, xAxisType, barWidth, tickValues, shiftX) {
|
|
@@ -240,10 +240,10 @@ var HorizontalBarChartWithAxisBase = /** @class */ (function (_super) {
|
|
|
240
240
|
color: '',
|
|
241
241
|
dataForHoverCard: 0,
|
|
242
242
|
isCalloutVisible: false,
|
|
243
|
-
isLegendSelected:
|
|
243
|
+
isLegendSelected: ((_a = props.legendProps) === null || _a === void 0 ? void 0 : _a.selectedLegend) !== undefined,
|
|
244
244
|
isLegendHovered: false,
|
|
245
245
|
refSelected: null,
|
|
246
|
-
selectedLegendTitle: (
|
|
246
|
+
selectedLegendTitle: (_c = (_b = props.legendProps) === null || _b === void 0 ? void 0 : _b.selectedLegend) !== null && _c !== void 0 ? _c : '',
|
|
247
247
|
xCalloutValue: '',
|
|
248
248
|
yCalloutValue: '',
|
|
249
249
|
activeXdataPoint: null,
|
|
@@ -439,6 +439,15 @@ var HorizontalBarChartWithAxisBase = /** @class */ (function (_super) {
|
|
|
439
439
|
var _b = this.props.useSingleColor, useSingleColor = _b === void 0 ? false : _b;
|
|
440
440
|
var bars = this._points.map(function (point, index) {
|
|
441
441
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
442
|
+
var shouldHighlight = true;
|
|
443
|
+
if (_this.state.isLegendHovered || _this.state.isLegendSelected) {
|
|
444
|
+
shouldHighlight = _this.state.selectedLegendTitle === point.legend;
|
|
445
|
+
}
|
|
446
|
+
_this._classNames = getClassNames(_this.props.styles, {
|
|
447
|
+
theme: _this.props.theme,
|
|
448
|
+
legendColor: _this.state.color,
|
|
449
|
+
shouldHighlight: shouldHighlight,
|
|
450
|
+
});
|
|
442
451
|
var barHeight = Math.max(yBarScale(point.y), 0);
|
|
443
452
|
if (barHeight < 1) {
|
|
444
453
|
return React.createElement(React.Fragment, { key: point.x }, " ");
|
|
@@ -472,11 +481,11 @@ var HorizontalBarChartWithAxisBase = /** @class */ (function (_super) {
|
|
|
472
481
|
React.createElement("linearGradient", { id: gradientId },
|
|
473
482
|
React.createElement("stop", { offset: "0", stopColor: startColor }),
|
|
474
483
|
React.createElement("stop", { offset: "100%", stopColor: endColor })))),
|
|
475
|
-
React.createElement("rect", { transform: "translate(0,".concat(0.5 * (yBarScale.bandwidth() - _this._barHeight), ")"), key: point.x, x: _this._isRtl ? xBarScale(point.x) : _this.margins.left, y: yBarScale(point.y), rx: _this.props.roundCorners ? 3 : 0, width: _this._isRtl
|
|
484
|
+
React.createElement("rect", { transform: "translate(0,".concat(0.5 * (yBarScale.bandwidth() - _this._barHeight), ")"), key: point.x, className: _this._classNames.opacityChangeOnHover, x: _this._isRtl ? xBarScale(point.x) : _this.margins.left, y: yBarScale(point.y), rx: _this.props.roundCorners ? 3 : 0, width: _this._isRtl
|
|
476
485
|
? containerWidth - _this.margins.right - Math.max(xBarScale(point.x), 0)
|
|
477
486
|
: Math.max(xBarScale(point.x), 0) - _this.margins.left, height: _this._barHeight, "aria-labelledby": "toolTip".concat(_this._calloutId), "aria-label": _this._getAriaLabel(point), role: "img", ref: function (e) {
|
|
478
487
|
_this._refCallback(e, point.legend);
|
|
479
|
-
}, onClick: point.onClick, onMouseOver: _this._onBarHover.bind(_this, point, startColor), onMouseLeave: _this._onBarLeave, onBlur: _this._onBarLeave, "data-is-focusable":
|
|
488
|
+
}, onClick: point.onClick, onMouseOver: _this._onBarHover.bind(_this, point, startColor), onMouseLeave: _this._onBarLeave, onBlur: _this._onBarLeave, "data-is-focusable": shouldHighlight, onFocus: _this._onBarFocus.bind(_this, point, index, startColor), fill: _this.props.enableGradient ? "url(#".concat(gradientId, ")") : startColor })));
|
|
480
489
|
});
|
|
481
490
|
// Removing un wanted tooltip div from DOM, when prop not provided, for proper cleanup
|
|
482
491
|
// of unwanted DOM elements, to prevent flacky behaviour in tooltips , that might occur
|