@fluentui/react-charting 5.23.19 → 5.23.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/CHANGELOG.json +31 -1
  2. package/CHANGELOG.md +20 -2
  3. package/dist/react-charting.d.ts +6 -1
  4. package/dist/react-charting.js +1 -1
  5. package/dist/react-charting.min.js +1 -1
  6. package/etc/react-charting.api.md +2 -1
  7. package/lib/components/CommonComponents/CartesianChart.base.js +2 -2
  8. package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
  9. package/lib/components/CommonComponents/CartesianChart.types.d.ts +6 -1
  10. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  11. package/lib/components/DeclarativeChart/DeclarativeChart.js +4 -1
  12. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  13. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +2 -0
  14. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +80 -7
  15. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  16. package/lib/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -0
  17. package/lib/components/VerticalBarChart/VerticalBarChart.base.js +70 -41
  18. package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  19. package/lib/utilities/test-data.d.ts +16 -0
  20. package/lib/utilities/test-data.js +52 -0
  21. package/lib/utilities/test-data.js.map +1 -1
  22. package/lib/utilities/utilities.d.ts +1 -1
  23. package/lib/utilities/utilities.js +29 -4
  24. package/lib/utilities/utilities.js.map +1 -1
  25. package/lib-amd/components/CommonComponents/CartesianChart.base.js +2 -2
  26. package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
  27. package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +6 -1
  28. package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
  29. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +3 -1
  30. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  31. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +2 -0
  32. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +80 -9
  33. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  34. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -0
  35. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +70 -41
  36. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  37. package/lib-amd/utilities/test-data.d.ts +16 -0
  38. package/lib-amd/utilities/test-data.js +53 -1
  39. package/lib-amd/utilities/test-data.js.map +1 -1
  40. package/lib-amd/utilities/utilities.d.ts +1 -1
  41. package/lib-amd/utilities/utilities.js +29 -4
  42. package/lib-amd/utilities/utilities.js.map +1 -1
  43. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +2 -2
  44. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
  45. package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +6 -1
  46. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  47. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +3 -0
  48. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  49. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +2 -0
  50. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +82 -8
  51. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  52. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -0
  53. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +70 -41
  54. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  55. package/lib-commonjs/utilities/test-data.d.ts +16 -0
  56. package/lib-commonjs/utilities/test-data.js +53 -1
  57. package/lib-commonjs/utilities/test-data.js.map +1 -1
  58. package/lib-commonjs/utilities/utilities.d.ts +1 -1
  59. package/lib-commonjs/utilities/utilities.js +29 -4
  60. package/lib-commonjs/utilities/utilities.js.map +1 -1
  61. package/package.json +1 -1
  62. package/src/components/CommonComponents/CartesianChart.types.ts +7 -0
