@fluentui/react-charting 5.23.96 → 5.23.97

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 (38) hide show
  1. package/CHANGELOG.json +34 -1
  2. package/CHANGELOG.md +14 -2
  3. package/dist/react-charting.d.ts +8 -2
  4. package/dist/react-charting.js +1 -1
  5. package/dist/react-charting.min.js +1 -1
  6. package/etc/react-charting.api.md +8 -2
  7. package/lib/components/ChartTable/ChartTable.base.js +2 -2
  8. package/lib/components/ChartTable/ChartTable.base.js.map +1 -1
  9. package/lib/components/ChartTable/ChartTable.types.d.ts +9 -2
  10. package/lib/components/ChartTable/ChartTable.types.js.map +1 -1
  11. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +0 -1
  12. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +145 -28
  13. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  14. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +1 -0
  15. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +40 -24
  16. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  17. package/lib-amd/components/ChartTable/ChartTable.base.js +2 -2
  18. package/lib-amd/components/ChartTable/ChartTable.base.js.map +1 -1
  19. package/lib-amd/components/ChartTable/ChartTable.types.d.ts +9 -2
  20. package/lib-amd/components/ChartTable/ChartTable.types.js.map +1 -1
  21. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +0 -1
  22. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +152 -37
  23. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  24. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +1 -0
  25. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +39 -24
  26. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  27. package/lib-commonjs/components/ChartTable/ChartTable.base.js +2 -2
  28. package/lib-commonjs/components/ChartTable/ChartTable.base.js.map +1 -1
  29. package/lib-commonjs/components/ChartTable/ChartTable.types.d.ts +9 -2
  30. package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -1
  31. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +0 -1
  32. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +152 -36
  33. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  34. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +1 -0
  35. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +39 -23
  36. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  37. package/package.json +2 -2
  38. package/src/components/ChartTable/ChartTable.types.ts +3 -2
@@ -439,9 +439,15 @@ export interface IChartProps {
439
439
  export interface IChartTableProps {
440
440
  className?: string;
441
441
  componentRef?: IRefObject<IChart>;
442
- headers: (string | number | boolean | null)[] | (string | number | boolean | null)[][];
442
+ headers: {
443
+ value: string | number | boolean | null;
444
+ style?: React_2.CSSProperties;
445
+ }[];
443
446
  height?: string | number;
444
- rows: (string | number | boolean | null)[][];
447
+ rows: {
448
+ value: string | number | boolean | null;
449
+ style?: React_2.CSSProperties;
450
+ }[][];
445
451
  styles?: IStyleFunctionOrObject<IChartTableStyleProps, IChartTableStyles>;
446
452
  theme?: ITheme;
447
453
  width?: string | number;
@@ -35,8 +35,8 @@ var ChartTableBase = /** @class */ (function (_super) {
35
35
  width: width ? "".concat(width, "px") : '100%',
36
36
  } },
37
37
  React.createElement("thead", null,
38
- React.createElement("tr", null, headers.map(function (header, idx) { return (React.createElement("th", { key: idx, className: classNames.headerCell }, header)); }))),
39
- rows && rows.length > 0 && (React.createElement("tbody", null, rows.map(function (row, rowIdx) { return (React.createElement("tr", { key: rowIdx }, row.map(function (cell, colIdx) { return (React.createElement("td", { key: colIdx, className: classNames.bodyCell }, cell)); }))); })))))))));
38
+ React.createElement("tr", null, headers.map(function (header, idx) { return (React.createElement("th", { key: idx, className: classNames.headerCell, style: header === null || header === void 0 ? void 0 : header.style }, header.value)); }))),
39
+ rows && rows.length > 0 && (React.createElement("tbody", null, rows.map(function (row, rowIdx) { return (React.createElement("tr", { key: rowIdx }, row.map(function (cell, colIdx) { return (React.createElement("td", { key: colIdx, className: classNames.bodyCell, style: cell === null || cell === void 0 ? void 0 : cell.style }, cell.value)); }))); })))))))));
40
40
  };
41
41
  return ChartTableBase;
42
42
  }(React.Component));
