@fluentui/react-charting 5.24.16 → 5.24.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +28 -1
- package/CHANGELOG.md +13 -2
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/lib/components/ChartTable/ChartTable.base.js +83 -4
- package/lib/components/ChartTable/ChartTable.base.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +70 -25
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.base.js +44 -15
- package/lib/components/FunnelChart/FunnelChart.base.js.map +1 -1
- package/lib/components/FunnelChart/funnelGeometry.d.ts +8 -8
- package/lib/components/FunnelChart/funnelGeometry.js +4 -4
- package/lib/components/FunnelChart/funnelGeometry.js.map +1 -1
- package/lib-amd/components/ChartTable/ChartTable.base.js +81 -4
- package/lib-amd/components/ChartTable/ChartTable.base.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +70 -25
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/FunnelChart/FunnelChart.base.js +44 -15
- package/lib-amd/components/FunnelChart/FunnelChart.base.js.map +1 -1
- package/lib-amd/components/FunnelChart/funnelGeometry.d.ts +8 -8
- package/lib-amd/components/FunnelChart/funnelGeometry.js +9 -9
- package/lib-amd/components/FunnelChart/funnelGeometry.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.base.js +82 -3
- package/lib-commonjs/components/ChartTable/ChartTable.base.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +70 -25
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.base.js +44 -15
- package/lib-commonjs/components/FunnelChart/FunnelChart.base.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/funnelGeometry.d.ts +8 -8
- package/lib-commonjs/components/FunnelChart/funnelGeometry.js +9 -9
- package/lib-commonjs/components/FunnelChart/funnelGeometry.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartTable.base.js","sourceRoot":"../src/","sources":["components/ChartTable/ChartTable.base.tsx"],"names":[],"mappings":";;;;AAAA,6BAA+B;AAG/B,2DAAmG;AAEnG,yEAA6D;AAE7D,IAAM,aAAa,GAAG,IAAA,8BAAkB,GAA4C,CAAC;AAErF;IAAoC,0CAAiC;IAInE,wBAAY,KAAuB;QACjC,YAAA,MAAK,YAAC,KAAK,CAAC,SAAC;QAIR,aAAO,GAAG,UAAC,IAA0B;YAC1C,OAAO,IAAA,4BAAO,EAAC,KAAI,CAAC,SAAS,EAAE,SAAS,EAAE,KAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC/D,CAAC,CAAC;QALA,IAAA,kCAAsB,EAAC,KAAI,CAAC,CAAC;QAC7B,KAAI,CAAC,MAAM,GAAG,IAAA,kBAAM,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC;;IACpC,CAAC;IAKD,4DAA4D;IACrD,+BAAM,GAAb;QAAA,iBA4DC;QA3DO,IAAA,KAAkD,IAAI,CAAC,KAAK,EAA1D,OAAO,aAAA,EAAE,IAAI,UAAA,EAAE,KAAK,WAAA,EAAE,MAAM,YAAA,EAAE,MAAM,YAAA,EAAE,KAAK,WAAe,CAAC;QAEnE,IAAM,UAAU,GAAG,aAAa,CAAC,MAAO,EAAE;YACxC,KAAK,EAAE,KAAM;SACd,CAAC,CAAC;QAEH,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrC,OAAO,qDAA4B,CAAC;QACtC,CAAC;QAED,OAAO,CACL,6BACE,GAAG,EAAE,UAAA,EAAE,IAAI,OAAA,CAAC,KAAI,CAAC,SAAS,GAAG,EAAE,C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AAG,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,AA3ED,CAAoC,KAAK,CAAC,SAAS,GA2ElD;AA3EY,wCAAc","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 // eslint-disable-next-line @typescript-eslint/no-deprecated\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'} className={classNames.chart}>\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
|
+
{"version":3,"file":"ChartTable.base.js","sourceRoot":"../src/","sources":["components/ChartTable/ChartTable.base.tsx"],"names":[],"mappings":";;;;AAAA,6BAA+B;AAG/B,2DAAmG;AAEnG,yEAA6D;AAC7D,6BAA+B;AAC/B,iDAA0D;AAG1D,SAAS,cAAc,CAAC,GAAW,EAAE,KAAa;IAChD,IAAM,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,KAAK,CAAC,cAAc,CAAC,QAAS,CAAC;IACxC,CAAC;IACD,IAAM,GAAG,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC;IACxB,OAAO,EAAE,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;AACnE,CAAC;AAED,SAAS,sBAAsB,CAAC,KAAa,EAAE,UAAmB,EAAE,UAAmB;IACrF,IAAM,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC;IACjD,IAAM,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IA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AC1D,IAAI,CAAC,KAAK,CACR,CACN,CAAC;4BACJ,CAAC,CAAC,CACC,CACN,EAhB0B,CAgB1B,CAAC,CACI,CACT,CACK,CACJ,CACQ,CACZ,CACF,CACP,CAAC;IACJ,CAAC;IACH,qBAAC;AAAD,CAAC,AA9HD,CAAoC,KAAK,CAAC,SAAS,GA8HlD;AA9HY,wCAAc","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';\nimport * as d3 from 'd3-color';\nimport { getColorContrast } from '../../utilities/colors';\nimport { ITheme } from '@fluentui/react';\n\nfunction invertHexColor(hex: string, theme: ITheme): string {\n const color = d3.color(hex);\n if (!color) {\n return theme.semanticColors.bodyText!;\n }\n const rgb = color.rgb();\n return d3.rgb(255 - rgb.r, 255 - rgb.g, 255 - rgb.b).formatHex();\n}\n\nfunction getSafeBackgroundColor(theme: ITheme, foreground?: string, background?: string): string {\n const fallbackFg = theme.semanticColors.bodyText;\n const fallbackBg = theme.semanticColors.bodyBackground;\n\n const fg = d3.color(foreground || fallbackFg);\n const bg = d3.color(background || fallbackBg);\n if (!fg || !bg) {\n return fallbackBg;\n }\n const contrast = getColorContrast(fg.formatHex(), bg.formatHex());\n if (contrast >= 3) {\n return bg.formatHex();\n }\n\n const invertedBg = invertHexColor(bg.formatHex(), theme);\n const invertedContrast = getColorContrast(fg.formatHex(), invertedBg);\n return invertedContrast >= 3 ? invertedBg : fallbackBg;\n}\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 // eslint-disable-next-line @typescript-eslint/no-deprecated\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 const bgColorSet = new Set<string>();\n headers.forEach(header => {\n const bg = header?.style?.backgroundColor;\n const normalized = d3.color(bg || '')?.formatHex();\n if (normalized) {\n bgColorSet.add(normalized);\n }\n });\n let sharedBackgroundColor: string | undefined;\n let useSharedBackground = false;\n\n /*\n If we have only one or two unique background colors, we can consider using a shared background color\n for the table headers. This is to ensure better contrast with the foreground text.\n For size 1, we will consider that as default color if it satisfies the contrast ratio.\n There could also be a scenario where backgroundcolor array is of size 2, for eg: [\"dimsgray\", \"gray\"],\n which will assign 1st column header bg color to dimsgray and rest to gray. so our logic of shared background\n color won't run here. So will consider for size 2 as well.\n For size greater than this, we will consider that user wants different colors and will let color contrast fail\n if any.\n */\n if (bgColorSet.size === 1 || bgColorSet.size === 2) {\n const candidateBg = bgColorSet.size === 1 ? Array.from(bgColorSet)[0] : Array.from(bgColorSet)[1];\n for (const header of headers) {\n const fg = header?.style?.color;\n if (fg && getColorContrast(fg, candidateBg) >= 3) {\n sharedBackgroundColor = candidateBg;\n useSharedBackground = true;\n break;\n }\n }\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'} className={classNames.chart}>\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 const style = { ...header?.style };\n const fg = style.color;\n const bg = style.backgroundColor;\n\n if (useSharedBackground) {\n style.backgroundColor = sharedBackgroundColor;\n } else if (fg || bg) {\n style.backgroundColor = getSafeBackgroundColor(theme!, fg, bg);\n }\n return (\n <th key={idx} className={classNames.headerCell} style={style}>\n {header.value}\n </th>\n );\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 const style = { ...cell?.style };\n const fg = style.color;\n const bg = style.backgroundColor;\n if (fg || bg) {\n style.backgroundColor = getSafeBackgroundColor(theme!, fg, bg);\n }\n return (\n <td key={colIdx} className={classNames.bodyCell} style={style}>\n {cell.value}\n </td>\n );\n })}\n </tr>\n ))}\n </tbody>\n )}\n </table>\n </div>\n </foreignObject>\n </svg>\n </div>\n );\n }\n}\n"]}
|
|
@@ -340,7 +340,7 @@ var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorMap, col
|
|
|
340
340
|
});
|
|
341
341
|
});
|
|
342
342
|
var vsbcData = Object.values(mapXToDataPoints);
|
|
343
|
-
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: vsbcData, 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, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, supportNegativeData: true, barGapMax: 2, showYAxisLables: true, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, wrapXAxisLables: typeof ((_d = vsbcData[0]) === null || _d === void 0 ? void 0 : _d.xAxisPoint) === 'string' }), getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getYMinMaxValues(input.data[0], input.layout)), getXAxisTickFormat(input.data[0], input.layout)), yAxisTickFormat);
|
|
343
|
+
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: vsbcData, 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, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, supportNegativeData: true, barGapMax: 2, showYAxisLables: true, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, wrapXAxisLables: typeof ((_d = vsbcData[0]) === null || _d === void 0 ? void 0 : _d.xAxisPoint) === 'string' }), getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getYMinMaxValues(input.data[0], input.layout)), getXAxisTickFormat(input.data[0], input.layout)), yAxisTickFormat), getBarProps(input.data, input.layout));
|
|
344
344
|
};
|
|
345
345
|
exports.transformPlotlyJsonToVSBCProps = transformPlotlyJsonToVSBCProps;
|
|
346
346
|
var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
@@ -386,7 +386,7 @@ var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorMap, col
|
|
|
386
386
|
});
|
|
387
387
|
});
|
|
388
388
|
var gvbcData = Object.values(mapXToDataPoints);
|
|
389
|
-
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: gvbcData, 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', mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, wrapXAxisLables: typeof ((_d = gvbcData[0]) === null || _d === void 0 ? void 0 : _d.name) === 'string' }), getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getYMinMaxValues(input.data[0], input.layout)), getXAxisTickFormat(input.data[0], input.layout)), yAxisTickFormat);
|
|
389
|
+
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: gvbcData, 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', mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, wrapXAxisLables: typeof ((_d = gvbcData[0]) === null || _d === void 0 ? void 0 : _d.name) === 'string' }), getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getYMinMaxValues(input.data[0], input.layout)), getXAxisTickFormat(input.data[0], input.layout)), yAxisTickFormat), getBarProps(input.data, input.layout));
|
|
390
390
|
};
|
|
391
391
|
exports.transformPlotlyJsonToGVBCProps = transformPlotlyJsonToGVBCProps;
|
|
392
392
|
var transformPlotlyJsonToVBCProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
@@ -598,9 +598,9 @@ var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, isMultiPl
|
|
|
598
598
|
var scalingFactor = 0.01;
|
|
599
599
|
var gapFactor = 1 / (1 + scalingFactor * numberOfRows);
|
|
600
600
|
var barHeight = availableHeight / (numberOfRows * (1 + gapFactor));
|
|
601
|
-
return tslib_1.__assign(tslib_1.__assign({ data: chartData, secondaryYAxistitle: typeof ((_k = (_j = input.layout) === null || _j === void 0 ? void 0 : _j.yaxis2) === null || _k === void 0 ? void 0 : _k.title) === 'string'
|
|
601
|
+
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: chartData, secondaryYAxistitle: typeof ((_k = (_j = input.layout) === null || _j === void 0 ? void 0 : _j.yaxis2) === null || _k === void 0 ? void 0 : _k.title) === 'string'
|
|
602
602
|
? (_m = (_l = input.layout) === null || _l === void 0 ? void 0 : _l.yaxis2) === null || _m === void 0 ? void 0 : _m.title
|
|
603
|
-
: ((_q = (_p = (_o = input.layout) === null || _o === void 0 ? void 0 : _o.yaxis2) === null || _p === void 0 ? void 0 : _p.title) === null || _q === void 0 ? void 0 : _q.text) || '', barHeight: barHeight, showYAxisLables: true, height: chartHeight, width: (_r = input.layout) === null || _r === void 0 ? void 0 : _r.width, hideTickOverlap: true, hideLegend: hideLegend, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, roundCorners: true }, getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout));
|
|
603
|
+
: ((_q = (_p = (_o = input.layout) === null || _o === void 0 ? void 0 : _o.yaxis2) === null || _p === void 0 ? void 0 : _p.title) === null || _q === void 0 ? void 0 : _q.text) || '', barHeight: barHeight, showYAxisLables: true, height: chartHeight, width: (_r = input.layout) === null || _r === void 0 ? void 0 : _r.width, hideTickOverlap: true, hideLegend: hideLegend, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, roundCorners: true }, getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getBarProps(input.data, input.layout, true));
|
|
604
604
|
};
|
|
605
605
|
exports.transformPlotlyJsonToHorizontalBarWithAxisProps = transformPlotlyJsonToHorizontalBarWithAxisProps;
|
|
606
606
|
var transformPlotlyJsonToGanttChartProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
@@ -647,7 +647,7 @@ var transformPlotlyJsonToGanttChartProps = function (input, isMultiPlot, colorMa
|
|
|
647
647
|
.filter(function (point) { return point !== null; });
|
|
648
648
|
})
|
|
649
649
|
.flat();
|
|
650
|
-
return tslib_1.__assign(tslib_1.__assign({ data: chartData, showYAxisLables: true, height: (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : 350, width: (_c = input.layout) === null || _c === void 0 ? void 0 : _c.width, hideTickOverlap: true, hideLegend: hideLegend, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, roundCorners: true, useUTC: false }, getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout));
|
|
650
|
+
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: chartData, showYAxisLables: true, height: (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : 350, width: (_c = input.layout) === null || _c === void 0 ? void 0 : _c.width, hideTickOverlap: true, hideLegend: hideLegend, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, roundCorners: true, useUTC: false }, getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getBarProps(input.data, input.layout, true));
|
|
651
651
|
};
|
|
652
652
|
exports.transformPlotlyJsonToGanttChartProps = transformPlotlyJsonToGanttChartProps;
|
|
653
653
|
var transformPlotlyJsonToHeatmapProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
@@ -914,7 +914,7 @@ var formatValue = function (value, colIndex, cells) {
|
|
|
914
914
|
return "".concat(prefix !== null && prefix !== void 0 ? prefix : '').concat(formatted).concat(suffix !== null && suffix !== void 0 ? suffix : '');
|
|
915
915
|
};
|
|
916
916
|
var transformPlotlyJsonToChartTableProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
917
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
917
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
918
918
|
var tableData = input.data[0];
|
|
919
919
|
var normalizeHeaders = function (values, header) {
|
|
920
920
|
var cleanedValues = Array.isArray(values[0])
|
|
@@ -926,11 +926,11 @@ var transformPlotlyJsonToChartTableProps = function (input, isMultiPlot, colorMa
|
|
|
926
926
|
})
|
|
927
927
|
: values.map(function (cell) { return cleanText(cell); });
|
|
928
928
|
return cleanedValues.map(function (value, colIndex) {
|
|
929
|
-
var _a, _b, _c;
|
|
929
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
930
930
|
var fontColorRaw = (_a = header === null || header === void 0 ? void 0 : header.font) === null || _a === void 0 ? void 0 : _a.color;
|
|
931
931
|
var fontColor;
|
|
932
932
|
if (Array.isArray(fontColorRaw)) {
|
|
933
|
-
var colorEntry = fontColorRaw[colIndex];
|
|
933
|
+
var colorEntry = (_b = fontColorRaw[colIndex]) !== null && _b !== void 0 ? _b : fontColorRaw[0];
|
|
934
934
|
if (Array.isArray(colorEntry)) {
|
|
935
935
|
fontColor = typeof colorEntry[0] === 'string' ? colorEntry[0] : undefined;
|
|
936
936
|
}
|
|
@@ -941,28 +941,37 @@ var transformPlotlyJsonToChartTableProps = function (input, isMultiPlot, colorMa
|
|
|
941
941
|
else if (typeof fontColorRaw === 'string') {
|
|
942
942
|
fontColor = fontColorRaw;
|
|
943
943
|
}
|
|
944
|
-
var fontSizeRaw = (
|
|
944
|
+
var fontSizeRaw = (_c = header === null || header === void 0 ? void 0 : header.font) === null || _c === void 0 ? void 0 : _c.size;
|
|
945
945
|
var fontSize;
|
|
946
946
|
if (Array.isArray(fontSizeRaw)) {
|
|
947
|
-
|
|
947
|
+
var fontSizeEntry = (_d = fontSizeRaw[colIndex]) !== null && _d !== void 0 ? _d : fontSizeRaw[0];
|
|
948
|
+
fontSize = Array.isArray(fontSizeRaw[0])
|
|
949
|
+
? (_e = fontSizeRaw[0][colIndex]) !== null && _e !== void 0 ? _e : fontSizeRaw[0][0]
|
|
950
|
+
: typeof fontSizeEntry === 'number'
|
|
951
|
+
? fontSizeEntry
|
|
952
|
+
: undefined;
|
|
948
953
|
}
|
|
949
954
|
else if (typeof fontSizeRaw === 'number') {
|
|
950
955
|
fontSize = fontSizeRaw;
|
|
951
956
|
}
|
|
952
957
|
var updatedColIndex = colIndex >= 1 ? 1 : 0;
|
|
953
|
-
var fillColorRaw = (
|
|
954
|
-
var backgroundColor = Array.isArray(fillColorRaw)
|
|
958
|
+
var fillColorRaw = (_f = header === null || header === void 0 ? void 0 : header.fill) === null || _f === void 0 ? void 0 : _f.color;
|
|
959
|
+
var backgroundColor = Array.isArray(fillColorRaw)
|
|
960
|
+
? (_g = fillColorRaw[updatedColIndex]) !== null && _g !== void 0 ? _g : fillColorRaw[0]
|
|
961
|
+
: fillColorRaw;
|
|
955
962
|
var textAlignRaw = header === null || header === void 0 ? void 0 : header.align;
|
|
956
|
-
var textAlign = Array.isArray(textAlignRaw) ? textAlignRaw[colIndex] : textAlignRaw;
|
|
963
|
+
var textAlign = Array.isArray(textAlignRaw) ? (_h = textAlignRaw[colIndex]) !== null && _h !== void 0 ? _h : textAlignRaw[0] : textAlignRaw;
|
|
957
964
|
var style = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, (typeof fontColor === 'string' ? { color: fontColor } : {})), (typeof fontSize === 'number' ? { fontSize: fontSize } : {})), (typeof backgroundColor === 'string' ? { backgroundColor: backgroundColor } : {})), (textAlign ? { textAlign: textAlign } : {}));
|
|
958
965
|
return { value: value, style: style };
|
|
959
966
|
});
|
|
960
967
|
};
|
|
961
968
|
var columns = (_b = (_a = tableData.cells) === null || _a === void 0 ? void 0 : _a.values) !== null && _b !== void 0 ? _b : [];
|
|
962
|
-
var cells = tableData.cells
|
|
969
|
+
var cells = tableData.cells && Object.keys(tableData.cells).length > 0
|
|
970
|
+
? tableData.cells
|
|
971
|
+
: (_g = (_f = (_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) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.cells;
|
|
963
972
|
var rows = columns[0].map(function (_, rowIndex) {
|
|
964
973
|
return columns.map(function (col, colIndex) {
|
|
965
|
-
var _a, _b, _c;
|
|
974
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
966
975
|
var cellValue = col[rowIndex];
|
|
967
976
|
var cleanValue = typeof cellValue === 'string' ? cleanText(cellValue) : cellValue;
|
|
968
977
|
var formattedValue = typeof cleanValue === 'string' || typeof cleanValue === 'number'
|
|
@@ -971,17 +980,17 @@ var transformPlotlyJsonToChartTableProps = function (input, isMultiPlot, colorMa
|
|
|
971
980
|
var rawFontColor = (_a = cells === null || cells === void 0 ? void 0 : cells.font) === null || _a === void 0 ? void 0 : _a.color;
|
|
972
981
|
var fontColor;
|
|
973
982
|
if (Array.isArray(rawFontColor)) {
|
|
974
|
-
var entry = rawFontColor[colIndex];
|
|
983
|
+
var entry = (_b = rawFontColor[colIndex]) !== null && _b !== void 0 ? _b : rawFontColor[0];
|
|
975
984
|
var colorValue = Array.isArray(entry) ? entry[rowIndex] : entry;
|
|
976
985
|
fontColor = typeof colorValue === 'string' ? colorValue : undefined;
|
|
977
986
|
}
|
|
978
987
|
else if (typeof rawFontColor === 'string') {
|
|
979
988
|
fontColor = rawFontColor;
|
|
980
989
|
}
|
|
981
|
-
var rawFontSize = (
|
|
990
|
+
var rawFontSize = (_c = cells === null || cells === void 0 ? void 0 : cells.font) === null || _c === void 0 ? void 0 : _c.size;
|
|
982
991
|
var fontSize;
|
|
983
992
|
if (Array.isArray(rawFontSize)) {
|
|
984
|
-
var entry = rawFontSize[colIndex];
|
|
993
|
+
var entry = (_d = rawFontSize[colIndex]) !== null && _d !== void 0 ? _d : rawFontSize[0];
|
|
985
994
|
var fontSizeValue = Array.isArray(entry) ? entry[rowIndex] : entry;
|
|
986
995
|
fontSize = typeof fontSizeValue === 'number' ? fontSizeValue : undefined;
|
|
987
996
|
}
|
|
@@ -989,17 +998,17 @@ var transformPlotlyJsonToChartTableProps = function (input, isMultiPlot, colorMa
|
|
|
989
998
|
fontSize = rawFontSize;
|
|
990
999
|
}
|
|
991
1000
|
var updatedColIndex = colIndex >= 1 ? 1 : 0;
|
|
992
|
-
var rawBackgroundColor = (
|
|
1001
|
+
var rawBackgroundColor = (_e = cells === null || cells === void 0 ? void 0 : cells.fill) === null || _e === void 0 ? void 0 : _e.color;
|
|
993
1002
|
var backgroundColor;
|
|
994
1003
|
if (Array.isArray(rawBackgroundColor)) {
|
|
995
|
-
var entry = rawBackgroundColor[updatedColIndex];
|
|
1004
|
+
var entry = (_f = rawBackgroundColor[updatedColIndex]) !== null && _f !== void 0 ? _f : rawBackgroundColor[0];
|
|
996
1005
|
var colorValue = Array.isArray(entry) ? entry[rowIndex] : entry;
|
|
997
1006
|
backgroundColor = typeof colorValue === 'string' ? colorValue : undefined;
|
|
998
1007
|
}
|
|
999
1008
|
else if (typeof rawBackgroundColor === 'string') {
|
|
1000
1009
|
backgroundColor = rawBackgroundColor;
|
|
1001
1010
|
}
|
|
1002
|
-
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;
|
|
1011
|
+
var rawTextAlign = Array.isArray(cells === null || cells === void 0 ? void 0 : cells.align) ? (_g = cells.align[colIndex]) !== null && _g !== void 0 ? _g : cells.align[0] : cells === null || cells === void 0 ? void 0 : cells.align;
|
|
1003
1012
|
var textAlign = rawTextAlign;
|
|
1004
1013
|
var style = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, (fontColor ? { color: fontColor } : {})), (typeof fontSize === 'number' ? { fontSize: fontSize } : {})), (backgroundColor ? { backgroundColor: backgroundColor } : {})), (textAlign ? { textAlign: textAlign } : {}));
|
|
1005
1014
|
return {
|
|
@@ -1009,13 +1018,15 @@ var transformPlotlyJsonToChartTableProps = function (input, isMultiPlot, colorMa
|
|
|
1009
1018
|
});
|
|
1010
1019
|
});
|
|
1011
1020
|
var styles = {
|
|
1012
|
-
root: tslib_1.__assign({}, (((
|
|
1021
|
+
root: tslib_1.__assign({}, (((_j = (_h = input.layout) === null || _h === void 0 ? void 0 : _h.font) === null || _j === void 0 ? void 0 : _j.size) ? { fontSize: input.layout.font.size } : {})),
|
|
1013
1022
|
};
|
|
1014
1023
|
return {
|
|
1015
|
-
headers: normalizeHeaders((
|
|
1024
|
+
headers: normalizeHeaders((_l = (_k = tableData.header) === null || _k === void 0 ? void 0 : _k.values) !== null && _l !== void 0 ? _l : [], tableData.header && Object.keys(tableData.header).length > 0
|
|
1025
|
+
? tableData.header
|
|
1026
|
+
: (_p = (_o = (_m = input.layout) === null || _m === void 0 ? void 0 : _m.template) === null || _o === void 0 ? void 0 : _o.data) === null || _p === void 0 ? void 0 : _p.table[0].header),
|
|
1016
1027
|
rows: rows,
|
|
1017
|
-
width: (
|
|
1018
|
-
height: (
|
|
1028
|
+
width: (_q = input.layout) === null || _q === void 0 ? void 0 : _q.width,
|
|
1029
|
+
height: (_r = input.layout) === null || _r === void 0 ? void 0 : _r.height,
|
|
1019
1030
|
styles: styles,
|
|
1020
1031
|
};
|
|
1021
1032
|
};
|
|
@@ -1773,4 +1784,38 @@ var parseLocalDate = function (value) {
|
|
|
1773
1784
|
}
|
|
1774
1785
|
return new Date(value);
|
|
1775
1786
|
};
|
|
1787
|
+
var getBarProps = function (data, layout, isHorizontal) {
|
|
1788
|
+
var padding;
|
|
1789
|
+
if (typeof (layout === null || layout === void 0 ? void 0 : layout.bargap) === 'number') {
|
|
1790
|
+
padding = layout.bargap;
|
|
1791
|
+
}
|
|
1792
|
+
var plotlyBarWidths = data
|
|
1793
|
+
.map(function (series) {
|
|
1794
|
+
if (series.type === 'bar' && ((0, chart_utilities_1.isArrayOrTypedArray)(series.width) || typeof series.width === 'number')) {
|
|
1795
|
+
return series.width;
|
|
1796
|
+
}
|
|
1797
|
+
return [];
|
|
1798
|
+
})
|
|
1799
|
+
.flat();
|
|
1800
|
+
var maxPlotlyBarWidth = (0, d3_array_1.max)(plotlyBarWidths);
|
|
1801
|
+
if (typeof maxPlotlyBarWidth === 'number') {
|
|
1802
|
+
padding = 1 - maxPlotlyBarWidth;
|
|
1803
|
+
padding = Math.max(0, Math.min(padding, 1));
|
|
1804
|
+
}
|
|
1805
|
+
if (typeof padding === 'undefined') {
|
|
1806
|
+
return {};
|
|
1807
|
+
}
|
|
1808
|
+
if (isHorizontal) {
|
|
1809
|
+
return {
|
|
1810
|
+
maxBarHeight: 1000,
|
|
1811
|
+
yAxisPadding: padding,
|
|
1812
|
+
};
|
|
1813
|
+
}
|
|
1814
|
+
return {
|
|
1815
|
+
barWidth: 'auto',
|
|
1816
|
+
maxBarWidth: 1000,
|
|
1817
|
+
xAxisInnerPadding: padding,
|
|
1818
|
+
xAxisOuterPadding: padding / 2,
|
|
1819
|
+
};
|
|
1820
|
+
};
|
|
1776
1821
|
//# sourceMappingURL=PlotlySchemaAdapter.js.map
|