@@ -1,7 +1,7 @@
1
- define(["require", "exports", "tslib", "../../utilities/colors"], function (require, exports, tslib_1, colors_1) {
1
+ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../../utilities/colors"], function (require, exports, tslib_1, d3_array_1, d3_scale_1, d3_format_1, colors_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.findArrayAttributes = exports.transformPlotlyJsonToGaugeProps = exports.transformPlotlyJsonToSankeyProps = exports.transformPlotlyJsonToHeatmapProps = exports.transformPlotlyJsonToHorizontalBarWithAxisProps = exports.transformPlotlyJsonToScatterChartProps = exports.transformPlotlyJsonToGVBCProps = exports.transformPlotlyJsonToVSBCProps = exports.transformPlotlyJsonToDonutProps = exports.getColor = exports.isNumberArray = exports.isDateArray = void 0;
4
+ exports.findArrayAttributes = exports.transformPlotlyJsonToGaugeProps = exports.transformPlotlyJsonToSankeyProps = exports.transformPlotlyJsonToHeatmapProps = exports.transformPlotlyJsonToHorizontalBarWithAxisProps = exports.transformPlotlyJsonToScatterChartProps = exports.transformPlotlyJsonToVBCProps = exports.transformPlotlyJsonToGVBCProps = exports.transformPlotlyJsonToVSBCProps = exports.transformPlotlyJsonToDonutProps = exports.getColor = exports.isNumberArray = exports.isDateArray = void 0;
5
5
  var isDate = function (value) { return !isNaN(Date.parse(value)); };
6
6
  var isNumber = function (value) { return !isNaN(parseFloat(value)) && isFinite(value); };
7
7
  var isDateArray = function (array) { return isArrayOrTypedArray(array) && array.every(isDate); };
@@ -30,8 +30,6 @@ define(["require", "exports", "tslib", "../../utilities/colors"], function (requ
30
30
  color: color,
31
31
  };
32
32
  });
33
- // TODO: innerRadius as a fraction needs to be supported internally. The pixel value depends on
34
- // chart dimensions, arc label dimensions and the legend container height, all of which are subject to change.
35
33
  var width = (layout === null || layout === void 0 ? void 0 : layout.width) || 440;
36
34
  var height = (layout === null || layout === void 0 ? void 0 : layout.height) || 220;
37
35
  var hideLabels = firstData.textinfo ? !['value', 'percent'].includes(firstData.textinfo) : false;
@@ -59,8 +57,6 @@ define(["require", "exports", "tslib", "../../utilities/colors"], function (requ
59
57
  hideLabels: hideLabels,
60
58
  showLabelsInPercent: firstData.textinfo ? firstData.textinfo === 'percent' : true,
61
59
  styles: styles,
62
- // TODO: Render custom hover card based on textinfo
63
- // onRenderCalloutPerDataPoint: undefined,
64
60
  };
65
61
  };
66
62
  exports.transformPlotlyJsonToDonutProps = transformPlotlyJsonToDonutProps;
@@ -105,7 +101,6 @@ define(["require", "exports", "tslib", "../../utilities/colors"], function (requ
105
101
  };
106
102
  };
107
103
  exports.transformPlotlyJsonToVSBCProps = transformPlotlyJsonToVSBCProps;
108
- // TODO: Add support for continuous x-axis in grouped vertical bar chart
109
104
  var transformPlotlyJsonToGVBCProps = function (jsonObj, colorMap) {
110
105
  var data = jsonObj.data, layout = jsonObj.layout;
111
106
  var mapXToDataPoints = {};
@@ -137,6 +132,84 @@ define(["require", "exports", "tslib", "../../utilities/colors"], function (requ
137
132
  };
138
133
  };
139
134
  exports.transformPlotlyJsonToGVBCProps = transformPlotlyJsonToGVBCProps;
135
+ var transformPlotlyJsonToVBCProps = function (jsonObj, colorMap) {
136
+ var data = jsonObj.data, layout = jsonObj.layout;
137
+ var vbcData = [];
138
+ data.forEach(function (series, index) {
139
+ var _a, _b, _c;
140
+ if (!series.x) {
141
+ return;
142
+ }
143
+ var scale = (0, d3_scale_1.scaleLinear)()
144
+ .domain((0, d3_array_1.extent)(series.x))
145
+ .nice();
146
+ var _d = scale.domain(), xMin = _d[0], xMax = _d[1];
147
+ xMin = typeof ((_a = series.xbins) === null || _a === void 0 ? void 0 : _a.start) === 'number' ? series.xbins.start : xMin;
148
+ xMax = typeof ((_b = series.xbins) === null || _b === void 0 ? void 0 : _b.end) === 'number' ? series.xbins.end : xMax;
149
+ var bin = (0, d3_array_1.bin)().domain([xMin, xMax]);
150
+ if (typeof ((_c = series.xbins) === null || _c === void 0 ? void 0 : _c.size) === 'number') {
151
+ var thresholds = [];
152
+ var th = xMin;
153
+ var precision = (0, d3_format_1.precisionFixed)(series.xbins.size);
154
+ var format = (0, d3_format_1.format)(".".concat(precision, "f"));
155
+ while (th < xMax + series.xbins.size) {
156
+ thresholds.push(parseFloat(format(th)));
157
+ th += series.xbins.size;
158
+ }
159
+ xMin = thresholds[0];
160
+ xMax = thresholds[thresholds.length - 1];
161
+ bin.domain([xMin, xMax]).thresholds(thresholds);
162
+ }
163
+ var buckets = bin(series.x);
164
+ // If the start or end of xbins is specified, then the number of datapoints may become less than x.length
165
+ var totalDataPoints = (0, d3_array_1.merge)(buckets).length;
166
+ buckets.forEach(function (bucket) {
167
+ var legend = series.name || "Series ".concat(index + 1);
168
+ var color = (0, exports.getColor)(legend, colorMap);
169
+ var y = bucket.length;
170
+ if (series.histnorm === 'percent') {
171
+ y = (bucket.length / totalDataPoints) * 100;
172
+ }
173
+ else if (series.histnorm === 'probability') {
174
+ y = bucket.length / totalDataPoints;
175
+ }
176
+ else if (series.histnorm === 'density') {
177
+ y = bucket.x0 === bucket.x1 ? 0 : bucket.length / (bucket.x1 - bucket.x0);
178
+ }
179
+ else if (series.histnorm === 'probability density') {
180
+ y = bucket.x0 === bucket.x1 ? 0 : bucket.length / (totalDataPoints * (bucket.x1 - bucket.x0));
181
+ }
182
+ else if (series.histfunc === 'sum') {
183
+ y = (0, d3_array_1.sum)(bucket);
184
+ }
185
+ else if (series.histfunc === 'avg') {
186
+ y = bucket.length === 0 ? 0 : (0, d3_array_1.sum)(bucket) / bucket.length;
187
+ }
188
+ else if (series.histfunc === 'min') {
189
+ y = (0, d3_array_1.min)(bucket);
190
+ }
191
+ else if (series.histfunc === 'max') {
192
+ y = (0, d3_array_1.max)(bucket);
193
+ }
194
+ vbcData.push({
195
+ x: (bucket.x1 + bucket.x0) / 2,
196
+ y: y,
197
+ legend: legend,
198
+ color: color,
199
+ xAxisCalloutData: "[".concat(bucket.x0, " - ").concat(bucket.x1, ")"),
200
+ });
201
+ });
202
+ });
203
+ return {
204
+ data: vbcData,
205
+ chartTitle: layout === null || layout === void 0 ? void 0 : layout.title,
206
+ // width: layout?.width,
207
+ // height: layout?.height,
208
+ hideLegend: true,
209
+ barWidth: 24,
210
+ };
211
+ };
212
+ exports.transformPlotlyJsonToVBCProps = transformPlotlyJsonToVBCProps;
140
213
  var transformPlotlyJsonToScatterChartProps = function (jsonObj, isAreaChart, colorMap) {
141
214
  var data = jsonObj.data, layout = jsonObj.layout;
142
215
  var chartData = data.map(function (series, index) {
@@ -208,8 +281,6 @@ define(["require", "exports", "tslib", "../../utilities/colors"], function (requ
208
281
  };
209
282
  };
210
283
  exports.transformPlotlyJsonToHorizontalBarWithAxisProps = transformPlotlyJsonToHorizontalBarWithAxisProps;
211
- // FIXME: Order of string axis ticks does not match the order in plotly json
212
- // TODO: Add support for custom hover card
213
284
  var transformPlotlyJsonToHeatmapProps = function (jsonObj) {
214
285
  var _a, _b, _c;
215
286
  var data = jsonObj.data, layout = jsonObj.layout;
@@ -1 +1 @@
1
- {"version":3,"file":"PlotlySchemaAdapter.js","sourceRoot":"../src/","sources":["components/DeclarativeChart/PlotlySchemaAdapter.ts"],"names":[],"mappings":";;;;IA2BA,IAAM,MAAM,GAAG,UAAC,KAAU,IAAc,OAAA,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAzB,CAAyB,CAAC;IAClE,IAAM,QAAQ,GAAG,UAAC,KAAU,IAAc,OAAA,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,EAA5C,CAA4C,CAAC;IAChF,IAAM,WAAW,GAAG,UAA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CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,cAAc,GAAG,GAAG,CAAC,CAAC;aACnD;SACF;IACH,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 { IDonutChartProps } from '../DonutChart/index';\nimport {\n IChartDataPoint,\n IChartProps,\n IHorizontalBarChartWithAxisDataPoint,\n ILineChartPoints,\n IVerticalStackedChartProps,\n IHeatMapChartData,\n IHeatMapChartDataPoint,\n IGroupedVerticalBarChartData,\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';\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 = (legendLabel: string, colorMap: React.MutableRefObject<Map<string, string>>): string => {\n if (!colorMap.current.has(legendLabel)) {\n const nextColor = getNextColor(colorMap.current.size + 1);\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): 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);\n return {\n legend: label,\n data: firstData.values?.[index],\n color,\n };\n });\n\n // TODO: innerRadius as a fraction needs to be supported internally. The pixel value depends on\n // chart dimensions, arc label dimensions and the legend container height, all of which are subject to change.\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 // TODO: Render custom hover card based on textinfo\n // onRenderCalloutPerDataPoint: undefined,\n };\n};\n\nexport const transformPlotlyJsonToVSBCProps = (\n jsonObj: any,\n colorMap: React.MutableRefObject<Map<string, string>>,\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);\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);\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\n// TODO: Add support for continuous x-axis in grouped vertical bar chart\nexport const transformPlotlyJsonToGVBCProps = (\n jsonObj: any,\n colorMap: React.MutableRefObject<Map<string, string>>,\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);\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 transformPlotlyJsonToScatterChartProps = (\n jsonObj: any,\n isAreaChart: boolean,\n colorMap: React.MutableRefObject<Map<string, string>>,\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);\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 } as IAreaChartProps;\n } else {\n return {\n data: chartProps,\n } as ILineChartProps;\n }\n};\n\nexport const transformPlotlyJsonToHorizontalBarWithAxisProps = (\n jsonObj: any,\n colorMap: React.MutableRefObject<Map<string, string>>,\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);\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 || 350;\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 gapFactor = 0.5;\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\n// FIXME: Order of string axis ticks does not match the order in plotly json\n// TODO: Add support for custom hover card\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?.map((arr: any) => arr[0] * (zMax - zMin) + zMin);\n const rangeValuesForColorScale: string[] = 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): 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(x => x.source !== x.target); // Filter out self-references (circular links)\n\n const sankeyChartData = {\n nodes: node.label.map((label: string, index: number) => {\n const color = getColor(label, colorMap);\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): 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);\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);\n sublabelColor = color;\n } else {\n sublabel = `\\u25BC ${Math.abs(diff)}`;\n const color = getColor(firstData.delta.decreasing?.color || '', colorMap);\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":";;;;IAgCA,IAAM,MAAM,GAAG,UAAC,KAAU,IAAc,OAAA,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAzB,CAAyB,CAAC;IAClE,IAAM,QAAQ,GAAG,UAAC,KAAU,IAAc,OAAA,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,EAA5C,CAA4C,CAAC;IAChF,IAAM,WAAW,GAAG,UAAC,KAAY,IAAc,OAAA,mBAAmB,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,EAAjD,CAAiD,CAAC;IAA3F,QAAA,WAAW,eAAgF;IACjG,IAAM,aAAa,GAAG,UAAC,KAAY,IAAc,OAAA,mBAAmB,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAnD,CAAmD,CAAC;IAA/F,QAAA,aAAa,iBAAkF;IAErG,IAAM,QAAQ,GAAG,UAAC,WAAmB,EAAE,QAAqD;QACjG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE;YACtC,IAAM,SAAS,GAAG,IAAA,qBAAY,EAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;YAC1D,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;YAC7C,OAAO,SA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CAAS,EAAE,WAAgB;QACjE,IAAI,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/B,IAAI,cAAc,GAAG,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAC5C,IAAI,CAAC,KAAK,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;YAC1B,IAAI,mBAAmB,CAAC,IAAI,CAAC,EAAE;gBAC7B,eAAe,CAAC,IAAI,CAAC,YAAY,GAAG,cAAc,CAAC,CAAC;aACrD;SACF;aAAM;YACL,IAAI,YAAY,CAAC,CAAC,CAAC,EAAE;gBACnB,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;oBACvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;wBACpC,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;4BAC1B,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,cAAc,GAAG,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;yBACjE;qBACF;iBACF;aACF;iBAAM,IAAI,aAAa,CAAC,IAAI,CAAC,EAAE;gBAC9B,cAAc,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,EAAE,cAAc,GAAG,GAAG,CAAC,CAAC;aACnD;SACF;IACH,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 = (legendLabel: string, colorMap: React.MutableRefObject<Map<string, string>>): string => {\n if (!colorMap.current.has(legendLabel)) {\n const nextColor = getNextColor(colorMap.current.size + 1);\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): 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);\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): 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);\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);\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): 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);\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): 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);\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 };\n};\n\nexport const transformPlotlyJsonToScatterChartProps = (\n jsonObj: any,\n isAreaChart: boolean,\n colorMap: React.MutableRefObject<Map<string, string>>,\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);\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 } as IAreaChartProps;\n } else {\n return {\n data: chartProps,\n } as ILineChartProps;\n }\n};\n\nexport const transformPlotlyJsonToHorizontalBarWithAxisProps = (\n jsonObj: any,\n colorMap: React.MutableRefObject<Map<string, string>>,\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);\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 || 350;\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 gapFactor = 0.5;\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?.map((arr: any) => arr[0] * (zMax - zMin) + zMin);\n const rangeValuesForColorScale: string[] = 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): 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(x => x.source !== x.target); // Filter out self-references (circular links)\n\n const sankeyChartData = {\n nodes: node.label.map((label: string, index: number) => {\n const color = getColor(label, colorMap);\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): 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);\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);\n sublabelColor = color;\n } else {\n sublabel = `\\u25BC ${Math.abs(diff)}`;\n const color = getColor(firstData.delta.decreasing?.color || '', colorMap);\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"]}
@@ -24,6 +24,7 @@ export declare class VerticalBarChartBase extends React.Component<IVerticalBarCh
24
24
  private _bars;
25
25
  private _xAxisLabels;
26
26
  private _yMax;
27
+ private _yMin;
27
28
  private _isHavingLine;
28
29
  private _tooltipId;
29
30
  private _xAxisType;
@@ -56,6 +57,7 @@ export declare class VerticalBarChartBase extends React.Component<IVerticalBarCh
56
57
  private _lineFocus;
57
58
  private _lineHoverFocus;
58
59
  private _getScales;
60
+ private _calculateMinBarHeight;
59
61
  private _createNumericBars;
60
62
  private _createStringBars;
61
63
  private _createDateBars;
@@ -255,7 +255,7 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-shape", "d3-sele
255
255
  var xBarScale;
256
256
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
257
257
  var yBarScale = (0, d3_scale_1.scaleLinear)()
258
- .domain([0, _this._yMax])
258
+ .domain([_this.props.supportNegativeData ? _this._yMin : 0, _this._yMax])
259
259
  .range([0, containerHeight - _this.margins.bottom - _this.margins.top]);
260
260
  if (_this._xAxisType === index_2.XAxisTypes.NumericAxis) {
261
261
  var xMax = (0, d3_array_1.max)(_this._points, function (point) { return point.x; });
@@ -347,6 +347,7 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-shape", "d3-sele
347
347
  if (yAxisData && yAxisData.yAxisDomainValues.length) {
348
348
  var domainValue = yAxisData.yAxisDomainValues;
349
349
  _this._yMax = Math.max(domainValue[domainValue.length - 1], _this.props.yMaxValue || 0);
350
+ _this._yMin = Math.min(domainValue[0], _this.props.yMinValue || 0);
350
351
  }
351
352
  };
352
353
  /**
@@ -452,6 +453,7 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-shape", "d3-sele
452
453
  this._adjustProps();
453
454
  this._xAxisLabels = this._points.map(function (point) { return point.x; });
454
455
  this._yMax = Math.max((0, d3_array_1.max)(this._points, function (point) { return point.y; }), this.props.yMaxValue || 0);
456
+ this._yMin = Math.min((0, d3_array_1.min)(this._points, function (point) { return point.y; }), this.props.yMinValue || 0);
455
457
  var legendBars = this._getLegendData(this._points, this.props.theme.palette);
456
458
  this._classNames = getClassNames(this.props.styles, {
457
459
  theme: this.props.theme,
@@ -465,7 +467,7 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-shape", "d3-sele
465
467
  tickValues: this.props.tickValues,
466
468
  tickFormat: this.props.tickFormat,
467
469
  };
468
- return !this._isChartEmpty() ? (React.createElement(index_1.CartesianChart, tslib_1.__assign({}, this.props, { chartTitle: this._getChartTitle(), points: this._points, chartType: index_2.ChartTypes.VerticalBarChart, xAxisType: this._xAxisType, createYAxis: index_2.createNumericYAxis, calloutProps: calloutProps, tickParams: tickParams }, (this._isHavingLine && this._noLegendHighlighted() && { isCalloutForStack: true }), { legendBars: legendBars, datasetForXAxisDomain: this._xAxisLabels, barwidth: this._barWidth, focusZoneDirection: react_focus_1.FocusZoneDirection.horizontal, customizedCallout: this._getCustomizedCallout(), createStringYAxis: index_2.createStringYAxis, getmargins: this._getMargins, getMinMaxOfYAxis: index_2.findVerticalNumericMinMaxOfY, getGraphData: this._getGraphData, getDomainNRangeValues: this._getDomainNRangeValues, getAxisData: this._getAxisData, onChartMouseLeave: this._handleChartMouseLeave, getDomainMargins: this._getDomainMargins }, (this._xAxisType === index_2.XAxisTypes.StringAxis && {
470
+ return !this._isChartEmpty() ? (React.createElement(index_1.CartesianChart, tslib_1.__assign({}, this.props, { chartTitle: this._getChartTitle(), points: this._points, supportNegativeData: this.props.supportNegativeData, chartType: index_2.ChartTypes.VerticalBarChart, xAxisType: this._xAxisType, createYAxis: index_2.createNumericYAxis, calloutProps: calloutProps, tickParams: tickParams }, (this._isHavingLine && this._noLegendHighlighted() && { isCalloutForStack: true }), { legendBars: legendBars, datasetForXAxisDomain: this._xAxisLabels, barwidth: this._barWidth, focusZoneDirection: react_focus_1.FocusZoneDirection.horizontal, customizedCallout: this._getCustomizedCallout(), createStringYAxis: index_2.createStringYAxis, getmargins: this._getMargins, getMinMaxOfYAxis: index_2.findVerticalNumericMinMaxOfY, getGraphData: this._getGraphData, getDomainNRangeValues: this._getDomainNRangeValues, getAxisData: this._getAxisData, onChartMouseLeave: this._handleChartMouseLeave, getDomainMargins: this._getDomainMargins }, (this._xAxisType === index_2.XAxisTypes.StringAxis && {
469
471
  xAxisInnerPadding: this._xAxisInnerPadding,
470
472
  xAxisOuterPadding: this._xAxisOuterPadding,
471
473
  }), {
@@ -527,11 +529,19 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-shape", "d3-sele
527
529
  });
528
530
  }
529
531
  };
532
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
533
+ VerticalBarChartBase.prototype._calculateMinBarHeight = function (yMin, yMax, yReferencePoint, yBarScale) {
534
+ var maxHeightFromBaseline = yMax < 0
535
+ ? Math.abs(yMin - yReferencePoint)
536
+ : Math.max(Math.abs(yMax - yReferencePoint), Math.abs(yMin - yReferencePoint));
537
+ return Math.ceil(yBarScale(maxHeightFromBaseline) / 100.0);
538
+ };
530
539
  VerticalBarChartBase.prototype._createNumericBars = function (containerHeight, containerWidth, xElement) {
531
540
  var _this = this;
532
541
  var _a = this.props.useSingleColor, useSingleColor = _a === void 0 ? false : _a;
533
542
  var _b = this._getScales(containerHeight, containerWidth), xBarScale = _b.xBarScale, yBarScale = _b.yBarScale;
534
543
  var colorScale = this._createColors();
544
+ var yReferencePoint = this._yMax < 0 ? this._yMax : 0;
535
545
  var bars = this._points.map(function (point, index) {
536
546
  var _a, _b, _c, _d, _e, _f;
537
547
  var shouldHighlight = _this._legendHighlighted(point.legend) || _this._noLegendHighlighted() ? true : false;
@@ -540,19 +550,25 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-shape", "d3-sele
540
550
  legendColor: _this.state.color,
541
551
  shouldHighlight: shouldHighlight,
542
552
  });
543
- var barHeight = Math.max(yBarScale(point.y), 0);
544
- var adjustedBarHeight = 0;
545
- if (barHeight <= 0) {
553
+ var barHeight = yBarScale(point.y) - yBarScale(yReferencePoint);
554
+ var isHeightNegative = barHeight < 0;
555
+ barHeight = Math.abs(barHeight);
556
+ // Calculate threshold for minimum visible bar height
557
+ var minBarHeight = _this._calculateMinBarHeight(_this._yMin, _this._yMax, yReferencePoint, yBarScale);
558
+ var adjustedBarHeight = barHeight;
559
+ if (barHeight === 0 || (isHeightNegative && !_this.props.supportNegativeData)) {
546
560
  return React.createElement(React.Fragment, { key: point.x }, " ");
547
561
  }
548
- else if (barHeight <= Math.ceil(yBarScale(_this._yMax) / 100.0)) {
549
- adjustedBarHeight = Math.ceil(yBarScale(_this._yMax) / 100.0);
550
- }
551
- else {
552
- adjustedBarHeight = barHeight;
562
+ // Adjust bar height if it's smaller than the threshold
563
+ else if (barHeight <= minBarHeight) {
564
+ adjustedBarHeight = minBarHeight;
553
565
  }
554
566
  var xPoint = xBarScale(point.x) - _this._barWidth / 2;
555
- var yPoint = containerHeight - _this.margins.bottom - adjustedBarHeight;
567
+ var yPoint = containerHeight -
568
+ _this.margins.bottom -
569
+ (isHeightNegative ? -1 * adjustedBarHeight : adjustedBarHeight) -
570
+ yBarScale(yReferencePoint);
571
+ var baselineHeight = containerHeight - _this.margins.bottom - yBarScale(yReferencePoint);
556
572
  var startColor = point.color && !useSingleColor ? point.color : colorScale(point.y);
557
573
  var endColor = startColor;
558
574
  if (_this.props.enableGradient) {
@@ -570,10 +586,10 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-shape", "d3-sele
570
586
  React.createElement("linearGradient", { id: gradientId, x1: "0%", y1: "100%", x2: "0%", y2: "0%" },
571
587
  React.createElement("stop", { offset: "0", stopColor: startColor }),
572
588
  React.createElement("stop", { offset: "100%", stopColor: endColor })))),
573
- React.createElement("rect", { id: (0, Utilities_1.getId)('_VBC_bar_'), x: xPoint, className: _this._classNames.opacityChangeOnHover, y: yPoint, width: _this._barWidth, "data-is-focusable": !_this.props.hideTooltip && shouldHighlight, height: adjustedBarHeight, ref: function (e) {
589
+ React.createElement("rect", { id: (0, Utilities_1.getId)('_VBC_bar_'), x: xPoint, className: _this._classNames.opacityChangeOnHover, y: !isHeightNegative ? yPoint : baselineHeight, width: _this._barWidth, "data-is-focusable": !_this.props.hideTooltip && shouldHighlight, height: adjustedBarHeight, ref: function (e) {
574
590
  _this._refCallback(e, point.legend);
575
591
  }, onClick: point.onClick, onMouseOver: _this._onBarHover.bind(_this, point, startColor), "aria-label": _this._getAriaLabel(point), role: "img", onMouseLeave: _this._onBarLeave, onFocus: _this._onBarFocus.bind(_this, point, index, startColor), onBlur: _this._onBarLeave, fill: _this.props.enableGradient ? "url(#".concat(gradientId, ")") : startColor, rx: _this.props.roundCorners ? 3 : 0 }),
576
- _this._renderBarLabel(xPoint, yPoint, point.y, point.legend)));
592
+ _this._renderBarLabel(xPoint, yPoint, point.y, point.legend, isHeightNegative)));
577
593
  });
578
594
  // Removing un wanted tooltip div from DOM, when prop not provided.
579
595
  if (!this.props.showXAxisLablesTooltip) {
@@ -605,21 +621,28 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-shape", "d3-sele
605
621
  var _a = this.props.useSingleColor, useSingleColor = _a === void 0 ? false : _a;
606
622
  var _b = this._getScales(containerHeight, containerWidth), xBarScale = _b.xBarScale, yBarScale = _b.yBarScale;
607
623
  var colorScale = this._createColors();
624
+ var yReferencePoint = this._yMax < 0 ? this._yMax : 0;
608
625
  var bars = this._points.map(function (point, index) {
609
626
  var _a, _b, _c, _d, _e, _f;
610
- var barHeight = Math.max(yBarScale(point.y), 0);
611
- var adjustedBarHeight = 0;
612
- if (barHeight <= 0) {
613
- return React.createElement(React.Fragment, { key: point.x instanceof Date ? point.x.getTime() : point.x }, " ");
627
+ var barHeight = yBarScale(point.y) - yBarScale(yReferencePoint);
628
+ var isHeightNegative = barHeight < 0;
629
+ barHeight = Math.abs(barHeight);
630
+ // Calculate threshold for minimum visible bar height
631
+ var minBarHeight = _this._calculateMinBarHeight(_this._yMin, _this._yMax, yReferencePoint, yBarScale);
632
+ var adjustedBarHeight = barHeight;
633
+ if (barHeight === 0 || (isHeightNegative && !_this.props.supportNegativeData)) {
634
+ return React.createElement(React.Fragment, { key: point.x }, " ");
614
635
  }
615
- else if (barHeight <= Math.ceil(yBarScale(_this._yMax) / 100.0)) {
616
- adjustedBarHeight = Math.ceil(yBarScale(_this._yMax) / 100.0);
617
- }
618
- else {
619
- adjustedBarHeight = barHeight;
636
+ // Adjust bar height if it's smaller than the threshold
637
+ else if (barHeight <= minBarHeight) {
638
+ adjustedBarHeight = minBarHeight;
620
639
  }
621
640
  var xPoint = xBarScale(point.x);
622
- var yPoint = containerHeight - _this.margins.bottom - adjustedBarHeight;
641
+ var yPoint = containerHeight -
642
+ _this.margins.bottom -
643
+ (isHeightNegative ? -1 * adjustedBarHeight : adjustedBarHeight) -
644
+ yBarScale(yReferencePoint);
645
+ var baselineHeight = containerHeight - _this.margins.bottom - yBarScale(yReferencePoint);
623
646
  // Setting the bar width here is safe because there are no dependencies earlier in the code
624
647
  // that rely on the width of bars in vertical bar charts with string x-axis.
625
648
  _this._barWidth = (0, index_2.getBarWidth)(_this.props.barWidth, _this.props.maxBarWidth, xBarScale.bandwidth());
@@ -640,10 +663,10 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-shape", "d3-sele
640
663
  React.createElement("linearGradient", { id: gradientId, x1: "0%", y1: "100%", x2: "0%", y2: "0%" },
641
664
  React.createElement("stop", { offset: "0", stopColor: startColor }),
642
665
  React.createElement("stop", { offset: "100%", stopColor: endColor })))),
643
- React.createElement("rect", { id: (0, Utilities_1.getId)('_VBC_bar_'), x: xPoint, y: yPoint, width: _this._barWidth, height: adjustedBarHeight, "aria-label": _this._getAriaLabel(point), role: "img", ref: function (e) {
666
+ React.createElement("rect", { id: (0, Utilities_1.getId)('_VBC_bar_'), x: xPoint, y: !isHeightNegative ? yPoint : baselineHeight, width: _this._barWidth, height: adjustedBarHeight, "aria-label": _this._getAriaLabel(point), role: "img", ref: function (e) {
644
667
  _this._refCallback(e, point.legend);
645
668
  }, onClick: point.onClick, onMouseOver: _this._onBarHover.bind(_this, point, startColor), onMouseLeave: _this._onBarLeave, onBlur: _this._onBarLeave, "data-is-focusable": !_this.props.hideTooltip, onFocus: _this._onBarFocus.bind(_this, point, index, startColor), fill: _this.props.enableGradient ? "url(#".concat(gradientId, ")") : startColor, rx: _this.props.roundCorners ? 3 : 0 }),
646
- _this._renderBarLabel(xPoint, yPoint, point.y, point.legend)));
669
+ _this._renderBarLabel(xPoint, yPoint, point.y, point.legend, isHeightNegative)));
647
670
  });
648
671
  // Removing un wanted tooltip div from DOM, when prop not provided.
649
672
  if (!this.props.showXAxisLablesTooltip) {
@@ -676,6 +699,7 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-shape", "d3-sele
676
699
  var _a = this.props.useSingleColor, useSingleColor = _a === void 0 ? false : _a;
677
700
  var _b = this._getScales(containerHeight, containerWidth), xBarScale = _b.xBarScale, yBarScale = _b.yBarScale;
678
701
  var colorScale = this._createColors();
702
+ var yReferencePoint = this._yMax < 0 ? this._yMax : 0;
679
703
  var bars = this._points.map(function (point, index) {
680
704
  var _a, _b, _c, _d, _e, _f;
681
705
  var shouldHighlight = _this._legendHighlighted(point.legend) || _this._noLegendHighlighted() ? true : false;
@@ -684,19 +708,25 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-shape", "d3-sele
684
708
  legendColor: _this.state.color,
685
709
  shouldHighlight: shouldHighlight,
686
710
  });
687
- var barHeight = Math.max(yBarScale(point.y), 0);
688
- var adjustedBarHeight = 0;
689
- if (barHeight <= 0) {
690
- return React.createElement(React.Fragment, { key: point.x instanceof Date ? point.x.getTime() : point.x }, " ");
691
- }
692
- else if (barHeight <= Math.ceil(yBarScale(_this._yMax) / 100.0)) {
693
- adjustedBarHeight = Math.ceil(yBarScale(_this._yMax) / 100.0);
711
+ var barHeight = yBarScale(point.y) - yBarScale(yReferencePoint);
712
+ var isHeightNegative = barHeight < 0;
713
+ barHeight = Math.abs(barHeight);
714
+ // Calculate threshold for minimum visible bar height
715
+ var minBarHeight = _this._calculateMinBarHeight(_this._yMin, _this._yMax, yReferencePoint, yBarScale);
716
+ var adjustedBarHeight = barHeight;
717
+ if (barHeight === 0 || (isHeightNegative && !_this.props.supportNegativeData)) {
718
+ return React.createElement(React.Fragment, { key: point.x }, " ");
694
719
  }
695
- else {
696
- adjustedBarHeight = barHeight;
720
+ // Adjust bar height if it's smaller than the threshold
721
+ else if (barHeight <= minBarHeight) {
722
+ adjustedBarHeight = minBarHeight;
697
723
  }
698
724
  var xPoint = xBarScale(point.x) - _this._barWidth / 2;
699
- var yPoint = containerHeight - _this.margins.bottom - adjustedBarHeight;
725
+ var yPoint = containerHeight -
726
+ _this.margins.bottom -
727
+ (isHeightNegative ? -1 * adjustedBarHeight : adjustedBarHeight) -
728
+ yBarScale(yReferencePoint);
729
+ var baselineHeight = containerHeight - _this.margins.bottom - yBarScale(yReferencePoint);
700
730
  var startColor = point.color && !useSingleColor ? point.color : colorScale(point.y);
701
731
  var endColor = startColor;
702
732
  if (_this.props.enableGradient) {
@@ -714,10 +744,10 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-shape", "d3-sele
714
744
  React.createElement("linearGradient", { id: gradientId, x1: "0%", y1: "100%", x2: "0%", y2: "0%" },
715
745
  React.createElement("stop", { offset: "0", stopColor: startColor }),
716
746
  React.createElement("stop", { offset: "100%", stopColor: endColor })))),
717
- React.createElement("rect", { id: (0, Utilities_1.getId)('_VBC_bar_'), x: xPoint, className: _this._classNames.opacityChangeOnHover, y: yPoint, width: _this._barWidth, "data-is-focusable": !_this.props.hideTooltip && shouldHighlight, height: adjustedBarHeight, ref: function (e) {
747
+ React.createElement("rect", { id: (0, Utilities_1.getId)('_VBC_bar_'), x: xPoint, className: _this._classNames.opacityChangeOnHover, y: !isHeightNegative ? yPoint : baselineHeight, width: _this._barWidth, "data-is-focusable": !_this.props.hideTooltip && shouldHighlight, height: adjustedBarHeight, ref: function (e) {
718
748
  _this._refCallback(e, point.legend);
719
749
  }, onClick: point.onClick, onMouseOver: _this._onBarHover.bind(_this, point, startColor), "aria-label": _this._getAriaLabel(point), role: "img", onMouseLeave: _this._onBarLeave, onFocus: _this._onBarFocus.bind(_this, point, index, startColor), onBlur: _this._onBarLeave, fill: _this.props.enableGradient ? "url(#".concat(gradientId, ")") : startColor, rx: _this.props.roundCorners ? 3 : 0 }),
720
- _this._renderBarLabel(xPoint, yPoint, point.y, point.legend)));
750
+ _this._renderBarLabel(xPoint, yPoint, point.y, point.legend, isHeightNegative)));
721
751
  });
722
752
  // Removing un wanted tooltip div from DOM, when prop not provided.
723
753
  if (!this.props.showXAxisLablesTooltip) {
@@ -766,17 +796,16 @@ define(["require", "exports", "tslib", "react", "d3-array", "d3-shape", "d3-sele
766
796
  activeLegend: '',
767
797
  });
768
798
  };
769
- VerticalBarChartBase.prototype._renderBarLabel = function (xPoint, yPoint, barValue, legend) {
799
+ VerticalBarChartBase.prototype._renderBarLabel = function (xPoint, yPoint, barValue, legend, isNegativeBar) {
770
800
  if (this.props.hideLabels ||
771
801
  this._barWidth < 16 ||
772
802
  !(this._legendHighlighted(legend) || this._noLegendHighlighted())) {
773
803
  return null;
774
804
  }
775
- return (React.createElement("text", { x: xPoint + this._barWidth / 2, y: yPoint - 6, textAnchor: "middle", className: this._classNames.barLabel, "aria-hidden": true }, (0, index_2.formatValueWithSIPrefix)(barValue)));
805
+ return (React.createElement("text", { x: xPoint + this._barWidth / 2, y: isNegativeBar ? yPoint + 12 : yPoint - 6, textAnchor: "middle", className: this._classNames.barLabel, "aria-hidden": true }, (0, index_2.formatValueWithSIPrefix)(barValue)));
776
806
  };
777
807
  VerticalBarChartBase.prototype._isChartEmpty = function () {
778
- return (this._points.length === 0 ||
779
- ((0, d3_array_1.max)(this._points, function (point) { return point.y; }) <= 0 && !this._isHavingLine));
808
+ return this._points.length === 0 || (this._points.every(function (point) { return point.y === 0; }) && !this._isHavingLine);
780
809
  };
781
810
  VerticalBarChartBase.defaultProps = {
782
811
  maxBarWidth: 24,