@@ -1 +1 @@
1
- {"version":3,"file":"ChartTable.base.js","sourceRoot":"../src/","sources":["components/ChartTable/ChartTable.base.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEnG,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAE7D,IAAM,aAAa,GAAG,kBAAkB,EAA4C,CAAC;AAErF;IAAoC,kCAAiC;IAInE,wBAAY,KAAuB;QACjC,YAAA,MAAK,YAAC,KAAK,CAAC,SAAC;QAIR,aAAO,GAAG,UAAC,IAA0B;YAC1C,OAAO,OAAO,CAAC,KAAI,CAAC,SAAS,EAAE,SAAS,EAAE,KAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC/D,CAAC,CAAC;QALA,sBAAsB,CAAC,KAAI,CAAC,CAAC;QAC7B,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;;IACpC,CAAC;IAKM,+BAAM,GAAb;QAAA,iBA4DC;QA3DO,IAAA,KAAkD,IAAI,CAAC,KAAK,EAA1D,OAAO,aAAA,EAAE,IAAI,UAAA,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AE,SAAS,EAAE,UAAU,CAAC,UAAU,IAC3C,MAAM,CACJ,CACN,EAJ6B,CAI7B,CAAC,CACC,CACC;4BACP,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAC1B,mCACG,IAAI,CAAC,GAAG,CAAC,UAAC,GAAG,EAAE,MAAM,IAAK,OAAA,CACzB,4BAAI,GAAG,EAAE,MAAM,IACZ,GAAG,CAAC,GAAG,CAAC,UAAC,IAAI,EAAE,MAAM,IAAK,OAAA,CACzB,4BAAI,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC,QAAQ,IAC5C,IAAI,CACF,CACN,EAJ0B,CAI1B,CAAC,CACC,CACN,EAR0B,CAQ1B,CAAC,CACI,CACT,CACK,CACJ,CACQ,CACZ,CACF,CACP,CAAC;IACJ,CAAC;IACH,qBAAC;AAAD,CAAC,AA1ED,CAAoC,KAAK,CAAC,SAAS,GA0ElD","sourcesContent":["import * as React from 'react';\nimport { IChartTableProps } from './ChartTable.types';\nimport { IChartTableStyleProps, IChartTableStyles } from '../../index';\nimport { classNamesFunction, getRTL, initializeComponentRef } from '@fluentui/react/lib/Utilities';\nimport { IImageExportOptions } from '../../types/index';\nimport { toImage } from '../../utilities/image-export-utils';\n\nconst getClassNames = classNamesFunction<IChartTableStyleProps, IChartTableStyles>();\n\nexport class ChartTableBase extends React.Component<IChartTableProps> {\n private _isRTL: boolean;\n private _rootElem: HTMLDivElement | null;\n\n constructor(props: IChartTableProps) {\n super(props);\n initializeComponentRef(this);\n this._isRTL = getRTL(props.theme);\n }\n public toImage = (opts?: IImageExportOptions): Promise<string> => {\n return toImage(this._rootElem, undefined, this._isRTL, opts);\n };\n\n public render(): JSX.Element {\n const { headers, rows, width, height, styles, theme } = this.props;\n\n const classNames = getClassNames(styles!, {\n theme: theme!,\n });\n\n if (!headers || headers.length === 0) {\n return <div>No data available</div>;\n }\n\n return (\n <div\n ref={el => (this._rootElem = el)}\n className={classNames.root}\n style={{ height: height ? `${height}px` : '650px', overflow: 'hidden' }}\n >\n <svg width={width ?? '100%'} height={height ?? '650px'}>\n <foreignObject x=\"0\" y=\"0\" width=\"100%\" height=\"100%\">\n <div\n style={{\n maxHeight: height ? `${height}px` : '650px',\n overflowY: 'auto',\n overflowX: 'auto',\n }}\n >\n <table\n className={classNames.table}\n style={{\n width: width ? `${width}px` : '100%',\n }}\n >\n <thead>\n <tr>\n {headers.map((header, idx) => (\n <th key={idx} className={classNames.headerCell}>\n {header}\n </th>\n ))}\n </tr>\n </thead>\n {rows && rows.length > 0 && (\n <tbody>\n {rows.map((row, rowIdx) => (\n <tr key={rowIdx}>\n {row.map((cell, colIdx) => (\n <td key={colIdx} className={classNames.bodyCell}>\n {cell}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n )}\n </table>\n </div>\n </foreignObject>\n </svg>\n </div>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"ChartTable.base.js","sourceRoot":"../src/","sources":["components/ChartTable/ChartTable.base.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEnG,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAE7D,IAAM,aAAa,GAAG,kBAAkB,EAA4C,CAAC;AAErF;IAAoC,kCAAiC;IAInE,wBAAY,KAAuB;QACjC,YAAA,MAAK,YAAC,KAAK,CAAC,SAAC;QAIR,aAAO,GAAG,UAAC,IAA0B;YAC1C,OAAO,OAAO,CAAC,KAAI,CAAC,SAAS,EAAE,SAAS,EAAE,KAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC/D,CAAC,CAAC;QALA,sBAAsB,CAAC,KAAI,CAAC,CAAC;QAC7B,KAAI,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;;IACpC,CAAC;IAKM,+BAAM,G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OAAO,CAAC,GAAG,CAAC,UAAC,MAAM,EAAE,GAAG,IAAK,OAAA,CAC5B,4BAAI,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,IACjE,MAAM,CAAC,KAAK,CACV,CACN,EAJ6B,CAI7B,CAAC,CACC,CACC;4BACP,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAC1B,mCACG,IAAI,CAAC,GAAG,CAAC,UAAC,GAAG,EAAE,MAAM,IAAK,OAAA,CACzB,4BAAI,GAAG,EAAE,MAAM,IACZ,GAAG,CAAC,GAAG,CAAC,UAAC,IAAI,EAAE,MAAM,IAAK,OAAA,CACzB,4BAAI,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,IAChE,IAAI,CAAC,KAAK,CACR,CACN,EAJ0B,CAI1B,CAAC,CACC,CACN,EAR0B,CAQ1B,CAAC,CACI,CACT,CACK,CACJ,CACQ,CACZ,CACF,CACP,CAAC;IACJ,CAAC;IACH,qBAAC;AAAD,CAAC,AA1ED,CAAoC,KAAK,CAAC,SAAS,GA0ElD","sourcesContent":["import * as React from 'react';\nimport { IChartTableProps } from './ChartTable.types';\nimport { IChartTableStyleProps, IChartTableStyles } from '../../index';\nimport { classNamesFunction, getRTL, initializeComponentRef } from '@fluentui/react/lib/Utilities';\nimport { IImageExportOptions } from '../../types/index';\nimport { toImage } from '../../utilities/image-export-utils';\n\nconst getClassNames = classNamesFunction<IChartTableStyleProps, IChartTableStyles>();\n\nexport class ChartTableBase extends React.Component<IChartTableProps> {\n private _isRTL: boolean;\n private _rootElem: HTMLDivElement | null;\n\n constructor(props: IChartTableProps) {\n super(props);\n initializeComponentRef(this);\n this._isRTL = getRTL(props.theme);\n }\n public toImage = (opts?: IImageExportOptions): Promise<string> => {\n return toImage(this._rootElem, undefined, this._isRTL, opts);\n };\n\n public render(): JSX.Element {\n const { headers, rows, width, height, styles, theme } = this.props;\n\n const classNames = getClassNames(styles!, {\n theme: theme!,\n });\n\n if (!headers || headers.length === 0) {\n return <div>No data available</div>;\n }\n\n return (\n <div\n ref={el => (this._rootElem = el)}\n className={classNames.root}\n style={{ height: height ? `${height}px` : '650px', overflow: 'hidden' }}\n >\n <svg width={width ?? '100%'} height={height ?? '650px'}>\n <foreignObject x=\"0\" y=\"0\" width=\"100%\" height=\"100%\">\n <div\n style={{\n maxHeight: height ? `${height}px` : '650px',\n overflowY: 'auto',\n overflowX: 'auto',\n }}\n >\n <table\n className={classNames.table}\n style={{\n width: width ? `${width}px` : '100%',\n }}\n >\n <thead>\n <tr>\n {headers.map((header, idx) => (\n <th key={idx} className={classNames.headerCell} style={header?.style}>\n {header.value}\n </th>\n ))}\n </tr>\n </thead>\n {rows && rows.length > 0 && (\n <tbody>\n {rows.map((row, rowIdx) => (\n <tr key={rowIdx}>\n {row.map((cell, colIdx) => (\n <td key={colIdx} className={classNames.bodyCell} style={cell?.style}>\n {cell.value}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n )}\n </table>\n </div>\n </foreignObject>\n </svg>\n </div>\n );\n }\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import * as React from 'react';
1
2
  import { ITheme, IStyle } from '@fluentui/react/lib/Styling';
2
3
  import { IRefObject, IStyleFunctionOrObject } from '@fluentui/react/lib/Utilities';
3
4
  import { IChart } from '../../types/index';
@@ -13,11 +14,17 @@ export interface IChartTableProps {
13
14
  /**
14
15
  * 1d or 2d Array of header values.
15
16
  */
16
- headers: (string | number | boolean | null)[] | (string | number | boolean | null)[][];
17
+ headers: {
18
+ value: string | number | boolean | null;
19
+ style?: React.CSSProperties;
20
+ }[];
17
21
  /**
18
22
  * Array of rows. Each row corresponds to one data entry under each column.
19
23
  */
20
- rows: (string | number | boolean | null)[][];
24
+ rows: {
25
+ value: string | number | boolean | null;
26
+ style?: React.CSSProperties;
27
+ }[][];
21
28
  /**
22
29
  * Optional width for the table
23
30
  * @default '100%'
@@ -1 +1 @@
1
- {"version":3,"file":"ChartTable.types.js","sourceRoot":"../src/","sources":["components/ChartTable/ChartTable.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ITheme, IStyle } from '@fluentui/react/lib/Styling';\nimport { IRefObject, IStyleFunctionOrObject } from '@fluentui/react/lib/Utilities';\nimport { IChart } from '../../types/index';\n\nexport interface IChartTableStyleProps {\n theme: ITheme;\n className?: string;\n}\n\n/**\n * Chart Table properties\n * {@docCategory ChartTable}\n */\nexport interface IChartTableProps {\n /**\n * 1d or 2d Array of header values.\n */\n headers: (string | number | boolean | null)[] | (string | number | boolean | null)[][];\n\n /**\n * Array of rows. Each row corresponds to one data entry under each column.\n */\n rows: (string | number | boolean | null)[][];\n\n /**\n * Optional width for the table\n * @default '100%'\n */\n width?: string | number;\n\n /**\n * Optional height for the table\n * @default '650px'\n */\n height?: string | number;\n\n /**\n * Theme (provided through customization)\n */\n theme?: ITheme;\n\n /**\n * Additional class name(s) to apply to the table chart\n */\n className?: string;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: IStyleFunctionOrObject<IChartTableStyleProps, IChartTableStyles>;\n\n /**\n * Optional callback to access the IChart interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: IRefObject<IChart>;\n}\n\n/**\n * Table Chart styles\n * {@docCategory ChartTable}\n */\nexport interface IChartTableStyles {\n root?: IStyle;\n table?: IStyle;\n headerCell?: IStyle;\n bodyCell?: IStyle;\n}\n"]}
1
+ {"version":3,"file":"ChartTable.types.js","sourceRoot":"../src/","sources":["components/ChartTable/ChartTable.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { ITheme, IStyle } from '@fluentui/react/lib/Styling';\nimport { IRefObject, IStyleFunctionOrObject } from '@fluentui/react/lib/Utilities';\nimport { IChart } from '../../types/index';\n\nexport interface IChartTableStyleProps {\n theme: ITheme;\n className?: string;\n}\n\n/**\n * Chart Table properties\n * {@docCategory ChartTable}\n */\nexport interface IChartTableProps {\n /**\n * 1d or 2d Array of header values.\n */\n headers: { value: string | number | boolean | null; style?: React.CSSProperties }[];\n\n /**\n * Array of rows. Each row corresponds to one data entry under each column.\n */\n rows: { value: string | number | boolean | null; style?: React.CSSProperties }[][];\n\n /**\n * Optional width for the table\n * @default '100%'\n */\n width?: string | number;\n\n /**\n * Optional height for the table\n * @default '650px'\n */\n height?: string | number;\n\n /**\n * Theme (provided through customization)\n */\n theme?: ITheme;\n\n /**\n * Additional class name(s) to apply to the table chart\n */\n className?: string;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: IStyleFunctionOrObject<IChartTableStyleProps, IChartTableStyles>;\n\n /**\n * Optional callback to access the IChart interface. Use this instead of ref for accessing\n * the public methods and properties of the component.\n */\n componentRef?: IRefObject<IChart>;\n}\n\n/**\n * Table Chart styles\n * {@docCategory ChartTable}\n */\nexport interface IChartTableStyles {\n root?: IStyle;\n table?: IStyle;\n headerCell?: IStyle;\n bodyCell?: IStyle;\n}\n"]}
@@ -32,6 +32,5 @@ export declare const projectPolarToCartesian: (input: PlotlySchema) => PlotlySch
32
32
  * @param trace
33
33
  */
34
34
  export declare function findArrayAttributes(trace: any): void;
35
- export declare const isInvalidValue: (value: any) => boolean;
36
35
  export declare const getNumberAtIndexOrDefault: (data: PlotData['z'] | undefined, index: number) => number | undefined;
37
36
  export declare const getValidXYRanges: (series: Partial<PlotData>) => [number, number][];
@@ -1,10 +1,11 @@
1
1
  import { __assign } from "tslib";
2
2
  import { bin as d3Bin, extent as d3Extent, sum as d3Sum, min as d3Min, max as d3Max, range as d3Range, } from 'd3-array';
3
3
  import { scaleLinear as d3ScaleLinear } from 'd3-scale';
4
+ import { format as d3Format } from 'd3-format';
4
5
  import { DataVizPalette, getColorFromToken } from '../../utilities/colors';
5
6
  import { GaugeChartVariant } from '../GaugeChart/index';
6
- import { findNumericMinMaxOfY } from '../../utilities/utilities';
7
- import { isArrayOfType, isArrayOrTypedArray, isDate, isDateArray, isNumberArray, isYearArray, } from '@fluentui/chart-utilities';
7
+ import { findNumericMinMaxOfY, formatValueLimitWidth } from '../../utilities/utilities';
8
+ import { isArrayOfType, isArrayOrTypedArray, isDate, isDateArray, isNumberArray, isYearArray, isInvalidValue, } from '@fluentui/chart-utilities';
8
9
  import { timeParse } from 'd3-time-format';
9
10
  import { curveCardinal as d3CurveCardinal } from 'd3-shape';
10
11
  import { extractColor, resolveColor } from './PlotlyColorAdapter';
@@ -265,17 +266,40 @@ export var transformPlotlyJsonToVSBCProps = function (input, colorMap, colorwayT
265
266
  var _e = getTitles(input.layout), chartTitle = _e.chartTitle, xAxisTitle = _e.xAxisTitle, yAxisTitle = _e.yAxisTitle;
266
267
  return __assign(__assign({ data: Object.values(mapXToDataPoints), width: (_a = input.layout) === null || _a === void 0 ? void 0 : _a.width, height: (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350, barWidth: 'auto', yMaxValue: yMaxValue, yMinValue: yMinValue, chartTitle: chartTitle, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, supportNegativeData: true, barGapMax: 2 });
267
268
  };
269
+ var createColorScale = function (colorscale, domain) {
270
+ var dMin = domain[0], dMax = domain[1];
271
+ // Normalize colorscale domain to actual data domain
272
+ var scaleDomain = colorscale.map(function (_a) {
273
+ var pos = _a[0];
274
+ return dMin + pos * (dMax - dMin);
275
+ });
276
+ var scaleColors = colorscale.map(function (item) { return item[1]; });
277
+ return d3ScaleLinear().domain(scaleDomain).range(scaleColors);
278
+ };
268
279
  export var transformPlotlyJsonToGVBCProps = function (input, colorMap, colorwayType, isDarkTheme) {
269
280
  var _a, _b, _c;
270
281
  var mapXToDataPoints = {};
271
282
  var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, 0, 0);
272
283
  var _d = getLegendProps(input.data, input.layout), legends = _d.legends, hideLegend = _d.hideLegend;
284
+ var colorScale = undefined;
273
285
  input.data.forEach(function (series, index1) {
274
- var _a, _b, _c, _d, _e;
286
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
287
+ if (((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.coloraxis) === null || _b === void 0 ? void 0 : _b.colorscale) === null || _c === void 0 ? void 0 : _c.length) &&
288
+ isArrayOrTypedArray((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color) &&
289
+ ((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length > 0 &&
290
+ typeof ((_g = (_f = series.marker) === null || _f === void 0 ? void 0 : _f.color) === null || _g === void 0 ? void 0 : _g[0]) === 'number') {
291
+ var scale = input.layout.coloraxis.colorscale;
292
+ var colorValues = (_h = series.marker) === null || _h === void 0 ? void 0 : _h.color;
293
+ var _t = [
294
+ (_k = (_j = input.layout.coloraxis) === null || _j === void 0 ? void 0 : _j.cmin) !== null && _k !== void 0 ? _k : Math.min.apply(Math, colorValues),
295
+ (_m = (_l = input.layout.coloraxis) === null || _l === void 0 ? void 0 : _l.cmax) !== null && _m !== void 0 ? _m : Math.max.apply(Math, colorValues),
296
+ ], dMin = _t[0], dMax = _t[1];
297
+ colorScale = createColorScale(scale, [dMin, dMax]);
298
+ }
275
299
  // extract colors for each series only once
276
- var extractedColors = extractColor((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.template) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.colorway, colorwayType, (_d = series.marker) === null || _d === void 0 ? void 0 : _d.color, colorMap, isDarkTheme);
277
- (_e = series.x) === null || _e === void 0 ? void 0 : _e.forEach(function (x, xIndex) {
278
- var _a;
300
+ var extractedColors = extractColor((_q = (_p = (_o = input.layout) === null || _o === void 0 ? void 0 : _o.template) === null || _p === void 0 ? void 0 : _p.layout) === null || _q === void 0 ? void 0 : _q.colorway, colorwayType, (_r = series.marker) === null || _r === void 0 ? void 0 : _r.color, colorMap, isDarkTheme);
301
+ (_s = series.x) === null || _s === void 0 ? void 0 : _s.forEach(function (x, xIndex) {
302
+ var _a, _b, _c, _d;
279
303
  if (isInvalidValue(x) || isInvalidValue((_a = series.y) === null || _a === void 0 ? void 0 : _a[xIndex])) {
280
304
  return;
281
305
  }
@@ -284,8 +308,10 @@ export var transformPlotlyJsonToGVBCProps = function (input, colorMap, colorwayT
284
308
  }
285
309
  if (series.type === 'bar') {
286
310
  var legend = legends[index1];
287
- // resolve color for each legend's bars from the extracted colors
288
- var color = resolveColor(extractedColors, index1, legend, colorMap, isDarkTheme);
311
+ // resolve color for each legend's bars from the colorscale or extracted colors
312
+ var color = colorScale
313
+ ? colorScale(isArrayOrTypedArray((_b = series.marker) === null || _b === void 0 ? void 0 : _b.color) ? (_d = (_c = series.marker) === null || _c === void 0 ? void 0 : _c.color) === null || _d === void 0 ? void 0 : _d[xIndex] : 0)
314
+ : resolveColor(extractedColors, index1, legend, colorMap, isDarkTheme);
289
315
  mapXToDataPoints[x].series.push({
290
316
  key: legend,
291
317
  data: series.y[xIndex],
@@ -741,37 +767,132 @@ var cleanText = function (text) {
741
767
  .replace(/\$[^$]*\$/g, '$')
742
768
  .trim();
743
769
  };
770
+ var formatValue = function (value, colIndex, cells) {
771
+ if (value === null || typeof value === 'boolean') {
772
+ return value;
773
+ }
774
+ var formatStr = Array.isArray(cells.format) ? cells.format[colIndex] : cells.format;
775
+ var prefix = Array.isArray(cells.prefix) ? cells.prefix[colIndex] : cells.prefix;
776
+ var suffix = Array.isArray(cells.suffix) ? cells.suffix[colIndex] : cells.suffix;
777
+ var formatted = value;
778
+ if (typeof value === 'number') {
779
+ if (typeof formatStr === 'string') {
780
+ try {
781
+ formatted = d3Format(formatStr)(value);
782
+ }
783
+ catch (_a) {
784
+ formatted = formatValueLimitWidth(value);
785
+ }
786
+ }
787
+ else {
788
+ formatted = formatValueLimitWidth(value);
789
+ }
790
+ }
791
+ return "".concat(prefix !== null && prefix !== void 0 ? prefix : '').concat(formatted).concat(suffix !== null && suffix !== void 0 ? suffix : '');
792
+ };
744
793
  export var transformPlotlyJsonToChartTableProps = function (input, colorMap, isDarkTheme) {
745
- var _a, _b, _c, _d, _e, _f, _g, _h;
794
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
746
795
  var tableData = input.data[0];
747
- var normalizeHeaders = function (values) {
748
- // Case: values is array of arrays
749
- if (Array.isArray(values[0])) {
750
- return values.map(function (row) {
796
+ var normalizeHeaders = function (values, header) {
797
+ var cleanedValues = Array.isArray(values[0])
798
+ ? values.map(function (row) {
751
799
  return row
752
800
  .map(function (cell) { return cleanText(cell); })
753
801
  .filter(Boolean)
754
802
  .join(' ');
755
- });
756
- }
757
- // Case: values is 1d array
758
- return values.map(function (cell) { return cleanText(cell); });
803
+ })
804
+ : values.map(function (cell) { return cleanText(cell); });
805
+ return cleanedValues.map(function (value, colIndex) {
806
+ var _a, _b, _c;
807
+ var fontColorRaw = (_a = header === null || header === void 0 ? void 0 : header.font) === null || _a === void 0 ? void 0 : _a.color;
808
+ var fontColor;
809
+ if (Array.isArray(fontColorRaw)) {
810
+ var colorEntry = fontColorRaw[colIndex];
811
+ if (Array.isArray(colorEntry)) {
812
+ fontColor = typeof colorEntry[0] === 'string' ? colorEntry[0] : undefined;
813
+ }
814
+ else if (typeof colorEntry === 'string') {
815
+ fontColor = colorEntry;
816
+ }
817
+ }
818
+ else if (typeof fontColorRaw === 'string') {
819
+ fontColor = fontColorRaw;
820
+ }
821
+ var fontSizeRaw = (_b = header === null || header === void 0 ? void 0 : header.font) === null || _b === void 0 ? void 0 : _b.size;
822
+ var fontSize;
823
+ if (Array.isArray(fontSizeRaw)) {
824
+ fontSize = Array.isArray(fontSizeRaw[0]) ? fontSizeRaw[0][colIndex] : fontSizeRaw[colIndex];
825
+ }
826
+ else if (typeof fontSizeRaw === 'number') {
827
+ fontSize = fontSizeRaw;
828
+ }
829
+ var updatedColIndex = colIndex >= 1 ? 1 : 0;
830
+ var fillColorRaw = (_c = header === null || header === void 0 ? void 0 : header.fill) === null || _c === void 0 ? void 0 : _c.color;
831
+ var backgroundColor = Array.isArray(fillColorRaw) ? fillColorRaw[updatedColIndex] : fillColorRaw;
832
+ var textAlignRaw = header === null || header === void 0 ? void 0 : header.align;
833
+ var textAlign = Array.isArray(textAlignRaw) ? textAlignRaw[colIndex] : textAlignRaw;
834
+ var style = __assign(__assign(__assign(__assign({}, (typeof fontColor === 'string' ? { color: fontColor } : {})), (typeof fontSize === 'number' ? { fontSize: fontSize } : {})), (typeof backgroundColor === 'string' ? { backgroundColor: backgroundColor } : {})), (textAlign ? { textAlign: textAlign } : {}));
835
+ return { value: value, style: style };
836
+ });
759
837
  };
760
838
  var columns = (_b = (_a = tableData.cells) === null || _a === void 0 ? void 0 : _a.values) !== null && _b !== void 0 ? _b : [];
839
+ var cells = tableData.cells.font ? tableData.cells : (_e = (_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.template) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.table[0].cells;
761
840
  var rows = columns[0].map(function (_, rowIndex) {
762
- return columns.map(function (col) {
763
- var cell = col[rowIndex];
764
- return typeof cell === 'string' ? cleanText(cell) : cell;
841
+ return columns.map(function (col, colIndex) {
842
+ var _a, _b, _c;
843
+ var cellValue = col[rowIndex];
844
+ var cleanValue = typeof cellValue === 'string' ? cleanText(cellValue) : cellValue;
845
+ var formattedValue = typeof cleanValue === 'string' || typeof cleanValue === 'number'
846
+ ? formatValue(cleanValue, colIndex, cells)
847
+ : cleanValue;
848
+ var rawFontColor = (_a = cells === null || cells === void 0 ? void 0 : cells.font) === null || _a === void 0 ? void 0 : _a.color;
849
+ var fontColor;
850
+ if (Array.isArray(rawFontColor)) {
851
+ var entry = rawFontColor[colIndex];
852
+ var colorValue = Array.isArray(entry) ? entry[rowIndex] : entry;
853
+ fontColor = typeof colorValue === 'string' ? colorValue : undefined;
854
+ }
855
+ else if (typeof rawFontColor === 'string') {
856
+ fontColor = rawFontColor;
857
+ }
858
+ var rawFontSize = (_b = cells === null || cells === void 0 ? void 0 : cells.font) === null || _b === void 0 ? void 0 : _b.size;
859
+ var fontSize;
860
+ if (Array.isArray(rawFontSize)) {
861
+ var entry = rawFontSize[colIndex];
862
+ var fontSizeValue = Array.isArray(entry) ? entry[rowIndex] : entry;
863
+ fontSize = typeof fontSizeValue === 'number' ? fontSizeValue : undefined;
864
+ }
865
+ else if (typeof rawFontSize === 'number') {
866
+ fontSize = rawFontSize;
867
+ }
868
+ var updatedColIndex = colIndex >= 1 ? 1 : 0;
869
+ var rawBackgroundColor = (_c = cells === null || cells === void 0 ? void 0 : cells.fill) === null || _c === void 0 ? void 0 : _c.color;
870
+ var backgroundColor;
871
+ if (Array.isArray(rawBackgroundColor)) {
872
+ var entry = rawBackgroundColor[updatedColIndex];
873
+ var colorValue = Array.isArray(entry) ? entry[rowIndex] : entry;
874
+ backgroundColor = typeof colorValue === 'string' ? colorValue : undefined;
875
+ }
876
+ else if (typeof rawBackgroundColor === 'string') {
877
+ backgroundColor = rawBackgroundColor;
878
+ }
879
+ var rawTextAlign = Array.isArray(cells === null || cells === void 0 ? void 0 : cells.align) ? cells.align[colIndex] : cells === null || cells === void 0 ? void 0 : cells.align;
880
+ var textAlign = rawTextAlign;
881
+ var style = __assign(__assign(__assign(__assign({}, (fontColor ? { color: fontColor } : {})), (typeof fontSize === 'number' ? { fontSize: fontSize } : {})), (backgroundColor ? { backgroundColor: backgroundColor } : {})), (textAlign ? { textAlign: textAlign } : {}));
882
+ return {
883
+ value: formattedValue,
884
+ style: style,
885
+ };
765
886
  });
766
887
  });
767
888
  var styles = {
768
- root: __assign({}, (((_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.font) === null || _d === void 0 ? void 0 : _d.size) ? { fontSize: input.layout.font.size } : {})),
889
+ root: __assign({}, (((_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.font) === null || _g === void 0 ? void 0 : _g.size) ? { fontSize: input.layout.font.size } : {})),
769
890
  };
770
891
  return {
771
- headers: normalizeHeaders((_f = (_e = tableData.header) === null || _e === void 0 ? void 0 : _e.values) !== null && _f !== void 0 ? _f : []),
892
+ headers: normalizeHeaders((_j = (_h = tableData.header) === null || _h === void 0 ? void 0 : _h.values) !== null && _j !== void 0 ? _j : [], ((_k = tableData.header) === null || _k === void 0 ? void 0 : _k.font) ? tableData.header : (_o = (_m = (_l = input.layout) === null || _l === void 0 ? void 0 : _l.template) === null || _m === void 0 ? void 0 : _m.data) === null || _o === void 0 ? void 0 : _o.table[0].header),
772
893
  rows: rows,
773
- width: (_g = input.layout) === null || _g === void 0 ? void 0 : _g.width,
774
- height: (_h = input.layout) === null || _h === void 0 ? void 0 : _h.height,
894
+ width: (_p = input.layout) === null || _p === void 0 ? void 0 : _p.width,
895
+ height: (_q = input.layout) === null || _q === void 0 ? void 0 : _q.height,
775
896
  styles: styles,
776
897
  };
777
898
  };
@@ -987,10 +1108,6 @@ var getLegendProps = function (data, layout) {
987
1108
  hideLegend: (layout === null || layout === void 0 ? void 0 : layout.showlegend) === false || ((layout === null || layout === void 0 ? void 0 : layout.showlegend) !== true && legends.length < 2) ? true : hideLegends,
988
1109
  };
989
1110
  };
990
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
991
- export var isInvalidValue = function (value) {
992
- return typeof value === 'undefined' || value === null || (typeof value === 'number' && !isFinite(value));
993
- };
994
1111
  export var getNumberAtIndexOrDefault = function (data, index) {
995
1112
  if (isArrayOrTypedArray(data)) {
996
1113
  if (typeof data[index] !== 'number' || !isFinite(data[index])) {