@fluentui/react-charting 5.24.3 → 5.24.5
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 +85 -1
- package/CHANGELOG.md +29 -2
- package/config/tests.js +0 -12
- package/dist/react-charting.d.ts +38 -1
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +8 -1
- package/lib/components/AreaChart/AreaChart.base.d.ts +1 -0
- package/lib/components/AreaChart/AreaChart.base.js +4 -1
- package/lib/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.base.js +14 -13
- package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.styles.js +41 -37
- package/lib/components/CommonComponents/CartesianChart.styles.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.d.ts +12 -2
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +38 -16
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.d.ts +2 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +9 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +13 -3
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +276 -199
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.base.js +1 -0
- package/lib/components/DonutChart/DonutChart.base.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.styles.js +18 -0
- package/lib/components/DonutChart/DonutChart.styles.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.types.d.ts +4 -0
- package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +2 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +25 -4
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.base.d.ts +7 -0
- package/lib/components/HeatMapChart/HeatMapChart.base.js +95 -37
- package/lib/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +3 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +24 -3
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.base.js +84 -55
- package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.styles.js +12 -0
- package/lib/components/ScatterChart/ScatterChart.styles.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.types.d.ts +5 -0
- package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -0
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js +30 -7
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +3 -0
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +51 -32
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js.map +1 -1
- package/lib/types/IDataPoint.d.ts +18 -0
- package/lib/types/IDataPoint.js.map +1 -1
- package/lib/utilities/SVGTooltipText.js +3 -3
- package/lib/utilities/SVGTooltipText.js.map +1 -1
- package/lib/utilities/utilities.d.ts +6 -3
- package/lib/utilities/utilities.js +58 -29
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-amd/components/AreaChart/AreaChart.base.d.ts +1 -0
- package/lib-amd/components/AreaChart/AreaChart.base.js +4 -1
- package/lib-amd/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.base.js +14 -13
- package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.styles.js +41 -37
- package/lib-amd/components/CommonComponents/CartesianChart.styles.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +12 -2
- package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +37 -15
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.d.ts +2 -1
- package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js +11 -2
- package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +13 -3
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +276 -199
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/DonutChart/DonutChart.base.js +1 -0
- package/lib-amd/components/DonutChart/DonutChart.base.js.map +1 -1
- package/lib-amd/components/DonutChart/DonutChart.styles.js +17 -1
- package/lib-amd/components/DonutChart/DonutChart.styles.js.map +1 -1
- package/lib-amd/components/DonutChart/DonutChart.types.d.ts +4 -0
- package/lib-amd/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +2 -0
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +24 -3
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/HeatMapChart/HeatMapChart.base.d.ts +7 -0
- package/lib-amd/components/HeatMapChart/HeatMapChart.base.js +94 -36
- package/lib-amd/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +3 -0
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +23 -2
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib-amd/components/ScatterChart/ScatterChart.base.js +83 -54
- package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib-amd/components/ScatterChart/ScatterChart.styles.js +12 -1
- package/lib-amd/components/ScatterChart/ScatterChart.styles.js.map +1 -1
- package/lib-amd/components/ScatterChart/ScatterChart.types.d.ts +5 -0
- package/lib-amd/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -0
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +29 -6
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +3 -0
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +50 -31
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-amd/index.d.ts +1 -1
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/types/IDataPoint.d.ts +18 -0
- package/lib-amd/types/IDataPoint.js.map +1 -1
- package/lib-amd/utilities/SVGTooltipText.js +3 -3
- package/lib-amd/utilities/SVGTooltipText.js.map +1 -1
- package/lib-amd/utilities/utilities.d.ts +6 -3
- package/lib-amd/utilities/utilities.js +59 -30
- package/lib-amd/utilities/utilities.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.base.d.ts +1 -0
- package/lib-commonjs/components/AreaChart/AreaChart.base.js +4 -1
- package/lib-commonjs/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +14 -13
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js +41 -37
- package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +12 -2
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +37 -15
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.d.ts +2 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +11 -2
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +13 -3
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +276 -198
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.base.js +1 -0
- package/lib-commonjs/components/DonutChart/DonutChart.base.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.styles.js +18 -0
- package/lib-commonjs/components/DonutChart/DonutChart.styles.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.types.d.ts +4 -0
- package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +2 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +24 -3
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.d.ts +7 -0
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js +94 -36
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +3 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +23 -2
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.base.js +83 -54
- package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.styles.js +12 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.styles.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.d.ts +5 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -0
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +29 -6
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +3 -0
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +50 -31
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-commonjs/index.d.ts +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types/IDataPoint.d.ts +18 -0
- package/lib-commonjs/types/IDataPoint.js.map +1 -1
- package/lib-commonjs/utilities/SVGTooltipText.js +3 -3
- package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/utilities.d.ts +6 -3
- package/lib-commonjs/utilities/utilities.js +59 -30
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +2 -2
- package/src/components/CommonComponents/CartesianChart.types.ts +20 -1
- package/src/components/DonutChart/DonutChart.types.ts +5 -0
- package/src/components/ScatterChart/ScatterChart.types.ts +7 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IDataPoint.js","sourceRoot":"../src/","sources":["types/IDataPoint.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { SankeyLink, SankeyNode } from 'd3-sankey';\nimport { LegendShape } from '../components/Legends/Legends.types';\nimport { CurveFactory } from 'd3-shape';\n\nexport interface IBasestate {\n _width?: number;\n _height?: number;\n activeLegend?: string;\n color?: string;\n dataForHoverCard?: number | string;\n isCalloutVisible: boolean;\n isLegendSelected?: boolean;\n isLegendHovered?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n refSelected?: any;\n YValueHover?: { legend?: string; y?: number | string; color?: string }[];\n hoverYValue?: string | number | null;\n hoverXValue?: string | number | null;\n xCalloutValue?: string;\n yCalloutValue?: string;\n lineColor?: string;\n hoveredLineColor?: string;\n selectedLegend?: string;\n containerWidth?: number;\n containerHeight?: number;\n}\n\nexport interface IRefArrayData {\n index?: string;\n refElement?: SVGGElement;\n}\n\n/**\n * {@docCategory IChartProps}\n */\nexport interface IMargins {\n /**\n * left margin for the chart.\n */\n left?: number;\n /**\n * Right margin for the chart.\n */\n right?: number;\n /**\n * Top margin for the chart.\n */\n top?: number;\n /**\n * Bottom margin for the chart.\n */\n bottom?: number;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface IDataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n * If x is a number, then each y-coordinate is plotted at its x-coordinate.\n * If x is a string, then the data is evenly spaced along the x-axis.\n */\n x: number | string;\n\n /**\n * Dependent value of the data point, rendered along the y-axis.\n */\n y: number;\n\n // NOTE: VerticalStackedBarChart, PieChart\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface IVerticalStackedBarDataPoint extends Omit<IDataPoint, 'x'> {\n /**\n * Independent value of the data point, rendered along the x-axis.\n * If x is a number, then each y-coordinate is plotted at its x-coordinate.\n * If x is a string, then the data is evenly spaced along the x-axis.\n * If data type on x is Date, then the data is spaced evenly by d3-scale.\n */\n x: number | string | Date;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface IHorizontalDataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n * If x is a number, then each y-coordinate is plotted at its x-coordinate.\n * If x is a string, then the data is evenly spaced along the x-axis.\n */\n x: number;\n\n /**\n * Dependent value of the data point, rendered along the y-axis.\n */\n y: number;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface IChartDataPoint {\n /**\n * Legend text for the datapoint in the chart\n */\n legend?: string;\n\n /**\n * data the datapoint in the chart\n */\n data?: number;\n\n /**\n * data the datapoint in the chart\n */\n horizontalBarChartdata?: IHorizontalDataPoint;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n\n /**\n * Color for the legend in the chart. If not provided, it will fallback on the default color palette.\n */\n color?: string;\n\n /**\n * Gradient for the legend in the chart. If not provided, it will fallback on the default color palette.\n * If provided, it will override the color prop. granted `enableGradient` is set to true for the chart.\n */\n gradient?: [string, string];\n\n /**\n * placeholder data point\n */\n placeHolder?: boolean;\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven;t given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: IAccessibilityProps;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface IVerticalBarChartDataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n * If x is a number, then each y-coordinate is plotted at its x-coordinate.\n * If x is a string, then the data is evenly spaced along the x-axis.\n */\n x: number | string | Date;\n\n /**\n * Dependent value of the data point, rendered along the y-axis.\n */\n y: number;\n\n /**\n * Legend text for the datapoint in the chart\n */\n legend?: string;\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * Gradient for the legend in the chart. If not provided, it will fallback on the default color palette.\n * If provided, it will override the color prop. granted `enableGradient` is set to true for the chart.\n */\n gradient?: [string, string];\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven;t given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * data to render the line along with bars\n */\n lineData?: ILineDataInVerticalBarChart;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: IAccessibilityProps;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface IHorizontalBarChartWithAxisDataPoint {\n /**\n * Dependent value of the data point, rendered along the x-axis.\n */\n x: number;\n\n /**\n * Independent value of the data point, rendered along the y-axis.\n * If y is a number, then each y-coordinate is plotted at its y-coordinate.\n * If y is a string, then the data is evenly spaced along the y-axis.\n */\n y: number | string;\n\n /**\n * Legend text for the datapoint in the chart\n */\n legend?: string;\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * Gradient for the legend in the chart. If not provided, it will fallback on the default color palette.\n * If provided, it will override the color prop. granted `enableGradient` is set to true for the chart.\n */\n gradient?: [string, string];\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven;t given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: IAccessibilityProps;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface ILineDataInVerticalBarChart {\n y: IVerticalBarChartDataPoint['y'];\n yAxisCalloutData?: string | undefined;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n /**\n * Whether to use the secondary y scale or not\n * False by default.\n */\n useSecondaryYScale?: boolean;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface IBaseDataPoint {\n /**\n * Defines the function that is executed on clicking line\n */\n onDataPointClick?: () => void;\n\n /**\n * Callout data for x axis\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n */\n yAxisCalloutData?: string | { [id: string]: number };\n\n /**\n * Whether to hide callout data for the point.\n */\n hideCallout?: boolean;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: IAccessibilityProps;\n\n /**\n * X axis Accessibility data for callout\n */\n xAxisCalloutAccessibilityData?: IAccessibilityProps;\n\n /**\n * Marker size of the points\n */\n markerSize?: number;\n\n /**\n * text labels of marker points\n */\n text?: string;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface ILineChartDataPoint extends IBaseDataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n * If x is a number, then each y-coordinate is plotted at its x-coordinate.\n * If data type on x is Date, then the data is spaced evenly by d3-scale\n */\n x: number | Date;\n\n /**\n * Dependent value of the data point, rendered along the y-axis.\n */\n y: number;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface ILineChartGap {\n /**\n * Starting index of the gap.\n */\n startIndex: number;\n\n /**\n * Ending index of the gap.\n */\n endIndex: number;\n}\n\n/**\n * {@docCategory IChartProps}\n */\nexport interface ILineChartLineOptions extends React.SVGProps<SVGPathElement> {\n /**\n * Width of the line/stroke.\n * Overrides the strokeWidth set on ICartesianChartProps level.\n * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-width\n */\n strokeWidth?: number | string;\n\n /**\n * Pattern of dashes and gaps.\n * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray\n */\n strokeDasharray?: string | number;\n\n /**\n * Offset on rendering of stroke dash array.\n * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dashoffset\n */\n strokeDashoffset?: string | number;\n\n /**\n * Shape at the end of a subpath.\n * Default round.\n * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-linecap\n */\n strokeLinecap?: 'butt' | 'round' | 'square' | 'inherit';\n\n /**\n * Width of border around the line. Default no border.\n */\n lineBorderWidth?: string | number;\n\n /**\n * Color of border around the line. Default white.\n */\n lineBorderColor?: string;\n\n /**\n * Defines the type of interpolation used to render the line.\n * @default 'linear'\n */\n curve?: 'linear' | 'natural' | 'step' | 'stepAfter' | 'stepBefore' | CurveFactory;\n\n /**\n * Defines the mode of points to be rendered.\n */\n mode?:\n | 'lines'\n | 'markers'\n | 'text'\n | 'lines+markers'\n | 'text+markers'\n | 'text+lines'\n | 'text+lines+markers'\n | 'none'\n | 'gauge'\n | 'number'\n | 'delta'\n | 'number+delta'\n | 'gauge+number'\n | 'gauge+number+delta'\n | 'gauge+delta'\n | 'markers+text';\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface ILineChartPoints {\n /**\n * Legend text for the datapoint in the chart\n */\n legend: string;\n\n /**\n * The shape for the legend\n * default: show the rect legend\n */\n legendShape?: LegendShape;\n\n /**\n * dataPoints for the line chart\n */\n data: ILineChartDataPoint[];\n\n /**\n * gaps in the line chart where a line is not drawn\n */\n gaps?: ILineChartGap[];\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * opacity for chart fill color\n */\n opacity?: number;\n\n /**\n * options for the line drawn\n */\n lineOptions?: ILineChartLineOptions;\n\n /**\n * hide dots for points that are not active\n */\n hideNonActiveDots?: boolean;\n\n /**\n * Defines the function that is executed on clicking this legend\n */\n onLegendClick?: (selectedLegend: string | null | string[]) => void;\n\n /**\n * Defines the function that is executed on clicking line\n */\n onLineClick?: () => void;\n\n /**\n * Whether to use the secondary y scale or not\n * False by default.\n */\n useSecondaryYScale?: boolean;\n}\n\n/**\n * {@docCategory IChartProps}\n */\nexport interface IChartProps {\n /**\n * chart title for the chart\n */\n chartTitle?: string;\n\n /**\n * Accessibility data for chart title\n */\n chartTitleAccessibilityData?: IAccessibilityProps;\n /**\n * data for the points in the chart\n */\n chartData?: IChartDataPoint[];\n\n /**\n * Accessibility data for chart data\n */\n chartDataAccessibilityData?: IAccessibilityProps;\n\n /**\n * data for the points in the line chart\n */\n lineChartData?: ILineChartPoints[];\n\n /**\n * data for the points in the scatter chart\n */\n scatterChartData?: IScatterChartPoints[];\n\n /**\n * data for the points in the line chart\n */\n SankeyChartData?: ISankeyChartData;\n\n /**\n * data for the points in the line chart\n */\n pointOptions?: React.SVGProps<SVGCircleElement>;\n\n /**\n * data for the dotted line on hovering the point\n */\n pointLineOptions?: React.SVGProps<SVGLineElement>;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface ISankeyChartData {\n nodes: SNode[];\n links: SLink[];\n}\n\ninterface ISNodeExtra {\n /**\n * A unique identifier for this node.\n */\n nodeId: number | string;\n /**\n * The display name for this node in the UX.\n */\n name: string;\n color?: string;\n borderColor?: string;\n actualValue?: number;\n layer?: number;\n}\n\ninterface ISLinkExtra {\n /**\n * The index within `ISankeyChartData.nodes` of the source node.\n */\n source: number;\n /**\n * The index within `ISankeyChartData.nodes` of the target node.\n */\n target: number;\n /**\n * The weight of this link between the two nodes.\n */\n value: number;\n unnormalizedValue?: number;\n}\n\nexport type SNode = SankeyNode<ISNodeExtra, ISLinkExtra>;\nexport type SLink = SankeyLink<ISNodeExtra, ISLinkExtra>;\n\n/**\n * {@docCategory IChartProps}\n */\nexport interface IAccessibilityProps {\n /**\n * Accessibility aria-label\n */\n ariaLabel?: string;\n\n /**\n * Accessibility aria-labelledBy\n */\n ariaLabelledBy?: string;\n\n /**\n * Accessibility aria-describedBy\n */\n ariaDescribedBy?: string;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface IVSChartDataPoint {\n /**\n * data the datapoint in the chart\n */\n data: number | string;\n\n /**\n * Legend text for the datapoint in the chart\n */\n legend: string;\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * Gradient for the legend in the chart. If not provided, it will fallback on the default color palette.\n * If provided, it will override the color prop. granted `enableGradient` is set to true for the chart.\n */\n gradient?: [string, string];\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven;t given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: IAccessibilityProps;\n}\n\n/**\n * {@docCategory IChartProps}\n */\nexport interface IVerticalStackedChartProps {\n /**\n * data for the points in the chart\n */\n chartData: IVSChartDataPoint[];\n\n /**\n * Data for x axis label for multistacked Vertical bar chart\n */\n xAxisPoint: number | string | Date;\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven't given, legend will take\n */\n xAxisCalloutData?: string;\n /**\n * line data to render lines on stacked bar chart\n */\n lineData?: ILineDataInVerticalStackedBarChart[];\n /**\n * Accessibility data for Whole stack callout\n */\n stackCallOutAccessibilityData?: IAccessibilityProps;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface ILineDataInVerticalStackedBarChart {\n y: number | string;\n color: string;\n legend: string;\n /**\n * The shape for the legend\n * default: show the rect legend\n */\n legendShape?: LegendShape;\n /**\n * Data to show in callout\n */\n data?: number | string;\n yAxisCalloutData?: string;\n /**\n * Whether to use the secondary y scale or not\n * False by default.\n */\n useSecondaryYScale?: boolean;\n /**\n * options for the line drawn\n */\n lineOptions?: ILineChartLineOptions;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface IGVBarChartSeriesPoint {\n /**\n * Text for // need to check use of this\n */\n key: string;\n\n /**\n * Data for bar height of Grouped vertical bar chart\n */\n data: number;\n\n /**\n * Color for the legend in the chart\n */\n color: string;\n\n /**\n * Gradient for the legend in the chart. If not provided, it will fallback on the default color palette.\n * If provided, it will override the color prop. granted `enableGradient` is set to true for the chart.\n */\n gradient?: [string, string];\n\n /**\n * Legend text in the chart\n */\n legend: string;\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven;t given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: IAccessibilityProps;\n\n /**\n * Whether to use the secondary y scale or not\n * False by default.\n */\n useSecondaryYScale?: boolean;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface IGroupedVerticalBarChartData {\n /**\n * Data for X axis label\n */\n name: string;\n\n /**\n * Data points for Grouped vertical bar chart\n */\n series: IGVBarChartSeriesPoint[];\n\n /**\n * Accessibility data for Group Bars Stack Callout\n */\n stackCallOutAccessibilityData?: IAccessibilityProps;\n}\n\nexport interface IGVDataPoint {\n /**\n * This interface used for - While forming datapoints from given prop \"data\" in code\n * datapoints are used for to draw graph\n */\n [key: string]: number | string;\n}\n\nexport interface IGVSingleDataPoint {\n /**\n * While forming datapoints from given prop \"data\" in code.\n * These datapoints are used for to draw graph easily.\n */\n [key: string]: IGVDataPoint;\n}\n\nexport interface IGVForBarChart {\n /**\n * While forming datapoints from given prop \"data\"\n * These datapoints are used for to draw graph.\n */\n [key: string]: IGVBarChartSeriesPoint;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface IHeatMapChartDataPoint {\n x: string | Date | number;\n y: string | Date | number;\n value: number;\n /**\n * The value/ text to be rendered in the rectange\n */\n rectText?: string | number;\n /**\n * denomination to show in the callout\n */\n ratio?: [number, number];\n /**\n * description message to the callout\n */\n descriptionMessage?: string;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: IAccessibilityProps;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface IHeatMapChartData {\n /**\n * name of the legend\n */\n legend: string;\n data: IHeatMapChartDataPoint[];\n /**\n * This number will be used to get the color for the legend\n */\n value: number;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface ICustomizedCalloutDataPoint {\n legend: string;\n y: number;\n color: string;\n xAxisCalloutData?: string;\n yAxisCalloutData?: string | { [id: string]: number };\n}\n\n/**\n * Used for custom callout data interface. As Area chart callout data will be prepared from given props.data,\n * Those required data passing to onRenderCalloutPerDataPoint and onRenderCalloutPerStack.\n * {@docCategory IChartData}\n */\nexport interface ICustomizedCalloutData {\n x: number | string | Date;\n values: ICustomizedCalloutDataPoint[];\n}\n\n/**\n * {@docCategory Chart}\n */\nexport interface IChart {\n chartContainer: HTMLElement | null;\n toImage?: (opts?: IImageExportOptions) => Promise<string>;\n}\n\n/**\n * {@docCategory Chart}\n */\nexport interface IImageExportOptions {\n width?: number;\n height?: number;\n scale?: number;\n background?: string;\n}\n\n/**\n * {@docCategory IChartData}\n * ScatterChartDataPoint interface.\n */\nexport interface IScatterChartDataPoint extends IBaseDataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n */\n x: number | Date | string;\n\n /**\n * Dependent value of the data point, rendered along the y-axis.\n */\n y: number;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface IScatterChartPoints {\n /**\n * Legend text for the datapoint in the chart\n */\n legend: string;\n\n /**\n * The shape for the legend\n * default: show the rect legend\n */\n legendShape?: LegendShape;\n\n /**\n * dataPoints for the line chart\n */\n data: IScatterChartDataPoint[];\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * opacity for chart fill color\n */\n opacity?: number;\n\n /**\n * hide dots for points that are not active\n */\n hideNonActiveDots?: boolean;\n\n /**\n * Defines the function that is executed on clicking this legend\n */\n onLegendClick?: (selectedLegend: string | null | string[]) => void;\n\n /**\n * Whether to use the secondary y scale or not\n * False by default.\n */\n useSecondaryYScale?: boolean;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"IDataPoint.js","sourceRoot":"../src/","sources":["types/IDataPoint.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { SankeyLink, SankeyNode } from 'd3-sankey';\nimport { LegendShape } from '../components/Legends/Legends.types';\nimport { CurveFactory } from 'd3-shape';\n\nexport interface IBasestate {\n _width?: number;\n _height?: number;\n activeLegend?: string;\n color?: string;\n dataForHoverCard?: number | string;\n isCalloutVisible: boolean;\n isLegendSelected?: boolean;\n isLegendHovered?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n refSelected?: any;\n YValueHover?: { legend?: string; y?: number | string; color?: string }[];\n hoverYValue?: string | number | null;\n hoverXValue?: string | number | null;\n xCalloutValue?: string;\n yCalloutValue?: string;\n lineColor?: string;\n hoveredLineColor?: string;\n selectedLegend?: string;\n containerWidth?: number;\n containerHeight?: number;\n}\n\nexport interface IRefArrayData {\n index?: string;\n refElement?: SVGGElement;\n}\n\n/**\n * {@docCategory IChartProps}\n */\nexport interface IMargins {\n /**\n * left margin for the chart.\n */\n left?: number;\n /**\n * Right margin for the chart.\n */\n right?: number;\n /**\n * Top margin for the chart.\n */\n top?: number;\n /**\n * Bottom margin for the chart.\n */\n bottom?: number;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface IDataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n * If x is a number, then each y-coordinate is plotted at its x-coordinate.\n * If x is a string, then the data is evenly spaced along the x-axis.\n */\n x: number | string;\n\n /**\n * Dependent value of the data point, rendered along the y-axis.\n */\n y: number;\n\n // NOTE: VerticalStackedBarChart, PieChart\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface IVerticalStackedBarDataPoint extends Omit<IDataPoint, 'x'> {\n /**\n * Independent value of the data point, rendered along the x-axis.\n * If x is a number, then each y-coordinate is plotted at its x-coordinate.\n * If x is a string, then the data is evenly spaced along the x-axis.\n * If data type on x is Date, then the data is spaced evenly by d3-scale.\n */\n x: number | string | Date;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface IHorizontalDataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n * If x is a number, then each y-coordinate is plotted at its x-coordinate.\n * If x is a string, then the data is evenly spaced along the x-axis.\n */\n x: number;\n\n /**\n * Dependent value of the data point, rendered along the y-axis.\n */\n y: number;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface IChartDataPoint {\n /**\n * Legend text for the datapoint in the chart\n */\n legend?: string;\n\n /**\n * data the datapoint in the chart\n */\n data?: number;\n\n /**\n * data the datapoint in the chart\n */\n horizontalBarChartdata?: IHorizontalDataPoint;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n\n /**\n * Color for the legend in the chart. If not provided, it will fallback on the default color palette.\n */\n color?: string;\n\n /**\n * Gradient for the legend in the chart. If not provided, it will fallback on the default color palette.\n * If provided, it will override the color prop. granted `enableGradient` is set to true for the chart.\n */\n gradient?: [string, string];\n\n /**\n * placeholder data point\n */\n placeHolder?: boolean;\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven;t given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: IAccessibilityProps;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface IVerticalBarChartDataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n * If x is a number, then each y-coordinate is plotted at its x-coordinate.\n * If x is a string, then the data is evenly spaced along the x-axis.\n */\n x: number | string | Date;\n\n /**\n * Dependent value of the data point, rendered along the y-axis.\n */\n y: number;\n\n /**\n * Legend text for the datapoint in the chart\n */\n legend?: string;\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * Gradient for the legend in the chart. If not provided, it will fallback on the default color palette.\n * If provided, it will override the color prop. granted `enableGradient` is set to true for the chart.\n */\n gradient?: [string, string];\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven;t given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * data to render the line along with bars\n */\n lineData?: ILineDataInVerticalBarChart;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: IAccessibilityProps;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface IHorizontalBarChartWithAxisDataPoint {\n /**\n * Dependent value of the data point, rendered along the x-axis.\n */\n x: number;\n\n /**\n * Independent value of the data point, rendered along the y-axis.\n * If y is a number, then each y-coordinate is plotted at its y-coordinate.\n * If y is a string, then the data is evenly spaced along the y-axis.\n */\n y: number | string;\n\n /**\n * Legend text for the datapoint in the chart\n */\n legend?: string;\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * Gradient for the legend in the chart. If not provided, it will fallback on the default color palette.\n * If provided, it will override the color prop. granted `enableGradient` is set to true for the chart.\n */\n gradient?: [string, string];\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven;t given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: IAccessibilityProps;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface ILineDataInVerticalBarChart {\n y: IVerticalBarChartDataPoint['y'];\n yAxisCalloutData?: string | undefined;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n /**\n * Whether to use the secondary y scale or not\n * False by default.\n */\n useSecondaryYScale?: boolean;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface IBaseDataPoint {\n /**\n * Defines the function that is executed on clicking line\n */\n onDataPointClick?: () => void;\n\n /**\n * Callout data for x axis\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n */\n yAxisCalloutData?: string | { [id: string]: number };\n\n /**\n * Whether to hide callout data for the point.\n */\n hideCallout?: boolean;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: IAccessibilityProps;\n\n /**\n * X axis Accessibility data for callout\n */\n xAxisCalloutAccessibilityData?: IAccessibilityProps;\n\n /**\n * Marker size of the points\n */\n markerSize?: number;\n\n /**\n * text labels of marker points\n */\n text?: string;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface ILineChartDataPoint extends IBaseDataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n * If x is a number, then each y-coordinate is plotted at its x-coordinate.\n * If data type on x is Date, then the data is spaced evenly by d3-scale\n */\n x: number | Date;\n\n /**\n * Dependent value of the data point, rendered along the y-axis.\n */\n y: number;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface ILineChartGap {\n /**\n * Starting index of the gap.\n */\n startIndex: number;\n\n /**\n * Ending index of the gap.\n */\n endIndex: number;\n}\n\n/**\n * {@docCategory IChartProps}\n */\nexport interface ILineChartLineOptions extends React.SVGProps<SVGPathElement> {\n /**\n * Width of the line/stroke.\n * Overrides the strokeWidth set on ICartesianChartProps level.\n * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-width\n */\n strokeWidth?: number | string;\n\n /**\n * Pattern of dashes and gaps.\n * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray\n */\n strokeDasharray?: string | number;\n\n /**\n * Offset on rendering of stroke dash array.\n * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dashoffset\n */\n strokeDashoffset?: string | number;\n\n /**\n * Shape at the end of a subpath.\n * Default round.\n * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-linecap\n */\n strokeLinecap?: 'butt' | 'round' | 'square' | 'inherit';\n\n /**\n * Width of border around the line. Default no border.\n */\n lineBorderWidth?: string | number;\n\n /**\n * Color of border around the line. Default white.\n */\n lineBorderColor?: string;\n\n /**\n * Defines the type of interpolation used to render the line.\n * @default 'linear'\n */\n curve?: 'linear' | 'natural' | 'step' | 'stepAfter' | 'stepBefore' | CurveFactory;\n\n /**\n * Defines the mode of points to be rendered.\n */\n mode?:\n | 'lines'\n | 'markers'\n | 'text'\n | 'lines+markers'\n | 'text+markers'\n | 'text+lines'\n | 'text+lines+markers'\n | 'none'\n | 'gauge'\n | 'number'\n | 'delta'\n | 'number+delta'\n | 'gauge+number'\n | 'gauge+number+delta'\n | 'gauge+delta'\n | 'markers+text';\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface ILineChartPoints {\n /**\n * Legend text for the datapoint in the chart\n */\n legend: string;\n\n /**\n * The shape for the legend\n * default: show the rect legend\n */\n legendShape?: LegendShape;\n\n /**\n * dataPoints for the line chart\n */\n data: ILineChartDataPoint[];\n\n /**\n * gaps in the line chart where a line is not drawn\n */\n gaps?: ILineChartGap[];\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * opacity for chart fill color\n */\n opacity?: number;\n\n /**\n * options for the line drawn\n */\n lineOptions?: ILineChartLineOptions;\n\n /**\n * hide dots for points that are not active\n */\n hideNonActiveDots?: boolean;\n\n /**\n * Defines the function that is executed on clicking this legend\n */\n onLegendClick?: (selectedLegend: string | null | string[]) => void;\n\n /**\n * Defines the function that is executed on clicking line\n */\n onLineClick?: () => void;\n\n /**\n * Whether to use the secondary y scale or not\n * False by default.\n */\n useSecondaryYScale?: boolean;\n}\n\n/**\n * {@docCategory IChartProps}\n */\nexport interface IChartProps {\n /**\n * chart title for the chart\n */\n chartTitle?: string;\n\n /**\n * Accessibility data for chart title\n */\n chartTitleAccessibilityData?: IAccessibilityProps;\n /**\n * data for the points in the chart\n */\n chartData?: IChartDataPoint[];\n\n /**\n * Accessibility data for chart data\n */\n chartDataAccessibilityData?: IAccessibilityProps;\n\n /**\n * data for the points in the line chart\n */\n lineChartData?: ILineChartPoints[];\n\n /**\n * data for the points in the scatter chart\n */\n scatterChartData?: IScatterChartPoints[];\n\n /**\n * data for the points in the line chart\n */\n SankeyChartData?: ISankeyChartData;\n\n /**\n * data for the points in the line chart\n */\n pointOptions?: React.SVGProps<SVGCircleElement>;\n\n /**\n * data for the dotted line on hovering the point\n */\n pointLineOptions?: React.SVGProps<SVGLineElement>;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface ISankeyChartData {\n nodes: SNode[];\n links: SLink[];\n}\n\ninterface ISNodeExtra {\n /**\n * A unique identifier for this node.\n */\n nodeId: number | string;\n /**\n * The display name for this node in the UX.\n */\n name: string;\n color?: string;\n borderColor?: string;\n actualValue?: number;\n layer?: number;\n}\n\ninterface ISLinkExtra {\n /**\n * The index within `ISankeyChartData.nodes` of the source node.\n */\n source: number;\n /**\n * The index within `ISankeyChartData.nodes` of the target node.\n */\n target: number;\n /**\n * The weight of this link between the two nodes.\n */\n value: number;\n unnormalizedValue?: number;\n}\n\nexport type SNode = SankeyNode<ISNodeExtra, ISLinkExtra>;\nexport type SLink = SankeyLink<ISNodeExtra, ISLinkExtra>;\n\n/**\n * {@docCategory IChartProps}\n */\nexport interface IAccessibilityProps {\n /**\n * Accessibility aria-label\n */\n ariaLabel?: string;\n\n /**\n * Accessibility aria-labelledBy\n */\n ariaLabelledBy?: string;\n\n /**\n * Accessibility aria-describedBy\n */\n ariaDescribedBy?: string;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface IVSChartDataPoint {\n /**\n * data the datapoint in the chart\n */\n data: number | string;\n\n /**\n * Legend text for the datapoint in the chart\n */\n legend: string;\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * Gradient for the legend in the chart. If not provided, it will fallback on the default color palette.\n * If provided, it will override the color prop. granted `enableGradient` is set to true for the chart.\n */\n gradient?: [string, string];\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven;t given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: IAccessibilityProps;\n}\n\n/**\n * {@docCategory IChartProps}\n */\nexport interface IVerticalStackedChartProps {\n /**\n * data for the points in the chart\n */\n chartData: IVSChartDataPoint[];\n\n /**\n * Data for x axis label for multistacked Vertical bar chart\n */\n xAxisPoint: number | string | Date;\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven't given, legend will take\n */\n xAxisCalloutData?: string;\n /**\n * line data to render lines on stacked bar chart\n */\n lineData?: ILineDataInVerticalStackedBarChart[];\n /**\n * Accessibility data for Whole stack callout\n */\n stackCallOutAccessibilityData?: IAccessibilityProps;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface ILineDataInVerticalStackedBarChart {\n y: number | string;\n color: string;\n legend: string;\n /**\n * The shape for the legend\n * default: show the rect legend\n */\n legendShape?: LegendShape;\n /**\n * Data to show in callout\n */\n data?: number | string;\n yAxisCalloutData?: string;\n /**\n * Whether to use the secondary y scale or not\n * False by default.\n */\n useSecondaryYScale?: boolean;\n /**\n * options for the line drawn\n */\n lineOptions?: ILineChartLineOptions;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface IGVBarChartSeriesPoint {\n /**\n * Text for // need to check use of this\n */\n key: string;\n\n /**\n * Data for bar height of Grouped vertical bar chart\n */\n data: number;\n\n /**\n * Color for the legend in the chart\n */\n color: string;\n\n /**\n * Gradient for the legend in the chart. If not provided, it will fallback on the default color palette.\n * If provided, it will override the color prop. granted `enableGradient` is set to true for the chart.\n */\n gradient?: [string, string];\n\n /**\n * Legend text in the chart\n */\n legend: string;\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven;t given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: IAccessibilityProps;\n\n /**\n * Whether to use the secondary y scale or not\n * False by default.\n */\n useSecondaryYScale?: boolean;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface IGroupedVerticalBarChartData {\n /**\n * Data for X axis label\n */\n name: string;\n\n /**\n * Data points for Grouped vertical bar chart\n */\n series: IGVBarChartSeriesPoint[];\n\n /**\n * Accessibility data for Group Bars Stack Callout\n */\n stackCallOutAccessibilityData?: IAccessibilityProps;\n}\n\nexport interface IGVDataPoint {\n /**\n * This interface used for - While forming datapoints from given prop \"data\" in code\n * datapoints are used for to draw graph\n */\n [key: string]: number | string;\n}\n\nexport interface IGVSingleDataPoint {\n /**\n * While forming datapoints from given prop \"data\" in code.\n * These datapoints are used for to draw graph easily.\n */\n [key: string]: IGVDataPoint;\n}\n\nexport interface IGVForBarChart {\n /**\n * While forming datapoints from given prop \"data\"\n * These datapoints are used for to draw graph.\n */\n [key: string]: IGVBarChartSeriesPoint;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface IHeatMapChartDataPoint {\n x: string | Date | number;\n y: string | Date | number;\n value: number;\n /**\n * The value/ text to be rendered in the rectange\n */\n rectText?: string | number;\n /**\n * denomination to show in the callout\n */\n ratio?: [number, number];\n /**\n * description message to the callout\n */\n descriptionMessage?: string;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: IAccessibilityProps;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface IHeatMapChartData {\n /**\n * name of the legend\n */\n legend: string;\n data: IHeatMapChartDataPoint[];\n /**\n * This number will be used to get the color for the legend\n */\n value: number;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface ICustomizedCalloutDataPoint {\n legend: string;\n y: number;\n color: string;\n xAxisCalloutData?: string;\n yAxisCalloutData?: string | { [id: string]: number };\n}\n\n/**\n * Used for custom callout data interface. As Area chart callout data will be prepared from given props.data,\n * Those required data passing to onRenderCalloutPerDataPoint and onRenderCalloutPerStack.\n * {@docCategory IChartData}\n */\nexport interface ICustomizedCalloutData {\n x: number | string | Date;\n values: ICustomizedCalloutDataPoint[];\n}\n\n/**\n * {@docCategory Chart}\n */\nexport interface IChart {\n chartContainer: HTMLElement | null;\n toImage?: (opts?: IImageExportOptions) => Promise<string>;\n}\n\n/**\n * {@docCategory Chart}\n */\nexport interface IImageExportOptions {\n width?: number;\n height?: number;\n scale?: number;\n background?: string;\n}\n\n/**\n * {@docCategory IChartData}\n * ScatterChartDataPoint interface.\n */\nexport interface IScatterChartDataPoint extends IBaseDataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n */\n x: number | Date | string;\n\n /**\n * Dependent value of the data point, rendered along the y-axis.\n */\n y: number;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface IScatterChartPoints {\n /**\n * Legend text for the datapoint in the chart\n */\n legend: string;\n\n /**\n * The shape for the legend\n * default: show the rect legend\n */\n legendShape?: LegendShape;\n\n /**\n * dataPoints for the line chart\n */\n data: IScatterChartDataPoint[];\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * opacity for chart fill color\n */\n opacity?: number;\n\n /**\n * hide dots for points that are not active\n */\n hideNonActiveDots?: boolean;\n\n /**\n * Defines the function that is executed on clicking this legend\n */\n onLegendClick?: (selectedLegend: string | null | string[]) => void;\n\n /**\n * Whether to use the secondary y scale or not\n * False by default.\n */\n useSecondaryYScale?: boolean;\n}\n\n/**\n * Specifies the ordering options for axis categories in Cartesian charts.\n *\n * - `'default'`: Uses the original order before custom ordering was supported.\n * In some charts, this behaves the same as `'data'`.\n * - `'data'`: Preserves the order of categories as provided in the input data.\n * - `string[]`: Explicitly defines the custom order of categories as an array of category names.\n * - `'category ascending' | 'category descending'`: Orders categories alphanumerically.\n * - `'total ascending' | 'total descending'`: Orders categories by the total of their associated values.\n * - `'min ascending' | 'min descending'`: Orders by the minimum value within each category.\n * - `'max ascending' | 'max descending'`: Orders by the maximum value within each category.\n * - `'sum ascending' | 'sum descending'`: Orders by the sum of values for each category (same as 'total').\n * - `'mean ascending' | 'mean descending'`: Orders by the average of values in each category.\n * - `'median ascending' | 'median descending'`: Orders by the median value of each category.\n *\n * {@docCategory CartesianChart}\n */\nexport type AxisCategoryOrder =\n | 'default'\n | 'data'\n | string[]\n | 'category ascending'\n | 'category descending'\n | 'total ascending'\n | 'total descending'\n | 'min ascending'\n | 'min descending'\n | 'max ascending'\n | 'max descending'\n | 'sum ascending'\n | 'sum descending'\n | 'mean ascending'\n | 'mean descending'\n | 'median ascending'\n | 'median descending';\n"]}
|
|
@@ -2,7 +2,7 @@ define(["require", "exports", "tslib", "react", "@fluentui/react/lib/Tooltip", "
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.SVGTooltipText = void 0;
|
|
5
|
-
var PADDING =
|
|
5
|
+
var PADDING = 3;
|
|
6
6
|
/**
|
|
7
7
|
* Component to render an SVG text element with an optional tooltip.
|
|
8
8
|
* The tooltip appears on hovering and focusing the element when its content overflows.
|
|
@@ -159,9 +159,9 @@ define(["require", "exports", "tslib", "react", "@fluentui/react/lib/Tooltip", "
|
|
|
159
159
|
}, onMouseEnter: this._onTooltipMouseEnter, onMouseLeave: this._onTooltipMouseLeave }, tooltipProps);
|
|
160
160
|
var showTooltip = (!!this.props.isTooltipVisibleProp && this.state.isOverflowing && !!content) || (isTooltipVisible && !!content);
|
|
161
161
|
var rectX = (typeof (textProps === null || textProps === void 0 ? void 0 : textProps.x) === 'number' ? textProps.x : 0) - (textWidth !== null && textWidth !== void 0 ? textWidth : 0) / 2 - PADDING;
|
|
162
|
-
var rectY = (typeof (textProps === null || textProps === void 0 ? void 0 : textProps.y) === 'number' ? textProps.y : 0) - (textHeight !== null && textHeight !== void 0 ? textHeight : 0) / 2 - PADDING;
|
|
162
|
+
var rectY = (typeof (textProps === null || textProps === void 0 ? void 0 : textProps.y) === 'number' ? textProps.y : 0) - (textHeight !== null && textHeight !== void 0 ? textHeight : 0) / 2 - 2 * PADDING;
|
|
163
163
|
return (React.createElement(React.Fragment, null,
|
|
164
|
-
showBackground && (React.createElement("rect", { x: rectX, y: rectY, width: (textWidth !== null && textWidth !== void 0 ? textWidth : 0) + 2 * PADDING, height: (textHeight !== null && textHeight !== void 0 ? textHeight : 0) +
|
|
164
|
+
showBackground && (React.createElement("rect", { x: rectX, y: rectY, width: (textWidth !== null && textWidth !== void 0 ? textWidth : 0) + 2 * PADDING, height: (textHeight !== null && textHeight !== void 0 ? textHeight : 0) + PADDING, transform: textProps === null || textProps === void 0 ? void 0 : textProps.transform, className: this.props.className })),
|
|
165
165
|
React.createElement("text", tslib_1.__assign({}, textProps, { id: this._tooltipHostId, ref: this._tooltipHost, onFocusCapture: this._onTooltipFocus, onBlurCapture: this._onTooltipBlur, onMouseEnter: this._onTooltipMouseEnter, onMouseLeave: this._onTooltipMouseLeave, onKeyDown: this._onTooltipKeyDown, "data-is-focusable": shouldReceiveFocus && this.state.isOverflowing }), content),
|
|
166
166
|
showTooltip && React.createElement(Tooltip_1.Tooltip, tslib_1.__assign({}, tooltipRenderProps))));
|
|
167
167
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SVGTooltipText.js","sourceRoot":"../src/","sources":["utilities/SVGTooltipText.tsx"],"names":[],"mappings":";;;;IA4FA,IAAM,OAAO,GAAG,CAAC,CAAC;IAElB;;;OAGG;IACH;QACU,0CAA2D;QAkBnE,wBAAY,KAA2B;YACrC,YAAA,MAAK,YAAC,KAAK,CAAC,SAAC;YAVf,6CAA6C;YACrC,kBAAY,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;YAKjD,oBAAc,GAAG,IAAA,iBAAK,EAAC,cAAc,CAAC,CAAC;YAoFxC,UAAI,GAAG;gBACZ,KAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YAC5B,CAAC,CAAC;YAEK,aAAO,GAAG;gBACf,KAAI,CAAC,YAAY,EAAE,CAAC;YACtB,CAAC,CAAC;YAEM,kBAAY,GAAG;gBACrB,IAAI,KAAI,CAAC,YAAY,CAAC,OAAO,IAAI,OAAO,KAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,KAAK,UAAU,EAAE,CA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,OAAO,EAAE,CAAC;QACxB,CAAC;QA9Fa,2BAAY,GAAG;YAC3B,KAAK,EAAE,sBAAY,CAAC,MAAM;SAC3B,AAFyB,CAExB;QAwPJ,qBAAC;KAAA,AA9PD,CACU,KAAK,CAAC,SAAS,GA6PxB;IA9PY,wCAAc","sourcesContent":["import * as React from 'react';\nimport { ITooltipHost, ITooltipProps, Tooltip, TooltipDelay } from '@fluentui/react/lib/Tooltip';\nimport { Async, KeyCodes, getId, portalContainsElement } from '../Utilities';\nimport { ITheme } from '@fluentui/react';\n\ninterface ISVGTooltipTextProps {\n /**\n * Number of milliseconds to delay closing the tooltip, so that the user has time to hover over\n * the tooltip and interact with it. Hovering over the tooltip will count as hovering over the\n * host, so that the tooltip will stay open if the user is actively interacting with it.\n */\n closeDelay?: number;\n\n /**\n * Content to display in the Tooltip.\n */\n content?: string;\n\n /**\n * Length of delay before showing the tooltip on hover.\n * @defaultvalue TooltipDelay.medium\n */\n delay?: TooltipDelay;\n\n /**\n * Additional properties to pass through for Tooltip.\n */\n tooltipProps?: ITooltipProps;\n\n /**\n * Additional properties to pass through for SVG <text>.\n */\n textProps?: React.SVGAttributes<SVGTextElement>;\n\n /**\n * Max width of text\n */\n maxWidth?: number;\n\n /**\n * Max height of text\n */\n maxHeight?: number;\n\n /**\n * Pass false to make prevent the tooptip from receiving focus through keyboard\n * Eg: In Pie Chart, the focus should only land on the arcs and not on the text to\n * avoid repitition of the same datapoint\n * @defaultvalue true\n */\n shouldReceiveFocus?: boolean;\n\n /**\n * Pass true to show tooltip directly\n * Eg: In Pie Chart, the tooltip is shown when the arc is focussed, so the prop is set to true,\n * to directly show the tooltip from this component\n * @defaultvalue false\n */\n isTooltipVisibleProp?: boolean;\n\n /**\n * Function to wrap text within specified width and height\n * and return a boolean value indicating whether the text overflowed\n */\n wrapContent?: (content: string, id: string, maxWidth: number, maxHeight?: number) => boolean;\n\n /**\n * Theme provided by High Order Component\n */\n theme?: ITheme;\n\n /**\n * @default false\n * Prop to selectively display the tooltip background\n */\n showBackground?: boolean;\n\n /**\n * Prop to set classname\n */\n className?: string;\n}\n\ninterface ISVGTooltipTextState {\n isTooltipVisible: boolean;\n isOverflowing: boolean;\n textX?: number;\n textY?: number;\n textWidth?: number;\n textHeight?: number;\n}\n\nconst PADDING = 4;\n\n/**\n * Component to render an SVG text element with an optional tooltip.\n * The tooltip appears on hovering and focusing the element when its content overflows.\n */\nexport class SVGTooltipText\n extends React.Component<ISVGTooltipTextProps, ISVGTooltipTextState>\n implements ITooltipHost\n{\n public static defaultProps = {\n delay: TooltipDelay.medium,\n };\n\n private static _currentVisibleTooltip: ITooltipHost | undefined;\n\n /** The element that gets the hover events */\n private _tooltipHost = React.createRef<SVGTextElement>();\n\n private _async: Async;\n private _dismissTimerId: number;\n private _openTimerId: number;\n private _tooltipHostId = getId('tooltip-host');\n private _ignoreNextFocusEvent: boolean;\n\n constructor(props: ISVGTooltipTextProps) {\n super(props);\n\n this.state = {\n isTooltipVisible: false,\n isOverflowing: false,\n };\n\n this._async = new Async(this);\n }\n\n public render(): React.ReactNode {\n const { content, tooltipProps, textProps, shouldReceiveFocus = true, showBackground = false } = this.props;\n const { isTooltipVisible, textWidth, textHeight } = this.state;\n const tooltipRenderProps: ITooltipProps = {\n content,\n targetElement: this._getTargetElement(),\n calloutProps: {\n onDismiss: this._hideTooltip,\n onMouseEnter: this._onTooltipMouseEnter,\n onMouseLeave: this._onTooltipMouseLeave,\n },\n onMouseEnter: this._onTooltipMouseEnter,\n onMouseLeave: this._onTooltipMouseLeave,\n ...tooltipProps,\n };\n\n const showTooltip =\n (!!this.props.isTooltipVisibleProp && this.state.isOverflowing && !!content) || (isTooltipVisible && !!content);\n const rectX = (typeof textProps?.x === 'number' ? textProps.x : 0) - (textWidth ?? 0) / 2 - PADDING;\n const rectY = (typeof textProps?.y === 'number' ? textProps.y : 0) - (textHeight ?? 0) / 2 - PADDING;\n return (\n <>\n {showBackground && (\n <rect\n x={rectX}\n y={rectY}\n width={(textWidth ?? 0) + 2 * PADDING}\n height={(textHeight ?? 0) + 2 * PADDING}\n transform={textProps?.transform}\n className={this.props.className}\n />\n )}\n <text\n {...textProps}\n id={this._tooltipHostId}\n ref={this._tooltipHost}\n onFocusCapture={this._onTooltipFocus}\n onBlurCapture={this._onTooltipBlur}\n onMouseEnter={this._onTooltipMouseEnter}\n onMouseLeave={this._onTooltipMouseLeave}\n onKeyDown={this._onTooltipKeyDown}\n data-is-focusable={shouldReceiveFocus && this.state.isOverflowing}\n >\n {content}\n </text>\n {showTooltip && <Tooltip {...tooltipRenderProps} />}\n </>\n );\n }\n\n public componentDidMount(): void {\n this._wrapContent();\n this._measureText();\n }\n\n public componentDidUpdate(prevProps: Readonly<ISVGTooltipTextProps>): void {\n if (this.props.maxWidth !== prevProps.maxWidth || this.props.maxHeight !== prevProps.maxHeight) {\n this._wrapContent();\n this._measureText();\n }\n }\n\n public componentWillUnmount(): void {\n if (SVGTooltipText._currentVisibleTooltip && SVGTooltipText._currentVisibleTooltip === this) {\n SVGTooltipText._currentVisibleTooltip = undefined;\n }\n\n this._async.dispose();\n }\n\n public show = (): void => {\n this._toggleTooltip(true);\n };\n\n public dismiss = (): void => {\n this._hideTooltip();\n };\n\n private _measureText = (): void => {\n if (this._tooltipHost.current && typeof this._tooltipHost.current.getBBox === 'function') {\n const bbox = this._tooltipHost.current.getBBox();\n this.setState({\n textX: bbox.x,\n textY: bbox.y,\n textWidth: bbox.width,\n textHeight: bbox.height,\n });\n }\n };\n\n private _getTargetElement = (): HTMLElement | undefined => {\n if (!this._tooltipHost.current) {\n return undefined;\n }\n\n return this._tooltipHost.current as unknown as HTMLElement;\n };\n\n private _onTooltipFocus = (ev: React.FocusEvent<SVGElement>) => {\n if (this._ignoreNextFocusEvent) {\n this._ignoreNextFocusEvent = false;\n return;\n }\n\n this._onTooltipMouseEnter(ev);\n };\n\n private _onTooltipBlur = (ev: React.FocusEvent<SVGElement>) => {\n // The focused element gets a blur event when the document loses focus\n // (e.g. switching tabs in the browser), but we don't want to show the\n // tooltip again when the document gets focus back. Handle this case by\n // checking if the blurred element is still the document's activeElement,\n // and ignoring when it next gets focus back.\n // See https://github.com/microsoft/fluentui/issues/13541\n this._ignoreNextFocusEvent = document?.activeElement === ev.target;\n\n this._dismissTimerId = this._async.setTimeout(() => {\n this._hideTooltip();\n }, 0);\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _onTooltipMouseEnter = (ev: any): void => {\n const { delay } = this.props;\n\n if (SVGTooltipText._currentVisibleTooltip && SVGTooltipText._currentVisibleTooltip !== this) {\n SVGTooltipText._currentVisibleTooltip.dismiss();\n }\n SVGTooltipText._currentVisibleTooltip = this;\n\n if (!this.state.isOverflowing) {\n return;\n }\n\n if (ev.target && portalContainsElement(ev.target as HTMLElement, this._getTargetElement())) {\n // Do not show tooltip when target is inside a portal relative to TooltipHost.\n return;\n }\n\n this._clearDismissTimer();\n this._clearOpenTimer();\n\n if (delay !== TooltipDelay.zero) {\n const delayTime = this._getDelayTime(delay!); // non-null assertion because we set it in `defaultProps`\n\n this._openTimerId = this._async.setTimeout(() => {\n this._toggleTooltip(true);\n }, delayTime);\n } else {\n this._toggleTooltip(true);\n }\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _onTooltipMouseLeave = (ev: any): void => {\n const { closeDelay } = this.props;\n\n this._clearDismissTimer();\n this._clearOpenTimer();\n\n if (closeDelay) {\n this._dismissTimerId = this._async.setTimeout(() => {\n this._toggleTooltip(false);\n }, closeDelay);\n } else {\n this._toggleTooltip(false);\n }\n\n if (SVGTooltipText._currentVisibleTooltip === this) {\n SVGTooltipText._currentVisibleTooltip = undefined;\n }\n };\n\n private _onTooltipKeyDown = (ev: React.KeyboardEvent<SVGElement>): void => {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n if ((ev.which === KeyCodes.escape || ev.ctrlKey) && this.state.isTooltipVisible) {\n this._hideTooltip();\n ev.stopPropagation();\n }\n };\n\n private _clearDismissTimer = (): void => {\n this._async.clearTimeout(this._dismissTimerId);\n };\n\n private _clearOpenTimer = (): void => {\n this._async.clearTimeout(this._openTimerId);\n };\n\n private _hideTooltip = (): void => {\n this._clearOpenTimer();\n this._clearDismissTimer();\n this._toggleTooltip(false);\n };\n\n private _toggleTooltip = (isTooltipVisible: boolean): void => {\n if (this.state.isTooltipVisible !== isTooltipVisible) {\n this.setState({ isTooltipVisible });\n }\n };\n\n private _getDelayTime = (delay: TooltipDelay): number => {\n switch (delay) {\n case TooltipDelay.medium:\n return 300;\n case TooltipDelay.long:\n return 500;\n default:\n return 0;\n }\n };\n\n private _wrapContent = () => {\n const { content, wrapContent, maxWidth = Number.POSITIVE_INFINITY, maxHeight } = this.props;\n\n let isOverflowing = false;\n if (content && wrapContent && wrapContent(content, this._tooltipHostId, maxWidth, maxHeight)) {\n isOverflowing = true;\n }\n\n if (this.state.isOverflowing !== isOverflowing) {\n this.setState({ isOverflowing });\n }\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SVGTooltipText.js","sourceRoot":"../src/","sources":["utilities/SVGTooltipText.tsx"],"names":[],"mappings":";;;;IA4FA,IAAM,OAAO,GAAG,CAAC,CAAC;IAElB;;;OAGG;IACH;QACU,0CAA2D;QAkBnE,wBAAY,KAA2B;YACrC,YAAA,MAAK,YAAC,KAAK,CAAC,SAAC;YAVf,6CAA6C;YACrC,kBAAY,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;YAKjD,oBAAc,GAAG,IAAA,iBAAK,EAAC,cAAc,CAAC,CAAC;YAoFxC,UAAI,GAAG;gBACZ,KAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YAC5B,CAAC,CAAC;YAEK,aAAO,GAAG;gBACf,KAAI,CAAC,YAAY,EAAE,CAAC;YACtB,CAAC,CAAC;YAEM,kBAAY,GAAG;gBACrB,IAAI,KAAI,CAAC,YAAY,CAAC,OAAO,IAAI,OAAO,KAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,KAAK,U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C,MAAM,CAAC,OAAO,EAAE,CAAC;QACxB,CAAC;QA9Fa,2BAAY,GAAG;YAC3B,KAAK,EAAE,sBAAY,CAAC,MAAM;SAC3B,AAFyB,CAExB;QAwPJ,qBAAC;KAAA,AA9PD,CACU,KAAK,CAAC,SAAS,GA6PxB;IA9PY,wCAAc","sourcesContent":["import * as React from 'react';\nimport { ITooltipHost, ITooltipProps, Tooltip, TooltipDelay } from '@fluentui/react/lib/Tooltip';\nimport { Async, KeyCodes, getId, portalContainsElement } from '../Utilities';\nimport { ITheme } from '@fluentui/react';\n\ninterface ISVGTooltipTextProps {\n /**\n * Number of milliseconds to delay closing the tooltip, so that the user has time to hover over\n * the tooltip and interact with it. Hovering over the tooltip will count as hovering over the\n * host, so that the tooltip will stay open if the user is actively interacting with it.\n */\n closeDelay?: number;\n\n /**\n * Content to display in the Tooltip.\n */\n content?: string;\n\n /**\n * Length of delay before showing the tooltip on hover.\n * @defaultvalue TooltipDelay.medium\n */\n delay?: TooltipDelay;\n\n /**\n * Additional properties to pass through for Tooltip.\n */\n tooltipProps?: ITooltipProps;\n\n /**\n * Additional properties to pass through for SVG <text>.\n */\n textProps?: React.SVGAttributes<SVGTextElement>;\n\n /**\n * Max width of text\n */\n maxWidth?: number;\n\n /**\n * Max height of text\n */\n maxHeight?: number;\n\n /**\n * Pass false to make prevent the tooptip from receiving focus through keyboard\n * Eg: In Pie Chart, the focus should only land on the arcs and not on the text to\n * avoid repitition of the same datapoint\n * @defaultvalue true\n */\n shouldReceiveFocus?: boolean;\n\n /**\n * Pass true to show tooltip directly\n * Eg: In Pie Chart, the tooltip is shown when the arc is focussed, so the prop is set to true,\n * to directly show the tooltip from this component\n * @defaultvalue false\n */\n isTooltipVisibleProp?: boolean;\n\n /**\n * Function to wrap text within specified width and height\n * and return a boolean value indicating whether the text overflowed\n */\n wrapContent?: (content: string, id: string, maxWidth: number, maxHeight?: number) => boolean;\n\n /**\n * Theme provided by High Order Component\n */\n theme?: ITheme;\n\n /**\n * @default false\n * Prop to selectively display the tooltip background\n */\n showBackground?: boolean;\n\n /**\n * Prop to set classname\n */\n className?: string;\n}\n\ninterface ISVGTooltipTextState {\n isTooltipVisible: boolean;\n isOverflowing: boolean;\n textX?: number;\n textY?: number;\n textWidth?: number;\n textHeight?: number;\n}\n\nconst PADDING = 3;\n\n/**\n * Component to render an SVG text element with an optional tooltip.\n * The tooltip appears on hovering and focusing the element when its content overflows.\n */\nexport class SVGTooltipText\n extends React.Component<ISVGTooltipTextProps, ISVGTooltipTextState>\n implements ITooltipHost\n{\n public static defaultProps = {\n delay: TooltipDelay.medium,\n };\n\n private static _currentVisibleTooltip: ITooltipHost | undefined;\n\n /** The element that gets the hover events */\n private _tooltipHost = React.createRef<SVGTextElement>();\n\n private _async: Async;\n private _dismissTimerId: number;\n private _openTimerId: number;\n private _tooltipHostId = getId('tooltip-host');\n private _ignoreNextFocusEvent: boolean;\n\n constructor(props: ISVGTooltipTextProps) {\n super(props);\n\n this.state = {\n isTooltipVisible: false,\n isOverflowing: false,\n };\n\n this._async = new Async(this);\n }\n\n public render(): React.ReactNode {\n const { content, tooltipProps, textProps, shouldReceiveFocus = true, showBackground = false } = this.props;\n const { isTooltipVisible, textWidth, textHeight } = this.state;\n const tooltipRenderProps: ITooltipProps = {\n content,\n targetElement: this._getTargetElement(),\n calloutProps: {\n onDismiss: this._hideTooltip,\n onMouseEnter: this._onTooltipMouseEnter,\n onMouseLeave: this._onTooltipMouseLeave,\n },\n onMouseEnter: this._onTooltipMouseEnter,\n onMouseLeave: this._onTooltipMouseLeave,\n ...tooltipProps,\n };\n\n const showTooltip =\n (!!this.props.isTooltipVisibleProp && this.state.isOverflowing && !!content) || (isTooltipVisible && !!content);\n const rectX = (typeof textProps?.x === 'number' ? textProps.x : 0) - (textWidth ?? 0) / 2 - PADDING;\n const rectY = (typeof textProps?.y === 'number' ? textProps.y : 0) - (textHeight ?? 0) / 2 - 2 * PADDING;\n return (\n <>\n {showBackground && (\n <rect\n x={rectX}\n y={rectY}\n width={(textWidth ?? 0) + 2 * PADDING}\n height={(textHeight ?? 0) + PADDING}\n transform={textProps?.transform}\n className={this.props.className}\n />\n )}\n <text\n {...textProps}\n id={this._tooltipHostId}\n ref={this._tooltipHost}\n onFocusCapture={this._onTooltipFocus}\n onBlurCapture={this._onTooltipBlur}\n onMouseEnter={this._onTooltipMouseEnter}\n onMouseLeave={this._onTooltipMouseLeave}\n onKeyDown={this._onTooltipKeyDown}\n data-is-focusable={shouldReceiveFocus && this.state.isOverflowing}\n >\n {content}\n </text>\n {showTooltip && <Tooltip {...tooltipRenderProps} />}\n </>\n );\n }\n\n public componentDidMount(): void {\n this._wrapContent();\n this._measureText();\n }\n\n public componentDidUpdate(prevProps: Readonly<ISVGTooltipTextProps>): void {\n if (this.props.maxWidth !== prevProps.maxWidth || this.props.maxHeight !== prevProps.maxHeight) {\n this._wrapContent();\n this._measureText();\n }\n }\n\n public componentWillUnmount(): void {\n if (SVGTooltipText._currentVisibleTooltip && SVGTooltipText._currentVisibleTooltip === this) {\n SVGTooltipText._currentVisibleTooltip = undefined;\n }\n\n this._async.dispose();\n }\n\n public show = (): void => {\n this._toggleTooltip(true);\n };\n\n public dismiss = (): void => {\n this._hideTooltip();\n };\n\n private _measureText = (): void => {\n if (this._tooltipHost.current && typeof this._tooltipHost.current.getBBox === 'function') {\n const bbox = this._tooltipHost.current.getBBox();\n this.setState({\n textX: bbox.x,\n textY: bbox.y,\n textWidth: bbox.width,\n textHeight: bbox.height,\n });\n }\n };\n\n private _getTargetElement = (): HTMLElement | undefined => {\n if (!this._tooltipHost.current) {\n return undefined;\n }\n\n return this._tooltipHost.current as unknown as HTMLElement;\n };\n\n private _onTooltipFocus = (ev: React.FocusEvent<SVGElement>) => {\n if (this._ignoreNextFocusEvent) {\n this._ignoreNextFocusEvent = false;\n return;\n }\n\n this._onTooltipMouseEnter(ev);\n };\n\n private _onTooltipBlur = (ev: React.FocusEvent<SVGElement>) => {\n // The focused element gets a blur event when the document loses focus\n // (e.g. switching tabs in the browser), but we don't want to show the\n // tooltip again when the document gets focus back. Handle this case by\n // checking if the blurred element is still the document's activeElement,\n // and ignoring when it next gets focus back.\n // See https://github.com/microsoft/fluentui/issues/13541\n this._ignoreNextFocusEvent = document?.activeElement === ev.target;\n\n this._dismissTimerId = this._async.setTimeout(() => {\n this._hideTooltip();\n }, 0);\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _onTooltipMouseEnter = (ev: any): void => {\n const { delay } = this.props;\n\n if (SVGTooltipText._currentVisibleTooltip && SVGTooltipText._currentVisibleTooltip !== this) {\n SVGTooltipText._currentVisibleTooltip.dismiss();\n }\n SVGTooltipText._currentVisibleTooltip = this;\n\n if (!this.state.isOverflowing) {\n return;\n }\n\n if (ev.target && portalContainsElement(ev.target as HTMLElement, this._getTargetElement())) {\n // Do not show tooltip when target is inside a portal relative to TooltipHost.\n return;\n }\n\n this._clearDismissTimer();\n this._clearOpenTimer();\n\n if (delay !== TooltipDelay.zero) {\n const delayTime = this._getDelayTime(delay!); // non-null assertion because we set it in `defaultProps`\n\n this._openTimerId = this._async.setTimeout(() => {\n this._toggleTooltip(true);\n }, delayTime);\n } else {\n this._toggleTooltip(true);\n }\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _onTooltipMouseLeave = (ev: any): void => {\n const { closeDelay } = this.props;\n\n this._clearDismissTimer();\n this._clearOpenTimer();\n\n if (closeDelay) {\n this._dismissTimerId = this._async.setTimeout(() => {\n this._toggleTooltip(false);\n }, closeDelay);\n } else {\n this._toggleTooltip(false);\n }\n\n if (SVGTooltipText._currentVisibleTooltip === this) {\n SVGTooltipText._currentVisibleTooltip = undefined;\n }\n };\n\n private _onTooltipKeyDown = (ev: React.KeyboardEvent<SVGElement>): void => {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n if ((ev.which === KeyCodes.escape || ev.ctrlKey) && this.state.isTooltipVisible) {\n this._hideTooltip();\n ev.stopPropagation();\n }\n };\n\n private _clearDismissTimer = (): void => {\n this._async.clearTimeout(this._dismissTimerId);\n };\n\n private _clearOpenTimer = (): void => {\n this._async.clearTimeout(this._openTimerId);\n };\n\n private _hideTooltip = (): void => {\n this._clearOpenTimer();\n this._clearDismissTimer();\n this._toggleTooltip(false);\n };\n\n private _toggleTooltip = (isTooltipVisible: boolean): void => {\n if (this.state.isTooltipVisible !== isTooltipVisible) {\n this.setState({ isTooltipVisible });\n }\n };\n\n private _getDelayTime = (delay: TooltipDelay): number => {\n switch (delay) {\n case TooltipDelay.medium:\n return 300;\n case TooltipDelay.long:\n return 500;\n default:\n return 0;\n }\n };\n\n private _wrapContent = () => {\n const { content, wrapContent, maxWidth = Number.POSITIVE_INFINITY, maxHeight } = this.props;\n\n let isOverflowing = false;\n if (content && wrapContent && wrapContent(content, this._tooltipHostId, maxWidth, maxHeight)) {\n isOverflowing = true;\n }\n\n if (this.state.isOverflowing !== isOverflowing) {\n this.setState({ isOverflowing });\n }\n };\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Axis as D3Axis } from 'd3-axis';
|
|
2
2
|
import { TimeLocaleDefinition as d3TimeLocaleDefinition } from 'd3-time-format';
|
|
3
|
-
import { IAccessibilityProps, IEventsAnnotationProps, ILineChartPoints, IDataPoint, IVerticalStackedBarDataPoint, IVerticalBarChartDataPoint, IHorizontalBarChartWithAxisDataPoint, ILineChartLineOptions } from '../index';
|
|
3
|
+
import { IAccessibilityProps, IEventsAnnotationProps, ILineChartPoints, IDataPoint, IVerticalStackedBarDataPoint, IVerticalBarChartDataPoint, IHorizontalBarChartWithAxisDataPoint, ILineChartLineOptions, AxisCategoryOrder } from '../index';
|
|
4
4
|
import { CurveFactory } from 'd3-shape';
|
|
5
5
|
import { IScatterChartPoints } from '../types/IDataPoint';
|
|
6
6
|
export declare const MIN_DOMAIN_MARGIN = 8;
|
|
@@ -340,7 +340,7 @@ export declare function domainRageOfVerticalNumeric(points: IDataPoint[], margin
|
|
|
340
340
|
* @param {ILineChartPoints[]} points
|
|
341
341
|
* @returns {{ startValue: number; endValue: number }}
|
|
342
342
|
*/
|
|
343
|
-
export declare function findNumericMinMaxOfY(points: ILineChartPoints[], yAxisType?: YAxisType, useSecondaryYScale?: boolean): {
|
|
343
|
+
export declare function findNumericMinMaxOfY(points: ILineChartPoints[] | IScatterChartPoints[], yAxisType?: YAxisType, useSecondaryYScale?: boolean): {
|
|
344
344
|
startValue: number;
|
|
345
345
|
endValue: number;
|
|
346
346
|
};
|
|
@@ -462,5 +462,8 @@ export declare function domainRangeOfDateForScatterChart(points: IScatterChartPo
|
|
|
462
462
|
* @returns {IDomainNRange}
|
|
463
463
|
*/
|
|
464
464
|
export declare function domainRangeOfNumericForScatterChart(points: IScatterChartPoints[], margins: IMargins, width: number, isRTL: boolean): IDomainNRange;
|
|
465
|
-
export declare function createYAxisForScatterChart(yAxisParams: IYAxisParams, isRtl: boolean, axisData: IAxisData, isIntegralDataset: boolean, useSecondaryYScale?: boolean, _supportNegativeData?: boolean, roundedTicks?: boolean): import("d3-scale").ScaleLinear<number, number, never>;
|
|
466
465
|
export declare const truncateString: (str: string, maxLength: number, ellipsis?: string) => string;
|
|
466
|
+
/**
|
|
467
|
+
* @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/plots.js#L3041}
|
|
468
|
+
*/
|
|
469
|
+
export declare const sortAxisCategories: (categoryToValues: Record<string, number[]>, categoryOrder: AxisCategoryOrder | undefined) => string[];
|
|
@@ -2,7 +2,7 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
2
2
|
"use strict";
|
|
3
3
|
var _a;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.
|
|
5
|
+
exports.sortAxisCategories = exports.truncateString = exports.domainRangeOfNumericForScatterChart = exports.domainRangeOfDateForScatterChart = exports.getCurveFactory = exports.createMeasurementSpan = exports.copyStyle = exports.resolveCSSVariables = exports.areArraysEqual = exports.getSecureProps = exports.isScalePaddingDefined = exports.getScalePadding = exports.getBarWidth = exports.formatScientificLimitWidth = exports.wrapTextInsideDonut = exports.rotateXAxisLabels = exports.getAccessibleDataObject = exports.pointTypes = exports.CustomPoints = exports.Points = exports.getTypeOfAxis = exports.findHBCWANumericMinMaxOfY = exports.findVerticalNumericMinMaxOfY = exports.findVSBCNumericMinMaxOfY = exports.findNumericMinMaxOfY = exports.domainRageOfVerticalNumeric = exports.domainRangeOfDateForAreaLineVerticalBarChart = exports.domainRangeOfVSBCNumeric = exports.domainRangeOfXStringAxis = exports.domainRangeOfNumericForHorizontalBarChartWithAxis = exports.computeLongestBars = exports.groupChartDataByYValue = exports.domainRangeOfNumericForAreaChart = exports.getXAxisType = exports.tooltipOfAxislabels = exports.calculateLongestLabelWidth = exports.wrapContent = exports.createYAxisLabels = exports.createWrapOfXLabels = exports.silceOrAppendToArray = exports.getUnique = exports.calloutData = exports.createStringYAxis = exports.createStringYAxisForHorizontalBarChartWithAxis = exports.createNumericYAxis = exports.createYAxisForHorizontalBarChartWithAxis = exports.prepareDatapoints = exports.createStringXAxis = exports.createDateXAxis = exports.createNumericXAxis = exports.defaultYAxisTickFormatter = exports.YAxisType = exports.XAxisTypes = exports.ChartTypes = exports.MIN_DONUT_RADIUS = exports.MIN_DOMAIN_MARGIN = void 0;
|
|
6
6
|
exports.MIN_DOMAIN_MARGIN = 8;
|
|
7
7
|
exports.MIN_DONUT_RADIUS = 1;
|
|
8
8
|
var ChartTypes;
|
|
@@ -1450,35 +1450,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
1450
1450
|
: { dStartValue: xMin, dEndValue: xMax, rStartValue: rStartValue, rEndValue: rEndValue };
|
|
1451
1451
|
}
|
|
1452
1452
|
exports.domainRangeOfNumericForScatterChart = domainRangeOfNumericForScatterChart;
|
|
1453
|
-
function createYAxisForScatterChart(yAxisParams, isRtl, axisData, isIntegralDataset, useSecondaryYScale, _supportNegativeData, roundedTicks) {
|
|
1454
|
-
if (useSecondaryYScale === void 0) { useSecondaryYScale = false; }
|
|
1455
|
-
if (_supportNegativeData === void 0) { _supportNegativeData = false; }
|
|
1456
|
-
if (roundedTicks === void 0) { roundedTicks = false; }
|
|
1457
|
-
var _a = yAxisParams.yMinMaxValues, yMinMaxValues = _a === void 0 ? { startValue: 0, endValue: 0 } : _a, _b = yAxisParams.yAxisElement, yAxisElement = _b === void 0 ? null : _b, _c = yAxisParams.yMaxValue, yMaxValue = _c === void 0 ? 0 : _c, _d = yAxisParams.yMinValue, yMinValue = _d === void 0 ? 0 : _d, containerHeight = yAxisParams.containerHeight, containerWidth = yAxisParams.containerWidth, margins = yAxisParams.margins, _e = yAxisParams.tickPadding, tickPadding = _e === void 0 ? 12 : _e, _f = yAxisParams.maxOfYVal, maxOfYVal = _f === void 0 ? 0 : _f, yAxisTickFormat = yAxisParams.yAxisTickFormat, _g = yAxisParams.yAxisTickCount, yAxisTickCount = _g === void 0 ? 4 : _g, eventAnnotationProps = yAxisParams.eventAnnotationProps, eventLabelHeight = yAxisParams.eventLabelHeight;
|
|
1458
|
-
// maxOfYVal coming from only area chart and Grouped vertical bar chart(Calculation done at base file)
|
|
1459
|
-
var tempVal = maxOfYVal || yMinMaxValues.endValue;
|
|
1460
|
-
var finalYmax = tempVal > yMaxValue ? tempVal : yMaxValue;
|
|
1461
|
-
var finalYmin = Math.min(yMinMaxValues.startValue, yMinValue || 0);
|
|
1462
|
-
var domainValues = prepareDatapoints(finalYmax, finalYmin, yAxisTickCount, isIntegralDataset, roundedTicks);
|
|
1463
|
-
var yMin = finalYmin;
|
|
1464
|
-
var yMax = domainValues[domainValues.length - 1];
|
|
1465
|
-
var yPadding = (yMax - yMin) * 0.1;
|
|
1466
|
-
yMin = yMin - yPadding;
|
|
1467
|
-
yMax = yMax + yPadding;
|
|
1468
|
-
var yAxisScale = (0, d3_scale_1.scaleLinear)()
|
|
1469
|
-
.domain([domainValues[0], yMax])
|
|
1470
|
-
.range([containerHeight - margins.bottom, margins.top + (eventAnnotationProps ? eventLabelHeight : 0)]);
|
|
1471
|
-
var axis = (!isRtl && useSecondaryYScale) || (isRtl && !useSecondaryYScale) ? (0, d3_axis_1.axisRight)(yAxisScale) : (0, d3_axis_1.axisLeft)(yAxisScale);
|
|
1472
|
-
var yAxis = axis
|
|
1473
|
-
.tickPadding(tickPadding)
|
|
1474
|
-
.tickValues(domainValues)
|
|
1475
|
-
.tickSizeInner(-(containerWidth - margins.left - margins.right));
|
|
1476
|
-
yAxisTickFormat ? yAxis.tickFormat(yAxisTickFormat) : yAxis.tickFormat((0, d3_format_1.format)('.2~s'));
|
|
1477
|
-
yAxisElement ? (0, d3_selection_1.select)(yAxisElement).call(yAxis).selectAll('text').attr('aria-hidden', 'true') : '';
|
|
1478
|
-
axisData.yAxisDomainValues = domainValues;
|
|
1479
|
-
return yAxisScale;
|
|
1480
|
-
}
|
|
1481
|
-
exports.createYAxisForScatterChart = createYAxisForScatterChart;
|
|
1482
1453
|
var truncateString = function (str, maxLength, ellipsis) {
|
|
1483
1454
|
if (ellipsis === void 0) { ellipsis = '...'; }
|
|
1484
1455
|
if (str.length <= maxLength) {
|
|
@@ -1487,5 +1458,63 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
1487
1458
|
return str.slice(0, maxLength) + ellipsis;
|
|
1488
1459
|
};
|
|
1489
1460
|
exports.truncateString = truncateString;
|
|
1461
|
+
var categoryOrderRegex = /(category|total|sum|min|max|mean|median) (ascending|descending)/;
|
|
1462
|
+
/**
|
|
1463
|
+
* @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/plots.js#L3041}
|
|
1464
|
+
*/
|
|
1465
|
+
var sortAxisCategories = function (categoryToValues, categoryOrder) {
|
|
1466
|
+
if (Array.isArray(categoryOrder)) {
|
|
1467
|
+
var result_1 = [];
|
|
1468
|
+
var seen_1 = new Set();
|
|
1469
|
+
// Add elements from categoryOrder array that are in categoryToValues, in the array's order
|
|
1470
|
+
categoryOrder.forEach(function (category) {
|
|
1471
|
+
if (categoryToValues[category] && !seen_1.has(category)) {
|
|
1472
|
+
result_1.push(category);
|
|
1473
|
+
seen_1.add(category);
|
|
1474
|
+
}
|
|
1475
|
+
});
|
|
1476
|
+
// Append any keys from categoryToValues not already in result
|
|
1477
|
+
Object.keys(categoryToValues).forEach(function (category) {
|
|
1478
|
+
if (!seen_1.has(category)) {
|
|
1479
|
+
result_1.push(category);
|
|
1480
|
+
}
|
|
1481
|
+
});
|
|
1482
|
+
return result_1;
|
|
1483
|
+
}
|
|
1484
|
+
var match = categoryOrder === null || categoryOrder === void 0 ? void 0 : categoryOrder.match(categoryOrderRegex);
|
|
1485
|
+
if (match) {
|
|
1486
|
+
var aggregator_1 = match[1];
|
|
1487
|
+
var order = match[2];
|
|
1488
|
+
if (aggregator_1 === 'category') {
|
|
1489
|
+
var result = Object.keys(categoryToValues).sort();
|
|
1490
|
+
return order === 'descending' ? result.reverse() : result;
|
|
1491
|
+
}
|
|
1492
|
+
var aggFn_1 = {
|
|
1493
|
+
min: d3_array_1.min,
|
|
1494
|
+
max: d3_array_1.max,
|
|
1495
|
+
sum: d3_array_1.sum,
|
|
1496
|
+
total: d3_array_1.sum,
|
|
1497
|
+
mean: d3_array_1.mean,
|
|
1498
|
+
median: d3_array_1.median,
|
|
1499
|
+
};
|
|
1500
|
+
var sortAscending = function (a, b) {
|
|
1501
|
+
return a[1] - b[1];
|
|
1502
|
+
};
|
|
1503
|
+
var sortDescending = function (a, b) {
|
|
1504
|
+
return b[1] - a[1];
|
|
1505
|
+
};
|
|
1506
|
+
var categoriesAggregatedValue_1 = [];
|
|
1507
|
+
Object.keys(categoryToValues).forEach(function (category) {
|
|
1508
|
+
categoriesAggregatedValue_1.push([category, aggFn_1[aggregator_1](categoryToValues[category]) || 0]);
|
|
1509
|
+
});
|
|
1510
|
+
categoriesAggregatedValue_1.sort(order === 'descending' ? sortDescending : sortAscending);
|
|
1511
|
+
return categoriesAggregatedValue_1.map(function (_a) {
|
|
1512
|
+
var category = _a[0];
|
|
1513
|
+
return category;
|
|
1514
|
+
});
|
|
1515
|
+
}
|
|
1516
|
+
return Object.keys(categoryToValues);
|
|
1517
|
+
};
|
|
1518
|
+
exports.sortAxisCategories = sortAxisCategories;
|
|
1490
1519
|
});
|
|
1491
1520
|
//# sourceMappingURL=utilities.js.map
|