@fluentui/react-charting 5.19.14 → 5.19.16
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 +37 -1
- package/CHANGELOG.md +21 -2
- package/README.md +1 -1
- package/dist/react-charting.d.ts +15 -2
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +7 -2
- package/lib/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js +105 -28
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +1 -3
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +61 -38
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib/types/IDataPoint.d.ts +14 -2
- package/lib/types/IDataPoint.js.map +1 -1
- package/lib/utilities/utilities.d.ts +14 -14
- package/lib/utilities/utilities.js +56 -38
- package/lib/utilities/utilities.js.map +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -1
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +104 -27
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +1 -3
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +60 -37
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-amd/types/IDataPoint.d.ts +14 -2
- package/lib-amd/types/IDataPoint.js.map +1 -1
- package/lib-amd/utilities/utilities.d.ts +14 -14
- package/lib-amd/utilities/utilities.js +58 -40
- package/lib-amd/utilities/utilities.js.map +1 -1
- package/lib-amd/version.js +1 -1
- package/lib-amd/version.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +104 -27
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +1 -3
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +60 -37
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-commonjs/types/IDataPoint.d.ts +14 -2
- package/lib-commonjs/types/IDataPoint.js.map +1 -1
- package/lib-commonjs/utilities/utilities.d.ts +14 -14
- package/lib-commonjs/utilities/utilities.js +58 -40
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/lib-commonjs/version.js +1 -1
- package/lib-commonjs/version.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IDataPoint.js","sourceRoot":"../src/","sources":["types/IDataPoint.ts"],"names":[],"mappings":"","sourcesContent":["import { SVGProps } from 'react';\nimport { LegendShape } from '../components/Legends/Legends.types';\nimport { SankeyLink, SankeyNode } from 'd3-sankey';\n\nexport interface IBasestate {\n _width?: number;\n _height?: number;\n activeLegend?: string;\n color?: string;\n dataForHoverCard?: number;\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; 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 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 * 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;\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 * 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 * 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 ILineChartDataPoint {\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 * 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/**\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 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/**\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/**\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 line chart\n */\n SankeyChartData?: ISankeyChartData;\n\n /**\n * data for the points in the line chart\n */\n pointOptions?: SVGProps<SVGCircleElement>;\n\n /**\n * data for the dotted line on hovering the point\n */\n pointLineOptions?: SVGProps<SVGLineElement>;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface ISankeyChartData {\n nodes: SNode[];\n links: SLink[];\n}\n\ninterface ISNodeExtra {\n nodeId: number | string;\n name: string;\n color?: string;\n borderColor?: string;\n actualValue?: number;\n layer?: number;\n}\n\ninterface ISLinkExtra {\n source: number;\n target: number;\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;\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 * 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;\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;\n color: string;\n legend: string;\n /**\n * Data to show in callout\n */\n data?: number;\n yAxisCalloutData?: string;\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 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 * 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/**\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"]}
|
|
1
|
+
{"version":3,"file":"IDataPoint.js","sourceRoot":"../src/","sources":["types/IDataPoint.ts"],"names":[],"mappings":"","sourcesContent":["import { SVGProps } from 'react';\nimport { LegendShape } from '../components/Legends/Legends.types';\nimport { SankeyLink, SankeyNode } from 'd3-sankey';\n\nexport interface IBasestate {\n _width?: number;\n _height?: number;\n activeLegend?: string;\n color?: string;\n dataForHoverCard?: number;\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; 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 * 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 * 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 * 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 ILineChartDataPoint {\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 * 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/**\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 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/**\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/**\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 line chart\n */\n SankeyChartData?: ISankeyChartData;\n\n /**\n * data for the points in the line chart\n */\n pointOptions?: SVGProps<SVGCircleElement>;\n\n /**\n * data for the dotted line on hovering the point\n */\n pointLineOptions?: SVGProps<SVGLineElement>;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface ISankeyChartData {\n nodes: SNode[];\n links: SLink[];\n}\n\ninterface ISNodeExtra {\n nodeId: number | string;\n name: string;\n color?: string;\n borderColor?: string;\n actualValue?: number;\n layer?: number;\n}\n\ninterface ISLinkExtra {\n source: number;\n target: number;\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;\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 * 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;\n color: string;\n legend: string;\n /**\n * Data to show in callout\n */\n data?: number;\n yAxisCalloutData?: string;\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 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 * 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/**\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"]}
|
|
@@ -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, IVerticalBarChartDataPoint, IHorizontalBarChartWithAxisDataPoint } from '../index';
|
|
3
|
+
import { IAccessibilityProps, IEventsAnnotationProps, ILineChartPoints, IDataPoint, IVerticalStackedBarDataPoint, IVerticalBarChartDataPoint, IHorizontalBarChartWithAxisDataPoint } from '../index';
|
|
4
4
|
export declare type NumericAxis = D3Axis<number | {
|
|
5
5
|
valueOf(): number;
|
|
6
6
|
}>;
|
|
@@ -244,18 +244,6 @@ export declare function tooltipOfXAxislabels(xAxistooltipProps: any): null | und
|
|
|
244
244
|
* @param points
|
|
245
245
|
*/
|
|
246
246
|
export declare function getXAxisType(points: ILineChartPoints[]): boolean;
|
|
247
|
-
/**
|
|
248
|
-
* Calculates Domain and range values for Date X axis.
|
|
249
|
-
* This method calculates Area chart and line chart.
|
|
250
|
-
* @export
|
|
251
|
-
* @param {ILineChartPoints[]} points
|
|
252
|
-
* @param {IMargins} margins
|
|
253
|
-
* @param {number} width
|
|
254
|
-
* @param {boolean} isRTL
|
|
255
|
-
* @param {Date[] | number[]} tickValues
|
|
256
|
-
* @returns {IDomainNRange}
|
|
257
|
-
*/
|
|
258
|
-
export declare function domainRangeOfDateForAreaChart(points: ILineChartPoints[], margins: IMargins, width: number, isRTL: boolean, tickValues?: Date[]): IDomainNRange;
|
|
259
247
|
/**
|
|
260
248
|
* Calculates Domain and range values for Numeric X axis.
|
|
261
249
|
* This method calculates Area cart and line chart.
|
|
@@ -301,6 +289,18 @@ export declare function domainRangeOfXStringAxis(margins: IMargins, width: numbe
|
|
|
301
289
|
* @returns {IDomainNRange}
|
|
302
290
|
*/
|
|
303
291
|
export declare function domainRangeOfVSBCNumeric(points: IDataPoint[], margins: IMargins, width: number, isRTL: boolean, barWidth: number): IDomainNRange;
|
|
292
|
+
/**
|
|
293
|
+
* Calculates Domain and range values for Date X axis.
|
|
294
|
+
* This method calculates Bar chart.
|
|
295
|
+
* @export
|
|
296
|
+
* @param {IVerticalBarChartDataPoint[]} points
|
|
297
|
+
* @param {IMargins} margins
|
|
298
|
+
* @param {number} width
|
|
299
|
+
* @param {boolean} isRTL
|
|
300
|
+
* @param {Date[] | number[]} tickValues
|
|
301
|
+
* @returns {IDomainNRange}
|
|
302
|
+
*/
|
|
303
|
+
export declare function domainRangeOfDateForAreaLineVerticalBarChart(points: ILineChartPoints[] | IVerticalBarChartDataPoint[] | IVerticalStackedBarDataPoint[], margins: IMargins, width: number, isRTL: boolean, tickValues: Date[] | undefined, chartType: ChartTypes, barWidth?: number): IDomainNRange;
|
|
304
304
|
/**
|
|
305
305
|
* Calculate domain and range values to the Vertical bar chart - For Numeric axis
|
|
306
306
|
* @export
|
|
@@ -386,7 +386,7 @@ export declare function getMinMaxOfYAxis(points: any, chartType: ChartTypes, yAx
|
|
|
386
386
|
* This function takes the single data point of the x-aixs
|
|
387
387
|
* and decides what is the x-axis
|
|
388
388
|
*/
|
|
389
|
-
export declare const getTypeOfAxis: (p: string | number | Date,
|
|
389
|
+
export declare const getTypeOfAxis: (p: string | number | Date, isXAxis: boolean) => XAxisTypes | YAxisType;
|
|
390
390
|
/**
|
|
391
391
|
* we need to make sure that if we add any property to this, then
|
|
392
392
|
* we need to also add that in pointTypes below and vise-versa
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.formatValueWithSIPrefix = exports.wrapTextInsideDonut = exports.rotateXAxisLabels = exports.convertToLocaleString = exports.getAccessibleDataObject = exports.pointTypes = exports.CustomPoints = exports.Points = exports.getTypeOfAxis = exports.getMinMaxOfYAxis = exports.findHBCWANumericMinMaxOfY = exports.findVerticalNumericMinMaxOfY = exports.findVSBCNumericMinMaxOfY = exports.findNumericMinMaxOfY = exports.getDomainNRangeValues = exports.domainRageOfVerticalNumeric = exports.
|
|
4
|
+
exports.formatValueWithSIPrefix = exports.wrapTextInsideDonut = exports.rotateXAxisLabels = exports.convertToLocaleString = exports.getAccessibleDataObject = exports.pointTypes = exports.CustomPoints = exports.Points = exports.getTypeOfAxis = exports.getMinMaxOfYAxis = exports.findHBCWANumericMinMaxOfY = exports.findVerticalNumericMinMaxOfY = exports.findVSBCNumericMinMaxOfY = exports.findNumericMinMaxOfY = exports.getDomainNRangeValues = exports.domainRageOfVerticalNumeric = exports.domainRangeOfDateForAreaLineVerticalBarChart = exports.domainRangeOfVSBCNumeric = exports.domainRangeOfXStringAxis = exports.domainRangeOfNumericForHorizontalBarChartWithAxis = exports.domainRangeOfNumericForAreaChart = exports.getXAxisType = exports.tooltipOfXAxislabels = exports.calculateLongestLabelWidth = exports.wrapContent = exports.createYAxisLabels = exports.createWrapOfXLabels = exports.silceOrAppendToArray = exports.getUnique = exports.calloutData = exports.createStringYAxisForOtherCharts = exports.createStringYAxisForHorizontalBarChartWithAxis = exports.createStringYAxis = exports.createYAxisForOtherCharts = exports.createYAxisForHorizontalBarChartWithAxis = exports.createYAxis = exports.prepareDatapoints = exports.createStringXAxis = exports.createDateXAxis = exports.createNumericXAxis = exports.YAxisType = exports.XAxisTypes = exports.ChartTypes = void 0;
|
|
5
5
|
var tslib_1 = require("tslib");
|
|
6
6
|
var d3_axis_1 = require("d3-axis");
|
|
7
7
|
var d3_array_1 = require("d3-array");
|
|
@@ -629,41 +629,6 @@ function getXAxisType(points) {
|
|
|
629
629
|
return isXAxisDateType;
|
|
630
630
|
}
|
|
631
631
|
exports.getXAxisType = getXAxisType;
|
|
632
|
-
/**
|
|
633
|
-
* Calculates Domain and range values for Date X axis.
|
|
634
|
-
* This method calculates Area chart and line chart.
|
|
635
|
-
* @export
|
|
636
|
-
* @param {ILineChartPoints[]} points
|
|
637
|
-
* @param {IMargins} margins
|
|
638
|
-
* @param {number} width
|
|
639
|
-
* @param {boolean} isRTL
|
|
640
|
-
* @param {Date[] | number[]} tickValues
|
|
641
|
-
* @returns {IDomainNRange}
|
|
642
|
-
*/
|
|
643
|
-
function domainRangeOfDateForAreaChart(points, margins, width, isRTL, tickValues) {
|
|
644
|
-
if (tickValues === void 0) { tickValues = []; }
|
|
645
|
-
var sDate = (0, d3_array_1.min)(points, function (point) {
|
|
646
|
-
return (0, d3_array_1.min)(point.data, function (item) {
|
|
647
|
-
return item.x;
|
|
648
|
-
});
|
|
649
|
-
});
|
|
650
|
-
var lDate = (0, d3_array_1.max)(points, function (point) {
|
|
651
|
-
return (0, d3_array_1.max)(point.data, function (item) {
|
|
652
|
-
return item.x;
|
|
653
|
-
});
|
|
654
|
-
});
|
|
655
|
-
// Need to draw graph with given small and large date (Which Involves customization of date axis tick values)
|
|
656
|
-
// That may be Either from given graph data or from prop 'tickValues' date values.
|
|
657
|
-
// So, Finding smallest and largest dates
|
|
658
|
-
var smallestDate = (0, d3_array_1.min)(tslib_1.__spreadArray(tslib_1.__spreadArray([], tickValues, true), [sDate], false));
|
|
659
|
-
var largestDate = (0, d3_array_1.max)(tslib_1.__spreadArray(tslib_1.__spreadArray([], tickValues, true), [lDate], false));
|
|
660
|
-
var rStartValue = margins.left;
|
|
661
|
-
var rEndValue = width - margins.right;
|
|
662
|
-
return isRTL
|
|
663
|
-
? { dStartValue: largestDate, dEndValue: smallestDate, rStartValue: rStartValue, rEndValue: rEndValue }
|
|
664
|
-
: { dStartValue: smallestDate, dEndValue: largestDate, rStartValue: rStartValue, rEndValue: rEndValue };
|
|
665
|
-
}
|
|
666
|
-
exports.domainRangeOfDateForAreaChart = domainRangeOfDateForAreaChart;
|
|
667
632
|
/**
|
|
668
633
|
* Calculates Domain and range values for Numeric X axis.
|
|
669
634
|
* This method calculates Area cart and line chart.
|
|
@@ -749,6 +714,54 @@ function domainRangeOfVSBCNumeric(points, margins, width, isRTL, barWidth) {
|
|
|
749
714
|
: { dStartValue: xMin, dEndValue: xMax, rStartValue: rMax, rEndValue: rMin };
|
|
750
715
|
}
|
|
751
716
|
exports.domainRangeOfVSBCNumeric = domainRangeOfVSBCNumeric;
|
|
717
|
+
/**
|
|
718
|
+
* Calculates Domain and range values for Date X axis.
|
|
719
|
+
* This method calculates Bar chart.
|
|
720
|
+
* @export
|
|
721
|
+
* @param {IVerticalBarChartDataPoint[]} points
|
|
722
|
+
* @param {IMargins} margins
|
|
723
|
+
* @param {number} width
|
|
724
|
+
* @param {boolean} isRTL
|
|
725
|
+
* @param {Date[] | number[]} tickValues
|
|
726
|
+
* @returns {IDomainNRange}
|
|
727
|
+
*/
|
|
728
|
+
function domainRangeOfDateForAreaLineVerticalBarChart(points, margins, width, isRTL, tickValues, chartType, barWidth) {
|
|
729
|
+
if (tickValues === void 0) { tickValues = []; }
|
|
730
|
+
var sDate;
|
|
731
|
+
var lDate;
|
|
732
|
+
if (chartType === ChartTypes.AreaChart || chartType === ChartTypes.LineChart) {
|
|
733
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
734
|
+
sDate = (0, d3_array_1.min)(points, function (point) {
|
|
735
|
+
return (0, d3_array_1.min)(point.data, function (item) {
|
|
736
|
+
return item.x;
|
|
737
|
+
});
|
|
738
|
+
});
|
|
739
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
740
|
+
lDate = (0, d3_array_1.max)(points, function (point) {
|
|
741
|
+
return (0, d3_array_1.max)(point.data, function (item) {
|
|
742
|
+
return item.x;
|
|
743
|
+
});
|
|
744
|
+
});
|
|
745
|
+
// Need to draw graph with given small and large date
|
|
746
|
+
// (Which Involves customization of date axis tick values)
|
|
747
|
+
// That may be Either from given graph data or from prop 'tickValues' date values.
|
|
748
|
+
// So, Finding smallest and largest dates
|
|
749
|
+
sDate = (0, d3_array_1.min)(tslib_1.__spreadArray(tslib_1.__spreadArray([], tickValues, true), [sDate], false));
|
|
750
|
+
lDate = (0, d3_array_1.max)(tslib_1.__spreadArray(tslib_1.__spreadArray([], tickValues, true), [lDate], false));
|
|
751
|
+
}
|
|
752
|
+
else {
|
|
753
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
754
|
+
sDate = (0, d3_array_1.min)(points, function (point) { return point.x; });
|
|
755
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
756
|
+
lDate = (0, d3_array_1.max)(points, function (point) { return point.x; });
|
|
757
|
+
}
|
|
758
|
+
var rStartValue = margins.left + (barWidth ? barWidth / 2 : 0);
|
|
759
|
+
var rEndValue = width - margins.right - (barWidth ? barWidth / 2 : 0);
|
|
760
|
+
return isRTL
|
|
761
|
+
? { dStartValue: lDate, dEndValue: sDate, rStartValue: rStartValue, rEndValue: rEndValue }
|
|
762
|
+
: { dStartValue: sDate, dEndValue: lDate, rStartValue: rStartValue, rEndValue: rEndValue };
|
|
763
|
+
}
|
|
764
|
+
exports.domainRangeOfDateForAreaLineVerticalBarChart = domainRangeOfDateForAreaLineVerticalBarChart;
|
|
752
765
|
/**
|
|
753
766
|
* Calculate domain and range values to the Vertical bar chart - For Numeric axis
|
|
754
767
|
* @export
|
|
@@ -810,7 +823,9 @@ points, margins, width, chartType, isRTL, xAxisType, barWidth, tickValues, shift
|
|
|
810
823
|
switch (chartType) {
|
|
811
824
|
case ChartTypes.AreaChart:
|
|
812
825
|
case ChartTypes.LineChart:
|
|
813
|
-
|
|
826
|
+
case ChartTypes.VerticalBarChart:
|
|
827
|
+
case ChartTypes.VerticalStackedBarChart:
|
|
828
|
+
domainNRangeValue = domainRangeOfDateForAreaLineVerticalBarChart(points, margins, width, isRTL, tickValues, chartType, barWidth);
|
|
814
829
|
break;
|
|
815
830
|
default:
|
|
816
831
|
domainNRangeValue = { dStartValue: 0, dEndValue: 0, rStartValue: 0, rEndValue: 0 };
|
|
@@ -955,8 +970,8 @@ exports.getMinMaxOfYAxis = getMinMaxOfYAxis;
|
|
|
955
970
|
* This function takes the single data point of the x-aixs
|
|
956
971
|
* and decides what is the x-axis
|
|
957
972
|
*/
|
|
958
|
-
var getTypeOfAxis = function (p,
|
|
959
|
-
if (
|
|
973
|
+
var getTypeOfAxis = function (p, isXAxis) {
|
|
974
|
+
if (isXAxis) {
|
|
960
975
|
switch (typeof p) {
|
|
961
976
|
case 'string':
|
|
962
977
|
return XAxisTypes.StringAxis;
|
|
@@ -1054,10 +1069,13 @@ var convertToLocaleString = function (data, culture) {
|
|
|
1054
1069
|
if (typeof data === 'number') {
|
|
1055
1070
|
return data.toLocaleString(culture);
|
|
1056
1071
|
}
|
|
1057
|
-
if (typeof data === 'string' && !window.isNaN(Number(data))) {
|
|
1072
|
+
else if (typeof data === 'string' && !window.isNaN(Number(data))) {
|
|
1058
1073
|
var num = Number(data);
|
|
1059
1074
|
return num.toLocaleString(culture);
|
|
1060
1075
|
}
|
|
1076
|
+
else if (data instanceof Date) {
|
|
1077
|
+
return data.toLocaleDateString(culture);
|
|
1078
|
+
}
|
|
1061
1079
|
return data;
|
|
1062
1080
|
};
|
|
1063
1081
|
exports.convertToLocaleString = convertToLocaleString;
|