@fluentui/react-charting 5.21.32 → 5.22.1
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/dist/react-charting.d.ts +152 -0
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +60 -0
- package/lib/components/DonutChart/Arc/Arc.js +22 -5
- package/lib/components/DonutChart/Arc/Arc.js.map +1 -1
- package/lib/components/DonutChart/Arc/Arc.types.d.ts +15 -0
- package/lib/components/DonutChart/Arc/Arc.types.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.base.js +13 -4
- package/lib/components/DonutChart/DonutChart.base.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.types.d.ts +10 -0
- package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib/components/DonutChart/Pie/Pie.js +8 -2
- package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib/components/DonutChart/Pie/Pie.types.d.ts +10 -0
- package/lib/components/DonutChart/Pie/Pie.types.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.base.js +30 -6
- package/lib/components/GaugeChart/GaugeChart.base.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.types.d.ts +14 -0
- package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +29 -6
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.d.ts +10 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.base.js +26 -9
- package/lib/components/HorizontalBarChart/HorizontalBarChart.base.js.map +1 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.types.d.ts +10 -0
- package/lib/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +75 -30
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.d.ts +10 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
- package/lib/components/StackedBarChart/MultiStackedBarChart.base.js +29 -10
- package/lib/components/StackedBarChart/MultiStackedBarChart.base.js.map +1 -1
- package/lib/components/StackedBarChart/MultiStackedBarChart.types.d.ts +10 -0
- package/lib/components/StackedBarChart/MultiStackedBarChart.types.js.map +1 -1
- package/lib/components/StackedBarChart/StackedBarChart.base.js +18 -7
- package/lib/components/StackedBarChart/StackedBarChart.base.js.map +1 -1
- package/lib/components/StackedBarChart/StackedBarChart.types.d.ts +10 -0
- package/lib/components/StackedBarChart/StackedBarChart.types.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js +79 -14
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.types.d.ts +10 -0
- package/lib/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +32 -10
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.d.ts +10 -0
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
- package/lib/index.d.ts +39 -20
- package/lib/index.js +20 -20
- package/lib/index.js.map +1 -1
- package/lib/types/IDataPoint.d.ts +25 -0
- package/lib/types/IDataPoint.js.map +1 -1
- package/lib/utilities/gradients.d.ts +30 -0
- package/lib/utilities/gradients.js +173 -0
- package/lib/utilities/gradients.js.map +1 -0
- package/lib/utilities/index.d.ts +1 -0
- package/lib/utilities/index.js +1 -0
- package/lib/utilities/index.js.map +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/lib-amd/components/DonutChart/Arc/Arc.js +21 -4
- package/lib-amd/components/DonutChart/Arc/Arc.js.map +1 -1
- package/lib-amd/components/DonutChart/Arc/Arc.types.d.ts +15 -0
- package/lib-amd/components/DonutChart/Arc/Arc.types.js.map +1 -1
- package/lib-amd/components/DonutChart/DonutChart.base.js +12 -3
- package/lib-amd/components/DonutChart/DonutChart.base.js.map +1 -1
- package/lib-amd/components/DonutChart/DonutChart.types.d.ts +10 -0
- package/lib-amd/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib-amd/components/DonutChart/Pie/Pie.js +7 -1
- package/lib-amd/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib-amd/components/DonutChart/Pie/Pie.types.d.ts +10 -0
- package/lib-amd/components/DonutChart/Pie/Pie.types.js.map +1 -1
- package/lib-amd/components/GaugeChart/GaugeChart.base.js +28 -4
- package/lib-amd/components/GaugeChart/GaugeChart.base.js.map +1 -1
- package/lib-amd/components/GaugeChart/GaugeChart.types.d.ts +14 -0
- package/lib-amd/components/GaugeChart/GaugeChart.types.js.map +1 -1
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +28 -5
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.d.ts +10 -0
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -1
- package/lib-amd/components/HorizontalBarChart/HorizontalBarChart.base.js +25 -8
- package/lib-amd/components/HorizontalBarChart/HorizontalBarChart.base.js.map +1 -1
- package/lib-amd/components/HorizontalBarChart/HorizontalBarChart.types.d.ts +10 -0
- package/lib-amd/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -1
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +74 -29
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.d.ts +10 -0
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
- package/lib-amd/components/StackedBarChart/MultiStackedBarChart.base.js +28 -9
- package/lib-amd/components/StackedBarChart/MultiStackedBarChart.base.js.map +1 -1
- package/lib-amd/components/StackedBarChart/MultiStackedBarChart.types.d.ts +10 -0
- package/lib-amd/components/StackedBarChart/MultiStackedBarChart.types.js.map +1 -1
- package/lib-amd/components/StackedBarChart/StackedBarChart.base.js +17 -6
- package/lib-amd/components/StackedBarChart/StackedBarChart.base.js.map +1 -1
- package/lib-amd/components/StackedBarChart/StackedBarChart.types.d.ts +10 -0
- package/lib-amd/components/StackedBarChart/StackedBarChart.types.js.map +1 -1
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +78 -13
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.types.d.ts +10 -0
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -1
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +31 -9
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.types.d.ts +10 -0
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
- package/lib-amd/index.d.ts +39 -20
- package/lib-amd/index.js +36 -21
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/types/IDataPoint.d.ts +25 -0
- package/lib-amd/types/IDataPoint.js.map +1 -1
- package/lib-amd/utilities/gradients.d.ts +30 -0
- package/lib-amd/utilities/gradients.js +180 -0
- package/lib-amd/utilities/gradients.js.map +1 -0
- package/lib-amd/utilities/index.d.ts +1 -0
- package/lib-amd/utilities/index.js +2 -1
- package/lib-amd/utilities/index.js.map +1 -1
- package/lib-amd/version.js +1 -1
- package/lib-amd/version.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Arc/Arc.js +21 -4
- package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Arc/Arc.types.d.ts +15 -0
- package/lib-commonjs/components/DonutChart/Arc/Arc.types.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.base.js +12 -3
- package/lib-commonjs/components/DonutChart/DonutChart.base.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.types.d.ts +10 -0
- package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Pie/Pie.js +7 -1
- package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Pie/Pie.types.d.ts +10 -0
- package/lib-commonjs/components/DonutChart/Pie/Pie.types.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.base.js +28 -4
- package/lib-commonjs/components/GaugeChart/GaugeChart.base.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.types.d.ts +14 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +28 -5
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.d.ts +10 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.base.js +25 -8
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.d.ts +10 -0
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +74 -29
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.d.ts +10 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
- package/lib-commonjs/components/StackedBarChart/MultiStackedBarChart.base.js +28 -9
- package/lib-commonjs/components/StackedBarChart/MultiStackedBarChart.base.js.map +1 -1
- package/lib-commonjs/components/StackedBarChart/MultiStackedBarChart.types.d.ts +10 -0
- package/lib-commonjs/components/StackedBarChart/MultiStackedBarChart.types.js.map +1 -1
- package/lib-commonjs/components/StackedBarChart/StackedBarChart.base.js +17 -6
- package/lib-commonjs/components/StackedBarChart/StackedBarChart.base.js.map +1 -1
- package/lib-commonjs/components/StackedBarChart/StackedBarChart.types.d.ts +10 -0
- package/lib-commonjs/components/StackedBarChart/StackedBarChart.types.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +78 -13
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.types.d.ts +10 -0
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +31 -9
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.d.ts +10 -0
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
- package/lib-commonjs/index.d.ts +39 -20
- package/lib-commonjs/index.js +55 -21
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types/IDataPoint.d.ts +25 -0
- package/lib-commonjs/types/IDataPoint.js.map +1 -1
- package/lib-commonjs/utilities/gradients.d.ts +30 -0
- package/lib-commonjs/utilities/gradients.js +178 -0
- package/lib-commonjs/utilities/gradients.js.map +1 -0
- package/lib-commonjs/utilities/index.d.ts +1 -0
- package/lib-commonjs/utilities/index.js +1 -0
- package/lib-commonjs/utilities/index.js.map +1 -1
- package/lib-commonjs/version.js +1 -1
- package/lib-commonjs/version.js.map +1 -1
- package/package.json +3 -3
- package/src/components/DonutChart/Arc/Arc.types.ts +18 -0
- package/src/components/DonutChart/DonutChart.types.ts +12 -0
- package/src/components/DonutChart/Pie/Pie.types.ts +12 -0
- package/src/components/GaugeChart/GaugeChart.types.ts +17 -0
- package/src/components/HorizontalBarChart/HorizontalBarChart.types.ts +12 -0
- package/src/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.ts +12 -0
- package/src/components/StackedBarChart/MultiStackedBarChart.types.ts +12 -0
- package/src/components/StackedBarChart/StackedBarChart.types.ts +12 -0
- package/src/components/VerticalBarChart/VerticalBarChart.types.ts +12 -0
- package/src/components/VerticalStackedBarChart/VerticalStackedBarChart.types.ts +12 -0
|
@@ -121,6 +121,11 @@ export interface IChartDataPoint {
|
|
|
121
121
|
* Color for the legend in the chart. If not provided, it will fallback on the default color palette.
|
|
122
122
|
*/
|
|
123
123
|
color?: string;
|
|
124
|
+
/**
|
|
125
|
+
* Gradient for the legend in the chart. If not provided, it will fallback on the default color palette.
|
|
126
|
+
* If provided, it will override the color prop. granted `enableGradient` is set to true for the chart.
|
|
127
|
+
*/
|
|
128
|
+
gradient?: [string, string];
|
|
124
129
|
/**
|
|
125
130
|
* placeholder data point
|
|
126
131
|
*/
|
|
@@ -162,6 +167,11 @@ export interface IVerticalBarChartDataPoint {
|
|
|
162
167
|
* color for the legend in the chart
|
|
163
168
|
*/
|
|
164
169
|
color?: string;
|
|
170
|
+
/**
|
|
171
|
+
* Gradient for the legend in the chart. If not provided, it will fallback on the default color palette.
|
|
172
|
+
* If provided, it will override the color prop. granted `enableGradient` is set to true for the chart.
|
|
173
|
+
*/
|
|
174
|
+
gradient?: [string, string];
|
|
165
175
|
/**
|
|
166
176
|
* Callout data for x axis
|
|
167
177
|
* This is an optional prop, If haven;t given legend will take
|
|
@@ -207,6 +217,11 @@ export interface IHorizontalBarChartWithAxisDataPoint {
|
|
|
207
217
|
* color for the legend in the chart
|
|
208
218
|
*/
|
|
209
219
|
color?: string;
|
|
220
|
+
/**
|
|
221
|
+
* Gradient for the legend in the chart. If not provided, it will fallback on the default color palette.
|
|
222
|
+
* If provided, it will override the color prop. granted `enableGradient` is set to true for the chart.
|
|
223
|
+
*/
|
|
224
|
+
gradient?: [string, string];
|
|
210
225
|
/**
|
|
211
226
|
* Callout data for x axis
|
|
212
227
|
* This is an optional prop, If haven;t given legend will take
|
|
@@ -485,6 +500,11 @@ export interface IVSChartDataPoint {
|
|
|
485
500
|
* color for the legend in the chart
|
|
486
501
|
*/
|
|
487
502
|
color?: string;
|
|
503
|
+
/**
|
|
504
|
+
* Gradient for the legend in the chart. If not provided, it will fallback on the default color palette.
|
|
505
|
+
* If provided, it will override the color prop. granted `enableGradient` is set to true for the chart.
|
|
506
|
+
*/
|
|
507
|
+
gradient?: [string, string];
|
|
488
508
|
/**
|
|
489
509
|
* Callout data for x axis
|
|
490
510
|
* This is an optional prop, If haven;t given legend will take
|
|
@@ -560,6 +580,11 @@ export interface IGVBarChartSeriesPoint {
|
|
|
560
580
|
* Color for the legend in the chart
|
|
561
581
|
*/
|
|
562
582
|
color: string;
|
|
583
|
+
/**
|
|
584
|
+
* Gradient for the legend in the chart. If not provided, it will fallback on the default color palette.
|
|
585
|
+
* If provided, it will override the color prop. granted `enableGradient` is set to true for the chart.
|
|
586
|
+
*/
|
|
587
|
+
gradient?: [string, string];
|
|
563
588
|
/**
|
|
564
589
|
* Legend text in the chart
|
|
565
590
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IDataPoint.js","sourceRoot":"../src/","sources":["types/IDataPoint.ts"],"names":[],"mappings":"","sourcesContent":["import { SankeyLink, SankeyNode } from 'd3-sankey';\nimport { SVGProps } from 'react';\nimport { LegendShape } from '../components/Legends/Legends.types';\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 /**\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;\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
|
+
{"version":3,"file":"IDataPoint.js","sourceRoot":"../src/","sources":["types/IDataPoint.ts"],"names":[],"mappings":"","sourcesContent":["import { SankeyLink, SankeyNode } from 'd3-sankey';\nimport { SVGProps } from 'react';\nimport { LegendShape } from '../components/Legends/Legends.types';\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 * 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 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 /**\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;\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;\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 * 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/**\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"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const DataVizGradientPalette: {
|
|
2
|
+
gradient1: string;
|
|
3
|
+
gradient2: string;
|
|
4
|
+
gradient3: string;
|
|
5
|
+
gradient4: string;
|
|
6
|
+
gradient5: string;
|
|
7
|
+
gradient6: string;
|
|
8
|
+
gradient7: string;
|
|
9
|
+
gradient8: string;
|
|
10
|
+
gradient9: string;
|
|
11
|
+
gradient10: string;
|
|
12
|
+
gradient1Ext: string;
|
|
13
|
+
gradient2Ext: string;
|
|
14
|
+
gradient3Ext: string;
|
|
15
|
+
gradient4Ext: string;
|
|
16
|
+
gradient5Ext: string;
|
|
17
|
+
gradient6Ext: string;
|
|
18
|
+
gradient7Ext: string;
|
|
19
|
+
gradient8Ext: string;
|
|
20
|
+
gradient9Ext: string;
|
|
21
|
+
gradient10Ext: string;
|
|
22
|
+
success: string;
|
|
23
|
+
highSuccess: string;
|
|
24
|
+
warning: string;
|
|
25
|
+
error: string;
|
|
26
|
+
highError: string;
|
|
27
|
+
disabled: string;
|
|
28
|
+
};
|
|
29
|
+
export declare const getNextGradient: (index: number, offset?: number, isDarkTheme?: boolean) => [string, string];
|
|
30
|
+
export declare const getGradientFromToken: (token: string, isDarkTheme?: boolean) => [string, string];
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
export var DataVizGradientPalette = {
|
|
2
|
+
gradient1: 'default.1',
|
|
3
|
+
gradient2: 'default.2',
|
|
4
|
+
gradient3: 'default.3',
|
|
5
|
+
gradient4: 'default.4',
|
|
6
|
+
gradient5: 'default.5',
|
|
7
|
+
gradient6: 'default.6',
|
|
8
|
+
gradient7: 'default.7',
|
|
9
|
+
gradient8: 'default.8',
|
|
10
|
+
gradient9: 'default.9',
|
|
11
|
+
gradient10: 'default.10',
|
|
12
|
+
// extended gradients
|
|
13
|
+
gradient1Ext: 'extended.1',
|
|
14
|
+
gradient2Ext: 'extended.2',
|
|
15
|
+
gradient3Ext: 'extended.3',
|
|
16
|
+
gradient4Ext: 'extended.4',
|
|
17
|
+
gradient5Ext: 'extended.5',
|
|
18
|
+
gradient6Ext: 'extended.6',
|
|
19
|
+
gradient7Ext: 'extended.7',
|
|
20
|
+
gradient8Ext: 'extended.8',
|
|
21
|
+
gradient9Ext: 'extended.9',
|
|
22
|
+
gradient10Ext: 'extended.10',
|
|
23
|
+
// status gradients
|
|
24
|
+
success: 'semantic.success',
|
|
25
|
+
highSuccess: 'semantic.highSuccess',
|
|
26
|
+
warning: 'semantic.warning',
|
|
27
|
+
error: 'semantic.error',
|
|
28
|
+
highError: 'semantic.highError',
|
|
29
|
+
disabled: 'semantic.disabled',
|
|
30
|
+
};
|
|
31
|
+
var defaultGradientPalette = {
|
|
32
|
+
'1': [
|
|
33
|
+
['#4760D5', '#637CEF'],
|
|
34
|
+
['#4F6BED', '#637CEF'], // [cornflower.shade10, cornflower.tint10],
|
|
35
|
+
],
|
|
36
|
+
'2': [
|
|
37
|
+
['#795AA6', '#9373C0'],
|
|
38
|
+
['#8764B8', '#A083C9'], // [orchid.primary, orchid.tint20],
|
|
39
|
+
],
|
|
40
|
+
'3': [
|
|
41
|
+
['#159195', '#2AA0A4'],
|
|
42
|
+
['#159195', '#2AA0A4'], // [teal.tint10, teal.tint20],
|
|
43
|
+
],
|
|
44
|
+
'4': [
|
|
45
|
+
['#B146C2', '#C36BD1'],
|
|
46
|
+
['#B146C2', '#C36BD1'], // [lilac.primary, lilac.tint20],
|
|
47
|
+
],
|
|
48
|
+
'5': [
|
|
49
|
+
['#3487C7', '#3A96DD'],
|
|
50
|
+
['#3487C7', '#3A96DD'], // [lightBlue.shade20, lightBlue.primary],
|
|
51
|
+
],
|
|
52
|
+
'6': [
|
|
53
|
+
['#0E7A0B', '#13A10E'],
|
|
54
|
+
['#11910D', '#27AC22'], // [lightGreen.shade10, lightGreen.tint10],
|
|
55
|
+
],
|
|
56
|
+
'7': [
|
|
57
|
+
['#E61C99', '#EE5FB7'],
|
|
58
|
+
['#E61C99', '#EE5FB7'], // [hotPink.tint10, hotPink.tint30],
|
|
59
|
+
],
|
|
60
|
+
'8': [
|
|
61
|
+
['#CA5010', '#D77440'],
|
|
62
|
+
['#CA5010', '#D77440'], // [pumpkin.primary, pumpkin.tint10],
|
|
63
|
+
],
|
|
64
|
+
'9': [
|
|
65
|
+
['#57811B', '#689920'],
|
|
66
|
+
['#57811B', '#689920'], // [lime.shade20, lime.shade10],
|
|
67
|
+
],
|
|
68
|
+
'10': [
|
|
69
|
+
['#937700', '#AE8C00'],
|
|
70
|
+
['#937700', '#AE8C00'], // [gold.shade20, gold.shade10],
|
|
71
|
+
],
|
|
72
|
+
};
|
|
73
|
+
var extendedGradientPalette = {
|
|
74
|
+
'1': [
|
|
75
|
+
['#2C3C85', '#3C51B4'],
|
|
76
|
+
['#93A4F4', '#C8D1FA'], // [cornflower.tint30, cornflower.tint40],
|
|
77
|
+
],
|
|
78
|
+
'2': [
|
|
79
|
+
['#4C3867', '#674C8C'],
|
|
80
|
+
['#A083C9', '#B29AD4'], // [orchid.tint20, orchid.tint30],
|
|
81
|
+
],
|
|
82
|
+
'3': [
|
|
83
|
+
['#02494C', '#038387'],
|
|
84
|
+
['#4CB4B7', '#9BD9DB'], // [teal.tint30, teal.tint40],
|
|
85
|
+
],
|
|
86
|
+
'4': [
|
|
87
|
+
['#63276D', '#863593'],
|
|
88
|
+
['#C36BD1', '#CF87DA'], // [lilac.tint20, lilac.tint30],
|
|
89
|
+
],
|
|
90
|
+
'5': [
|
|
91
|
+
['#20547C', '#2C72A8'],
|
|
92
|
+
['#4FA1E1', '#83BDEB'], // [lightBlue.tint10, lightBlue.tint30],
|
|
93
|
+
],
|
|
94
|
+
'6': [
|
|
95
|
+
['#0B5A08', '#0E7A0B'],
|
|
96
|
+
['#27AC22', '#5EC75A'], // [lightGreen.tint10, lightGreen.tint30],
|
|
97
|
+
],
|
|
98
|
+
'7': [
|
|
99
|
+
['#AD006A', '#E3008C'],
|
|
100
|
+
['#EE5FB7', '#F7ADDA'], // [hotPink.tint30, hotPink.tint40],
|
|
101
|
+
],
|
|
102
|
+
'8': [
|
|
103
|
+
['#9A3D0C', '#CA5010'],
|
|
104
|
+
['#D77440', '#DF8E64'], // [pumpkin.tint20, pumpkin.tint30],
|
|
105
|
+
],
|
|
106
|
+
'9': [
|
|
107
|
+
['#405F14', '#57811B'],
|
|
108
|
+
['#73AA24', '#A4CC6C'], // [lime.primary, lime.tint30],
|
|
109
|
+
],
|
|
110
|
+
'10': [
|
|
111
|
+
['#6D5700', '#937700'],
|
|
112
|
+
['#D0B232', '#DAC157'], // [gold.tint20, gold.tint30],
|
|
113
|
+
],
|
|
114
|
+
};
|
|
115
|
+
var semanticGradientPalette = {
|
|
116
|
+
success: [
|
|
117
|
+
['#0C5E0C', '#107C10'],
|
|
118
|
+
['#218C21', '#359B35'], // [green.tint10, green.tint20],
|
|
119
|
+
],
|
|
120
|
+
highSuccess: [
|
|
121
|
+
['#107C10', '#359B35'],
|
|
122
|
+
['#359B35', '#9FD89F'], // [green.tint20, green.tint40],
|
|
123
|
+
],
|
|
124
|
+
warning: [
|
|
125
|
+
['#DE590B', '#F7630C'],
|
|
126
|
+
['#DE590B', '#F87528'], // [orange.shade10, orange.tint10],
|
|
127
|
+
],
|
|
128
|
+
error: [
|
|
129
|
+
['#B10E1C', '#CC2635'],
|
|
130
|
+
['#D33F4C', '#EEACB2'], // [cranberry.tint20, cranberry.tint40],
|
|
131
|
+
],
|
|
132
|
+
highError: [
|
|
133
|
+
['#6E0811', '#B10E1C'],
|
|
134
|
+
['#D33F4C', '#DC626D'], // [cranberry.tint20, cranberry.tint30],
|
|
135
|
+
],
|
|
136
|
+
disabled: [
|
|
137
|
+
['#E6E6E6', '#F0F0F0'],
|
|
138
|
+
['#E6E6E6', '#F0F0F0'],
|
|
139
|
+
],
|
|
140
|
+
};
|
|
141
|
+
var Gradients = {
|
|
142
|
+
default: defaultGradientPalette,
|
|
143
|
+
semantic: semanticGradientPalette,
|
|
144
|
+
extended: extendedGradientPalette, // extended gradients
|
|
145
|
+
};
|
|
146
|
+
var DEFAULT_COLORS = Object.values(defaultGradientPalette);
|
|
147
|
+
var TOKENS = Object.values(DataVizGradientPalette);
|
|
148
|
+
var getThemeSpecificGradient = function (gradients, isDarkTheme) {
|
|
149
|
+
if (gradients.length === 0) {
|
|
150
|
+
return ['', ''];
|
|
151
|
+
}
|
|
152
|
+
var colorIdx = Number(isDarkTheme);
|
|
153
|
+
if (colorIdx < gradients.length) {
|
|
154
|
+
return gradients[colorIdx];
|
|
155
|
+
}
|
|
156
|
+
return gradients[0];
|
|
157
|
+
};
|
|
158
|
+
export var getNextGradient = function (index, offset, isDarkTheme) {
|
|
159
|
+
if (offset === void 0) { offset = 0; }
|
|
160
|
+
if (isDarkTheme === void 0) { isDarkTheme = false; }
|
|
161
|
+
var gradients = DEFAULT_COLORS[(index + offset) % DEFAULT_COLORS.length];
|
|
162
|
+
return getThemeSpecificGradient(gradients, isDarkTheme);
|
|
163
|
+
};
|
|
164
|
+
export var getGradientFromToken = function (token, isDarkTheme) {
|
|
165
|
+
if (isDarkTheme === void 0) { isDarkTheme = false; }
|
|
166
|
+
if (TOKENS.indexOf(token) >= 0) {
|
|
167
|
+
var _a = token.split('.'), paletteName = _a[0], colorCode = _a[1];
|
|
168
|
+
var colors = Gradients[paletteName][colorCode];
|
|
169
|
+
return getThemeSpecificGradient(colors, isDarkTheme);
|
|
170
|
+
}
|
|
171
|
+
return [token, token];
|
|
172
|
+
};
|
|
173
|
+
//# sourceMappingURL=gradients.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradients.js","sourceRoot":"../src/","sources":["utilities/gradients.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,sBAAsB,GAAG;IACpC,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,SAAS,EAAE,WAAW;IACtB,UAAU,EAAE,YAAY;IACxB,qBAAqB;IACrB,YAAY,EAAE,YAAY;IAC1B,YAAY,EAAE,YAAY;IAC1B,YAAY,EAAE,YAAY;IAC1B,YAAY,EAAE,YAAY;IAC1B,YAAY,EAAE,YAAY;IAC1B,YAAY,EAAE,YAAY;IAC1B,YAAY,EAAE,YAAY;IAC1B,YAAY,EAAE,YAAY;IAC1B,YAAY,EAAE,YAAY;IAC1B,aAAa,EAAE,aAAa;IAC5B,mBAAmB;IACnB,OAAO,EAAE,kBAAkB;IAC3B,WAAW,EAAE,sBAAsB;IACnC,OAAO,EAAE,kBAAkB;IAC3B,KAAK,EAAE,gBAAg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AAa,EAAE,MAAkB,EAAE,WAA4B;IAAhD,uBAAA,EAAA,UAAkB;IAAE,4BAAA,EAAA,mBAA4B;IAC7F,IAAM,SAAS,GAAG,cAAc,CAAC,CAAC,KAAK,GAAG,MAAM,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IAC3E,OAAO,wBAAwB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAC1D,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,oBAAoB,GAAG,UAAC,KAAa,EAAE,WAA4B;IAA5B,4BAAA,EAAA,mBAA4B;IAC9E,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;QACxB,IAAA,KAA2B,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,EAA1C,WAAW,QAAA,EAAE,SAAS,QAAoB,CAAC;QAClD,IAAM,MAAM,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC;QAEjD,OAAO,wBAAwB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;KACtD;IACD,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AACxB,CAAC,CAAC","sourcesContent":["export const DataVizGradientPalette = {\n gradient1: 'default.1',\n gradient2: 'default.2',\n gradient3: 'default.3',\n gradient4: 'default.4',\n gradient5: 'default.5',\n gradient6: 'default.6',\n gradient7: 'default.7',\n gradient8: 'default.8',\n gradient9: 'default.9',\n gradient10: 'default.10',\n // extended gradients\n gradient1Ext: 'extended.1',\n gradient2Ext: 'extended.2',\n gradient3Ext: 'extended.3',\n gradient4Ext: 'extended.4',\n gradient5Ext: 'extended.5',\n gradient6Ext: 'extended.6',\n gradient7Ext: 'extended.7',\n gradient8Ext: 'extended.8',\n gradient9Ext: 'extended.9',\n gradient10Ext: 'extended.10',\n // status gradients\n success: 'semantic.success',\n highSuccess: 'semantic.highSuccess',\n warning: 'semantic.warning',\n error: 'semantic.error',\n highError: 'semantic.highError',\n disabled: 'semantic.disabled',\n};\n\n/**\n * Key: Color code.\n * Value:\n *\n * Index 0 - Default gradient for light theme\n * ├── Index 0 - start color of gradient\n * └── Index 1 - end color of gradient\n *\n * Index 1 - gradient for dark theme\n * ├── Index 0 - start color of gradient\n * └── Index 1 - end color of gradient\n */\ntype GradientPalette = { [key: string]: [string, string][] };\n\nconst defaultGradientPalette: GradientPalette = {\n '1': [\n ['#4760D5', '#637CEF'], // [cornflower.shade10, cornflower.tint10],\n ['#4F6BED', '#637CEF'], // [cornflower.shade10, cornflower.tint10],\n ],\n '2': [\n ['#795AA6', '#9373C0'], // [orchid.shade20, orchid.tint10],\n ['#8764B8', '#A083C9'], // [orchid.primary, orchid.tint20],\n ],\n '3': [\n ['#159195', '#2AA0A4'], // [teal.tint10, teal.tint20],\n ['#159195', '#2AA0A4'], // [teal.tint10, teal.tint20],\n ],\n '4': [\n ['#B146C2', '#C36BD1'], // [lilac.primary, lilac.tint20],\n ['#B146C2', '#C36BD1'], // [lilac.primary, lilac.tint20],\n ],\n '5': [\n ['#3487C7', '#3A96DD'], // [lightBlue.shade10, lightBlue.primary],\n ['#3487C7', '#3A96DD'], // [lightBlue.shade20, lightBlue.primary],\n ],\n '6': [\n ['#0E7A0B', '#13A10E'], // [lightGreen.shade20, lightGreen.primary],\n ['#11910D', '#27AC22'], // [lightGreen.shade10, lightGreen.tint10],\n ],\n '7': [\n ['#E61C99', '#EE5FB7'], // [hotPink.tint10, hotPink.tint30],\n ['#E61C99', '#EE5FB7'], // [hotPink.tint10, hotPink.tint30],\n ],\n '8': [\n ['#CA5010', '#D77440'], // [pumpkin.primary, pumpkin.tint20],\n ['#CA5010', '#D77440'], // [pumpkin.primary, pumpkin.tint10],\n ],\n '9': [\n ['#57811B', '#689920'], // [lime.shade20, lime.shade10],\n ['#57811B', '#689920'], // [lime.shade20, lime.shade10],\n ],\n '10': [\n ['#937700', '#AE8C00'], // [gold.shade20, gold.shade10],\n ['#937700', '#AE8C00'], // [gold.shade20, gold.shade10],\n ],\n};\n\nconst extendedGradientPalette: GradientPalette = {\n '1': [\n ['#2C3C85', '#3C51B4'], // [cornflower.shade30, cornflower.shade20],\n ['#93A4F4', '#C8D1FA'], // [cornflower.tint30, cornflower.tint40],\n ],\n '2': [\n ['#4C3867', '#674C8C'], // [orchid.shade30, orchid.shade20],\n ['#A083C9', '#B29AD4'], // [orchid.tint20, orchid.tint30],\n ],\n '3': [\n ['#02494C', '#038387'], // [teal.shade30, teal.primary],\n ['#4CB4B7', '#9BD9DB'], // [teal.tint30, teal.tint40],\n ],\n '4': [\n ['#63276D', '#863593'], // [lilac.shade30, lilac.shade20],\n ['#C36BD1', '#CF87DA'], // [lilac.tint20, lilac.tint30],\n ],\n '5': [\n ['#20547C', '#2C72A8'], // [lightBlue.shade30, lightBlue.shade20],\n ['#4FA1E1', '#83BDEB'], // [lightBlue.tint10, lightBlue.tint30],\n ],\n '6': [\n ['#0B5A08', '#0E7A0B'], // [lightGreen.shade30, lightGreen.shade20],\n ['#27AC22', '#5EC75A'], // [lightGreen.tint10, lightGreen.tint30],\n ],\n '7': [\n ['#AD006A', '#E3008C'], // [hotPink.shade20, hotPink.primary],\n ['#EE5FB7', '#F7ADDA'], // [hotPink.tint30, hotPink.tint40],\n ],\n '8': [\n ['#9A3D0C', '#CA5010'], // [pumpkin.shade20, pumpkin.primary],\n ['#D77440', '#DF8E64'], // [pumpkin.tint20, pumpkin.tint30],\n ],\n '9': [\n ['#405F14', '#57811B'], // [lime.shade30, lime.shade20],\n ['#73AA24', '#A4CC6C'], // [lime.primary, lime.tint30],\n ],\n '10': [\n ['#6D5700', '#937700'], // [gold.shade30, gold.shade20],\n ['#D0B232', '#DAC157'], // [gold.tint20, gold.tint30],\n ],\n};\n\nconst semanticGradientPalette: GradientPalette = {\n success: [\n ['#0C5E0C', '#107C10'], // [green.shade20, green.primary],\n ['#218C21', '#359B35'], // [green.tint10, green.tint20],\n ],\n highSuccess: [\n ['#107C10', '#359B35'], // [green.primary, green.tint20],\n ['#359B35', '#9FD89F'], // [green.tint20, green.tint40],\n ],\n warning: [\n ['#DE590B', '#F7630C'], // [orange.shade10, orange.primary],\n ['#DE590B', '#F87528'], // [orange.shade10, orange.tint10],\n ],\n error: [\n ['#B10E1C', '#CC2635'], // [cranberry.shade10, cranberry.tint10],\n ['#D33F4C', '#EEACB2'], // [cranberry.tint20, cranberry.tint40],\n ],\n highError: [\n ['#6E0811', '#B10E1C'], // [cranberry.shade30, cranberry.shade10],\n ['#D33F4C', '#DC626D'], // [cranberry.tint20, cranberry.tint30],\n ],\n disabled: [\n ['#E6E6E6', '#F0F0F0'],\n ['#E6E6E6', '#F0F0F0'],\n ],\n};\n\nconst Gradients: { [key: string]: GradientPalette } = {\n default: defaultGradientPalette, // base gradients\n semantic: semanticGradientPalette, // status gradients\n extended: extendedGradientPalette, // extended gradients\n};\n\nconst DEFAULT_COLORS = Object.values(defaultGradientPalette);\nconst TOKENS = Object.values(DataVizGradientPalette);\n\nconst getThemeSpecificGradient = (gradients: [string, string][], isDarkTheme: boolean): [string, string] => {\n if (gradients.length === 0) {\n return ['', ''];\n }\n\n const colorIdx = Number(isDarkTheme);\n\n if (colorIdx < gradients.length) {\n return gradients[colorIdx];\n }\n\n return gradients[0];\n};\n\nexport const getNextGradient = (index: number, offset: number = 0, isDarkTheme: boolean = false): [string, string] => {\n const gradients = DEFAULT_COLORS[(index + offset) % DEFAULT_COLORS.length];\n return getThemeSpecificGradient(gradients, isDarkTheme);\n};\n\nexport const getGradientFromToken = (token: string, isDarkTheme: boolean = false): [string, string] => {\n if (TOKENS.indexOf(token) >= 0) {\n const [paletteName, colorCode] = token.split('.');\n const colors = Gradients[paletteName][colorCode];\n\n return getThemeSpecificGradient(colors, isDarkTheme);\n }\n return [token, token];\n};\n"]}
|
package/lib/utilities/index.d.ts
CHANGED
package/lib/utilities/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["utilities/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC","sourcesContent":["export * from './ChartHoverCard/index';\nexport * from './utilities';\nexport * from './colors';\nexport * from './vbc-utils';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["utilities/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC","sourcesContent":["export * from './ChartHoverCard/index';\nexport * from './utilities';\nexport * from './colors';\nexport * from './gradients';\nexport * from './vbc-utils';\n"]}
|
package/lib/version.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Do not modify this file; it is generated as part of publish.
|
|
2
2
|
// The checked in version is a placeholder only and will not be updated.
|
|
3
3
|
import { setVersion } from '@fluentui/set-version';
|
|
4
|
-
setVersion('@fluentui/react-charting', '5.
|
|
4
|
+
setVersion('@fluentui/react-charting', '5.22.1');
|
|
5
5
|
//# sourceMappingURL=version.js.map
|
package/lib/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"../src/","sources":["version.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,wEAAwE;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,UAAU,CAAC,0BAA0B,EAAE,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"../src/","sources":["version.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,wEAAwE;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,UAAU,CAAC,0BAA0B,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["// Do not modify this file; it is generated as part of publish.\n// The checked in version is a placeholder only and will not be updated.\nimport { setVersion } from '@fluentui/set-version';\nsetVersion('@fluentui/react-charting', '5.22.1');"]}
|
|
@@ -50,20 +50,37 @@ define(["require", "exports", "tslib", "react", "d3-shape", "@fluentui/react/lib
|
|
|
50
50
|
};
|
|
51
51
|
Arc.prototype.render = function () {
|
|
52
52
|
var _a;
|
|
53
|
-
var _b;
|
|
53
|
+
var _b, _c, _d, _e, _f;
|
|
54
54
|
var arc = (_a = this.props, _a.arc), href = _a.href, focusedArcId = _a.focusedArcId;
|
|
55
55
|
var getClassNames = (0, Utilities_1.classNamesFunction)();
|
|
56
56
|
var classNames = getClassNames(Arc_styles_1.getStyles, {
|
|
57
57
|
color: this.props.color,
|
|
58
58
|
href: href,
|
|
59
59
|
theme: this.props.theme,
|
|
60
|
+
nextColor: this.props.nextColor,
|
|
60
61
|
});
|
|
61
62
|
var id = this.props.uniqText + this.props.data.data.legend.replace(/\s+/, '') + this.props.data.data.data;
|
|
62
63
|
var opacity = this.props.activeArc === this.props.data.data.legend || this.props.activeArc === '' ? 1 : 0.1;
|
|
64
|
+
var startAngle = (_c = (_b = this.props.data) === null || _b === void 0 ? void 0 : _b.startAngle) !== null && _c !== void 0 ? _c : 0;
|
|
65
|
+
var endAngle = ((_e = (_d = this.props.data) === null || _d === void 0 ? void 0 : _d.endAngle) !== null && _e !== void 0 ? _e : 0) - startAngle;
|
|
66
|
+
var cornerRadius = this.props.roundCorners ? 3 : 0;
|
|
67
|
+
var clipId = (0, Utilities_1.getId)('Arc_clip') + "".concat(this.props.color, "_").concat(this.props.nextColor);
|
|
63
68
|
return (React.createElement("g", { ref: this.currentRef },
|
|
64
|
-
!!focusedArcId && focusedArcId === id && (React.createElement("path", { id: id + 'focusRing', d: arc(this.props.focusData), className: classNames.focusRing })),
|
|
65
|
-
React.createElement("path", { id: id, d: arc(this.props.data), onFocus: this._onFocus.bind(this, this.props.data.data, id), className: classNames.root, "data-is-focusable": this.props.activeArc === this.props.data.data.legend || this.props.activeArc === '', onMouseOver: this._hoverOn.bind(this, this.props.data.data), onMouseMove: this._hoverOn.bind(this, this.props.data.data), onMouseLeave: this._hoverOff, onBlur: this._onBlur, opacity: opacity, onClick: href ? this._redirectToUrl.bind(this, href) : (
|
|
66
|
-
this._renderArcLabel(classNames.arcLabel)
|
|
69
|
+
!!focusedArcId && focusedArcId === id && (React.createElement("path", { id: id + 'focusRing', d: arc.cornerRadius(cornerRadius)(this.props.focusData), className: classNames.focusRing })),
|
|
70
|
+
React.createElement("path", { id: id, d: arc.cornerRadius(cornerRadius)(this.props.data), onFocus: this._onFocus.bind(this, this.props.data.data, id), className: classNames.root, fill: this.props.enableGradient ? 'transparent' : this.props.color, "data-is-focusable": this.props.activeArc === this.props.data.data.legend || this.props.activeArc === '', onMouseOver: this._hoverOn.bind(this, this.props.data.data), onMouseMove: this._hoverOn.bind(this, this.props.data.data), onMouseLeave: this._hoverOff, onBlur: this._onBlur, opacity: opacity, onClick: href ? this._redirectToUrl.bind(this, href) : (_f = this.props.data) === null || _f === void 0 ? void 0 : _f.data.onClick, "aria-label": this._getAriaLabel(), role: "img" }),
|
|
71
|
+
this._renderArcLabel(classNames.arcLabel),
|
|
72
|
+
this.props.enableGradient && (React.createElement(React.Fragment, null,
|
|
73
|
+
React.createElement("clipPath", { id: clipId },
|
|
74
|
+
React.createElement("path", { d: arc.cornerRadius(cornerRadius)(this.props.data) })),
|
|
75
|
+
React.createElement("foreignObject", { x: "-50%", y: "-50%", width: "100%", height: "100%", clipPath: "url(#".concat(clipId, ")") },
|
|
76
|
+
React.createElement("div", { style: {
|
|
77
|
+
width: '100%',
|
|
78
|
+
height: '100%',
|
|
79
|
+
background: this.props.enableGradient
|
|
80
|
+
? "conic-gradient(\n from ".concat(startAngle, "rad,\n ").concat(this.props.color, ",\n ").concat(this.props.nextColor, " ").concat(endAngle, "rad\n )")
|
|
81
|
+
: this.props.color,
|
|
82
|
+
opacity: opacity,
|
|
83
|
+
} }))))));
|
|
67
84
|
};
|
|
68
85
|
Arc.prototype._onFocus = function (data, id) {
|
|
69
86
|
this.props.onFocusCallback(data, id, this.currentRef.current);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Arc.js","sourceRoot":"../src/","sources":["components/DonutChart/Arc/Arc.tsx"],"names":[],"mappings":";;;;IAaA;QAAyB,+BAAqC;QAA9D;YAAA,qEAmHC;YA9GQ,WAAK,GAAO,EAAE,CAAC;YAEd,gBAAU,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;YAC/C,YAAM,GAAY,IAAA,kBAAM,GAAE,CAAC;YAwD3B,eAAS,GAAG;gBAClB,KAAI,CAAC,KAAK,CAAC,kBAAmB,EAAE,CAAC;YACnC,CAAC,CAAC;YAEM,aAAO,GAAG;gBAChB,KAAI,CAAC,KAAK,CAAC,cAAe,EAAE,CAAC;YAC/B,CAAC,CAAC;YAMM,mBAAa,GAAG;;gBACtB,IAAM,KAAK,GAAG,KAAI,CAAC,KAAK,CAAC,IAAK,CAAC,IAAI,CAAC;gBACpC,IAAM,MAAM,GAAG,KAAK,CAAC,gBAAgB,IAAI,KAAK,CAAC,MAAM,CAAC;gBACtD,IAAM,MAAM,GAAG,KAAK,CAAC,gBAAgB,IAAI,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC;gBACzD,OAAO,CAAA,MAAA,KAAK,CAAC,wBAAwB,0CAAE,SAAS,KAAI,CAAC,MAAM,CAAC,CAAC,CAAC,UAAG,MAAM,OAAI,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,UAAG,MAAM,MAAG,CAAC;YACnG,CAAC,CAAC;YAEM,qBAAe,GAAG,UAAC,SAAiB;;gBAClC,IAAA,GAAG,IAAL,KAAkG,KAAI,CAAC,KAAK,SAAvG,EAAE,IAAI,UAAA,EAAE,WAAW,iBAAA,EAAE,WAAW,iBAAA,EAAE,mBAAmB,yBAAA,EAAE,UAAU,gBAAA,EAAE,UAAU,gBAAA,EAAE,SAAS,eAAA,CAAgB;gBAEnH,IACE,UAAU;oBACV,IAAI,CAAC,GAAG,CA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AAO,gBACxE,IAAI,CAAC,aAAa,EAAE,EAChC,IAAI,EAAC,KAAK,GACV;gBACD,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,QAAQ,CAAC,CACxC,CACL,CAAC;QACJ,CAAC;QAEO,sBAAQ,GAAhB,UAAiB,IAAqB,EAAE,EAAU;YAChD,IAAI,CAAC,KAAK,CAAC,eAAgB,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACjE,CAAC;QAEO,sBAAQ,GAAhB,UAAiB,IAAqB,EAAE,UAA4C;YAClF,UAAU,CAAC,OAAO,EAAE,CAAC;YACrB,IAAI,CAAC,KAAK,CAAC,eAAgB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAChD,CAAC;QAUO,4BAAc,GAAtB,UAAuB,IAAwB;YAC7C,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5C,CAAC;QAzEa,gBAAY,GAAuB;YAC/C,GAAG,EAAE,IAAA,cAAK,GAAE;SACb,AAFyB,CAExB;QAgHJ,UAAC;KAAA,AAnHD,CAAyB,KAAK,CAAC,SAAS,GAmHvC;IAED,SAAS,YAAY,CAAC,QAAmB;QACvC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QAC/C,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IACjD,CAAC","sourcesContent":["import * as React from 'react';\nimport { arc as d3Arc } from 'd3-shape';\nimport { classNamesFunction, getRTL } from '@fluentui/react/lib/Utilities';\nimport { getStyles } from './Arc.styles';\nimport { IChartDataPoint } from '../index';\nimport { IArcProps, IArcStyles } from './index';\nimport { format as d3Format } from 'd3-format';\nimport { formatValueWithSIPrefix } from '../../../utilities/index';\n\nexport interface IArcState {\n isCalloutVisible?: boolean;\n}\n\nexport class Arc extends React.Component<IArcProps, IArcState> {\n public static defaultProps: Partial<IArcProps> = {\n arc: d3Arc(),\n };\n\n public state: {} = {};\n\n private currentRef = React.createRef<SVGPathElement>();\n private _isRTL: boolean = getRTL();\n\n public static getDerivedStateFromProps(nextProps: Readonly<IArcProps>): Partial<IArcState> | null {\n _updateChart(nextProps);\n return null;\n }\n\n public updateChart(newProps: IArcProps): void {\n _updateChart(newProps);\n }\n\n public render(): JSX.Element {\n const { arc, href, focusedArcId } = this.props;\n const getClassNames = classNamesFunction<IArcProps, IArcStyles>();\n const classNames = getClassNames(getStyles, {\n color: this.props.color,\n href: href!,\n theme: this.props.theme!,\n });\n const id = this.props.uniqText! + this.props.data!.data.legend!.replace(/\\s+/, '') + this.props.data!.data.data;\n const opacity: number =\n this.props.activeArc === this.props.data!.data.legend || this.props.activeArc === '' ? 1 : 0.1;\n return (\n <g ref={this.currentRef}>\n {!!focusedArcId && focusedArcId === id && (\n <path id={id + 'focusRing'} d={arc(this.props.focusData)} className={classNames.focusRing} />\n )}\n <path\n id={id}\n d={arc(this.props.data)}\n onFocus={this._onFocus.bind(this, this.props.data!.data, id)}\n className={classNames.root}\n data-is-focusable={this.props.activeArc === this.props.data!.data.legend || this.props.activeArc === ''}\n onMouseOver={this._hoverOn.bind(this, this.props.data!.data)}\n onMouseMove={this._hoverOn.bind(this, this.props.data!.data)}\n onMouseLeave={this._hoverOff}\n onBlur={this._onBlur}\n opacity={opacity}\n onClick={href ? this._redirectToUrl.bind(this, href) : this.props.data?.data.onClick}\n aria-label={this._getAriaLabel()}\n role=\"img\"\n />\n {this._renderArcLabel(classNames.arcLabel)}\n </g>\n );\n }\n\n private _onFocus(data: IChartDataPoint, id: string): void {\n this.props.onFocusCallback!(data, id, this.currentRef.current);\n }\n\n private _hoverOn(data: IChartDataPoint, mouseEvent: React.MouseEvent<SVGPathElement>): void {\n mouseEvent.persist();\n this.props.hoverOnCallback!(data, mouseEvent);\n }\n\n private _hoverOff = (): void => {\n this.props.hoverLeaveCallback!();\n };\n\n private _onBlur = (): void => {\n this.props.onBlurCallback!();\n };\n\n private _redirectToUrl(href: string | undefined): void {\n href ? (window.location.href = href) : '';\n }\n\n private _getAriaLabel = (): string => {\n const point = this.props.data!.data;\n const legend = point.xAxisCalloutData || point.legend;\n const yValue = point.yAxisCalloutData || point.data || 0;\n return point.callOutAccessibilityData?.ariaLabel || (legend ? `${legend}, ` : '') + `${yValue}.`;\n };\n\n private _renderArcLabel = (className: string) => {\n const { arc, data, innerRadius, outerRadius, showLabelsInPercent, totalValue, hideLabels, activeArc } = this.props;\n\n if (\n hideLabels ||\n Math.abs(data!.endAngle - data!.startAngle) < Math.PI / 12 ||\n (activeArc !== data!.data.legend && activeArc !== '')\n ) {\n return null;\n }\n\n const [base, perp] = arc.centroid(data);\n const hyp = Math.sqrt(base * base + perp * perp);\n const labelRadius = Math.max(innerRadius!, outerRadius!) + 2;\n const angle = (data!.startAngle + data!.endAngle) / 2;\n const arcValue = data!.value;\n\n return (\n <text\n x={(hyp === 0 ? 0 : base / hyp) * labelRadius}\n y={(hyp === 0 ? 0 : perp / hyp) * labelRadius}\n textAnchor={angle > Math.PI !== this._isRTL ? 'end' : 'start'}\n dominantBaseline={angle > Math.PI / 2 && angle < (3 * Math.PI) / 2 ? 'hanging' : 'auto'}\n className={className}\n aria-hidden={true}\n >\n {showLabelsInPercent\n ? d3Format('.0%')(totalValue! === 0 ? 0 : arcValue / totalValue!)\n : formatValueWithSIPrefix(arcValue)}\n </text>\n );\n };\n}\n\nfunction _updateChart(newProps: IArcProps): void {\n newProps.arc.innerRadius(newProps.innerRadius);\n newProps.arc.outerRadius(newProps.outerRadius);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Arc.js","sourceRoot":"../src/","sources":["components/DonutChart/Arc/Arc.tsx"],"names":[],"mappings":";;;;IAaA;QAAyB,+BAAqC;QAA9D;YAAA,qEAyJC;YApJQ,WAAK,GAAO,EAAE,CAAC;YAEd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;gCACpB,OAAO,SAAA;6BACR,GACD,CACY,CACf,CACJ,CACC,CACL,CAAC;QACJ,CAAC;QAEO,sBAAQ,GAAhB,UAAiB,IAAqB,EAAE,EAAU;YAChD,IAAI,CAAC,KAAK,CAAC,eAAgB,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACjE,CAAC;QAEO,sBAAQ,GAAhB,UAAiB,IAAqB,EAAE,UAA4C;YAClF,UAAU,CAAC,OAAO,EAAE,CAAC;YACrB,IAAI,CAAC,KAAK,CAAC,eAAgB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAChD,CAAC;QAUO,4BAAc,GAAtB,UAAuB,IAAwB;YAC7C,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5C,CAAC;QA/Ga,gBAAY,GAAuB;YAC/C,GAAG,EAAE,IAAA,cAAK,GAAE;SACb,AAFyB,CAExB;QAsJJ,UAAC;KAAA,AAzJD,CAAyB,KAAK,CAAC,SAAS,GAyJvC;IAED,SAAS,YAAY,CAAC,QAAmB;QACvC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QAC/C,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IACjD,CAAC","sourcesContent":["import * as React from 'react';\nimport { arc as d3Arc } from 'd3-shape';\nimport { classNamesFunction, getId, getRTL } from '@fluentui/react/lib/Utilities';\nimport { getStyles } from './Arc.styles';\nimport { IChartDataPoint } from '../index';\nimport { IArcProps, IArcStyles } from './index';\nimport { format as d3Format } from 'd3-format';\nimport { formatValueWithSIPrefix } from '../../../utilities/index';\n\nexport interface IArcState {\n isCalloutVisible?: boolean;\n}\n\nexport class Arc extends React.Component<IArcProps, IArcState> {\n public static defaultProps: Partial<IArcProps> = {\n arc: d3Arc(),\n };\n\n public state: {} = {};\n\n private currentRef = React.createRef<SVGPathElement>();\n private _isRTL: boolean = getRTL();\n\n public static getDerivedStateFromProps(nextProps: Readonly<IArcProps>): Partial<IArcState> | null {\n _updateChart(nextProps);\n return null;\n }\n\n public updateChart(newProps: IArcProps): void {\n _updateChart(newProps);\n }\n\n public render(): JSX.Element {\n const { arc, href, focusedArcId } = this.props;\n const getClassNames = classNamesFunction<IArcProps, IArcStyles>();\n const classNames = getClassNames(getStyles, {\n color: this.props.color,\n href: href!,\n theme: this.props.theme!,\n nextColor: this.props.nextColor,\n });\n const id = this.props.uniqText! + this.props.data!.data.legend!.replace(/\\s+/, '') + this.props.data!.data.data;\n const opacity: number =\n this.props.activeArc === this.props.data!.data.legend || this.props.activeArc === '' ? 1 : 0.1;\n\n const startAngle = this.props.data?.startAngle ?? 0;\n const endAngle = (this.props.data?.endAngle ?? 0) - startAngle;\n const cornerRadius = this.props.roundCorners ? 3 : 0;\n\n const clipId = getId('Arc_clip') + `${this.props.color}_${this.props.nextColor}`;\n\n return (\n <g ref={this.currentRef}>\n {!!focusedArcId && focusedArcId === id && (\n <path\n id={id + 'focusRing'}\n d={arc.cornerRadius(cornerRadius)(this.props.focusData)}\n className={classNames.focusRing}\n />\n )}\n\n <path\n id={id}\n d={arc.cornerRadius(cornerRadius)(this.props.data)}\n onFocus={this._onFocus.bind(this, this.props.data!.data, id)}\n className={classNames.root}\n fill={this.props.enableGradient ? 'transparent' : this.props.color}\n data-is-focusable={this.props.activeArc === this.props.data!.data.legend || this.props.activeArc === ''}\n onMouseOver={this._hoverOn.bind(this, this.props.data!.data)}\n onMouseMove={this._hoverOn.bind(this, this.props.data!.data)}\n onMouseLeave={this._hoverOff}\n onBlur={this._onBlur}\n opacity={opacity}\n onClick={href ? this._redirectToUrl.bind(this, href) : this.props.data?.data.onClick}\n aria-label={this._getAriaLabel()}\n role=\"img\"\n />\n {this._renderArcLabel(classNames.arcLabel)}\n\n {this.props.enableGradient && (\n <>\n <clipPath id={clipId}>\n <path d={arc.cornerRadius(cornerRadius)(this.props.data)} />\n </clipPath>\n <foreignObject x=\"-50%\" y=\"-50%\" width=\"100%\" height=\"100%\" clipPath={`url(#${clipId})`}>\n <div\n style={{\n width: '100%',\n height: '100%',\n background: this.props.enableGradient\n ? `conic-gradient(\n from ${startAngle}rad,\n ${this.props.color},\n ${this.props.nextColor} ${endAngle}rad\n )`\n : this.props.color,\n opacity,\n }}\n />\n </foreignObject>\n </>\n )}\n </g>\n );\n }\n\n private _onFocus(data: IChartDataPoint, id: string): void {\n this.props.onFocusCallback!(data, id, this.currentRef.current);\n }\n\n private _hoverOn(data: IChartDataPoint, mouseEvent: React.MouseEvent<SVGPathElement>): void {\n mouseEvent.persist();\n this.props.hoverOnCallback!(data, mouseEvent);\n }\n\n private _hoverOff = (): void => {\n this.props.hoverLeaveCallback!();\n };\n\n private _onBlur = (): void => {\n this.props.onBlurCallback!();\n };\n\n private _redirectToUrl(href: string | undefined): void {\n href ? (window.location.href = href) : '';\n }\n\n private _getAriaLabel = (): string => {\n const point = this.props.data!.data;\n const legend = point.xAxisCalloutData || point.legend;\n const yValue = point.yAxisCalloutData || point.data || 0;\n return point.callOutAccessibilityData?.ariaLabel || (legend ? `${legend}, ` : '') + `${yValue}.`;\n };\n\n private _renderArcLabel = (className: string) => {\n const { arc, data, innerRadius, outerRadius, showLabelsInPercent, totalValue, hideLabels, activeArc } = this.props;\n\n if (\n hideLabels ||\n Math.abs(data!.endAngle - data!.startAngle) < Math.PI / 12 ||\n (activeArc !== data!.data.legend && activeArc !== '')\n ) {\n return null;\n }\n\n const [base, perp] = arc.centroid(data);\n const hyp = Math.sqrt(base * base + perp * perp);\n const labelRadius = Math.max(innerRadius!, outerRadius!) + 2;\n const angle = (data!.startAngle + data!.endAngle) / 2;\n const arcValue = data!.value;\n\n return (\n <text\n x={(hyp === 0 ? 0 : base / hyp) * labelRadius}\n y={(hyp === 0 ? 0 : perp / hyp) * labelRadius}\n textAnchor={angle > Math.PI !== this._isRTL ? 'end' : 'start'}\n dominantBaseline={angle > Math.PI / 2 && angle < (3 * Math.PI) / 2 ? 'hanging' : 'auto'}\n className={className}\n aria-hidden={true}\n >\n {showLabelsInPercent\n ? d3Format('.0%')(totalValue! === 0 ? 0 : arcValue / totalValue!)\n : formatValueWithSIPrefix(arcValue)}\n </text>\n );\n };\n}\n\nfunction _updateChart(newProps: IArcProps): void {\n newProps.arc.innerRadius(newProps.innerRadius);\n newProps.arc.outerRadius(newProps.outerRadius);\n}\n"]}
|
|
@@ -81,6 +81,21 @@ export interface IArcProps {
|
|
|
81
81
|
* Prop to hide the arc labels
|
|
82
82
|
*/
|
|
83
83
|
hideLabels?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Prop to enable the gradient in the arc
|
|
86
|
+
* @default false
|
|
87
|
+
*/
|
|
88
|
+
enableGradient?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Prop to enable the round corners in the chart
|
|
91
|
+
* @default false
|
|
92
|
+
*/
|
|
93
|
+
roundCorners?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Next color stop for the gradient
|
|
96
|
+
* [Only used when enableGradient is True].
|
|
97
|
+
*/
|
|
98
|
+
nextColor: string;
|
|
84
99
|
}
|
|
85
100
|
export interface IArcData {
|
|
86
101
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Arc.types.js","sourceRoot":"../src/","sources":["components/DonutChart/Arc/Arc.types.ts"],"names":[],"mappings":"","sourcesContent":["import { IStyle, ITheme } from '@fluentui/react/lib/Styling';\nimport { IChartDataPoint } from '../index';\nexport interface IArcProps {\n /**\n * Theme\n */\n theme: ITheme;\n /**\n * Data to render in the Arc.\n */\n data?: IArcData;\n\n /**\n * Data to render focused Arc\n */\n focusData?: IArcData;\n\n /**\n * id of the focused arc\n */\n focusedArcId?: string;\n /**\n * shape for Arc.\n */\n /* eslint-disable @typescript-eslint/no-explicit-any */\n arc?: any;\n\n /**\n * innerRadius of the Arc.\n */\n innerRadius?: number;\n\n /**\n * outerRadius of the Arc.\n */\n outerRadius?: number;\n\n /**\n * Color for the Arc.\n */\n color: string;\n\n /**\n * Defines the function that is executed upon hovering over the legend\n */\n hoverOnCallback?: Function;\n\n /**\n * Defines the function that is executed upon hovering over the legend\n */\n onFocusCallback?: Function;\n\n /**\n * Defines the function that is executed upon hovering Leave the legend\n */\n onBlurCallback?: Function;\n\n /**\n * Defines the function that is executed upon hovering Leave the legend\n */\n hoverLeaveCallback?: Function;\n\n /**\n * Uniq string for chart\n */\n uniqText?: string;\n\n /**\n * string for callout id\n */\n calloutId?: string;\n\n /**\n * Active Arc for chart\n */\n activeArc?: string;\n\n /**\n * internal prop for href\n */\n href?: string;\n\n /**\n * props for inside donut value\n */\n valueInsideDonut?: string | number;\n\n /**\n * Prop to show the arc labels in percentage format\n */\n showLabelsInPercent?: boolean;\n\n /**\n * Prop used to define the sum of all arc values\n */\n totalValue?: number;\n\n /**\n * Prop to hide the arc labels\n */\n hideLabels?: boolean;\n}\n\nexport interface IArcData {\n /**\n * Data to render in the chart for individual arc.\n */\n data: IChartDataPoint;\n /**\n * endAngle of the Arc\n */\n endAngle: number;\n /**\n * index of the Arc\n */\n index: number;\n /**\n * padAngle of the Arc\n */\n padAngle: number;\n /**\n * startAngle of the Arc\n */\n startAngle: number;\n /**\n * value of the Arc\n */\n value: number;\n}\n\nexport interface IArcStyles {\n /**\n * Style set for the card header component root\n */\n root: IStyle;\n\n /**\n * styles for the focus\n */\n focusRing: IStyle;\n\n /**\n * Style for the arc labels\n */\n arcLabel: IStyle;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Arc.types.js","sourceRoot":"../src/","sources":["components/DonutChart/Arc/Arc.types.ts"],"names":[],"mappings":"","sourcesContent":["import { IStyle, ITheme } from '@fluentui/react/lib/Styling';\nimport { IChartDataPoint } from '../index';\nexport interface IArcProps {\n /**\n * Theme\n */\n theme: ITheme;\n /**\n * Data to render in the Arc.\n */\n data?: IArcData;\n\n /**\n * Data to render focused Arc\n */\n focusData?: IArcData;\n\n /**\n * id of the focused arc\n */\n focusedArcId?: string;\n /**\n * shape for Arc.\n */\n /* eslint-disable @typescript-eslint/no-explicit-any */\n arc?: any;\n\n /**\n * innerRadius of the Arc.\n */\n innerRadius?: number;\n\n /**\n * outerRadius of the Arc.\n */\n outerRadius?: number;\n\n /**\n * Color for the Arc.\n */\n color: string;\n\n /**\n * Defines the function that is executed upon hovering over the legend\n */\n hoverOnCallback?: Function;\n\n /**\n * Defines the function that is executed upon hovering over the legend\n */\n onFocusCallback?: Function;\n\n /**\n * Defines the function that is executed upon hovering Leave the legend\n */\n onBlurCallback?: Function;\n\n /**\n * Defines the function that is executed upon hovering Leave the legend\n */\n hoverLeaveCallback?: Function;\n\n /**\n * Uniq string for chart\n */\n uniqText?: string;\n\n /**\n * string for callout id\n */\n calloutId?: string;\n\n /**\n * Active Arc for chart\n */\n activeArc?: string;\n\n /**\n * internal prop for href\n */\n href?: string;\n\n /**\n * props for inside donut value\n */\n valueInsideDonut?: string | number;\n\n /**\n * Prop to show the arc labels in percentage format\n */\n showLabelsInPercent?: boolean;\n\n /**\n * Prop used to define the sum of all arc values\n */\n totalValue?: number;\n\n /**\n * Prop to hide the arc labels\n */\n hideLabels?: boolean;\n\n /**\n * Prop to enable the gradient in the arc\n * @default false\n */\n enableGradient?: boolean;\n\n /**\n * Prop to enable the round corners in the chart\n * @default false\n */\n roundCorners?: boolean;\n\n /**\n * Next color stop for the gradient\n * [Only used when enableGradient is True].\n */\n nextColor: string;\n}\n\nexport interface IArcData {\n /**\n * Data to render in the chart for individual arc.\n */\n data: IChartDataPoint;\n /**\n * endAngle of the Arc\n */\n endAngle: number;\n /**\n * index of the Arc\n */\n index: number;\n /**\n * padAngle of the Arc\n */\n padAngle: number;\n /**\n * startAngle of the Arc\n */\n startAngle: number;\n /**\n * value of the Arc\n */\n value: number;\n}\n\nexport interface IArcStyles {\n /**\n * Style set for the card header component root\n */\n root: IStyle;\n\n /**\n * styles for the focus\n */\n focusRing: IStyle;\n\n /**\n * Style for the arc labels\n */\n arcLabel: IStyle;\n}\n"]}
|
|
@@ -29,15 +29,21 @@ define(["require", "exports", "tslib", "react", "@fluentui/react/lib/Utilities",
|
|
|
29
29
|
});
|
|
30
30
|
};
|
|
31
31
|
_this._hoverCallback = function (data, e) {
|
|
32
|
+
var _a, _b, _c, _d;
|
|
32
33
|
if (_this._calloutAnchorPoint !== data) {
|
|
33
34
|
_this._calloutAnchorPoint = data;
|
|
34
35
|
_this._currentHoverElement = e;
|
|
36
|
+
var color = data.color;
|
|
37
|
+
if (_this.props.enableGradient) {
|
|
38
|
+
var pointIndex = Math.max(((_b = (_a = _this.props.data) === null || _a === void 0 ? void 0 : _a.chartData) === null || _b === void 0 ? void 0 : _b.findIndex(function (item) { return item.legend === data.legend; })) || 0, 0);
|
|
39
|
+
color = ((_c = data.gradient) === null || _c === void 0 ? void 0 : _c[0]) || (0, index_3.getNextGradient)(pointIndex, 0, (_d = _this.props.theme) === null || _d === void 0 ? void 0 : _d.isInverted)[0];
|
|
40
|
+
}
|
|
35
41
|
_this.setState({
|
|
36
42
|
/** Show the callout if highlighted arc is hovered and Hide it if unhighlighted arc is hovered */
|
|
37
43
|
showHover: _this.state.selectedLegend === '' || _this.state.selectedLegend === data.legend,
|
|
38
44
|
value: data.data.toString(),
|
|
39
45
|
legend: data.legend,
|
|
40
|
-
color:
|
|
46
|
+
color: color,
|
|
41
47
|
xCalloutValue: data.xAxisCalloutData,
|
|
42
48
|
yCalloutValue: data.yAxisCalloutData,
|
|
43
49
|
dataPointCalloutProps: data,
|
|
@@ -130,7 +136,7 @@ define(["require", "exports", "tslib", "react", "@fluentui/react/lib/Utilities",
|
|
|
130
136
|
React.createElement(react_focus_1.FocusZone, { direction: react_focus_1.FocusZoneDirection.horizontal, handleTabKey: react_focus_1.FocusZoneTabbableElements.all },
|
|
131
137
|
React.createElement("div", null,
|
|
132
138
|
React.createElement("svg", { className: this._classNames.chart, "aria-label": data === null || data === void 0 ? void 0 : data.chartTitle, ref: function (node) { return _this._setViewBox(node); } },
|
|
133
|
-
React.createElement(index_2.Pie, { width: this.state._width, height: this.state._height, outerRadius: outerRadius, innerRadius: this.props.innerRadius, data: chartData, onFocusCallback: this._focusCallback, hoverOnCallback: this._hoverCallback, hoverLeaveCallback: this._hoverLeave, uniqText: this._uniqText, onBlurCallback: this._onBlur, activeArc: this._getHighlightedLegend(), focusedArcId: this.state.focusedArcId || '', href: this.props.href, calloutId: this._calloutId, valueInsideDonut: this._toLocaleString(valueInsideDonut), theme: this.props.theme, showLabelsInPercent: this.props.showLabelsInPercent, hideLabels: this.props.hideLabels })))),
|
|
139
|
+
React.createElement(index_2.Pie, { width: this.state._width, height: this.state._height, outerRadius: outerRadius, innerRadius: this.props.innerRadius, data: chartData, enableGradient: this.props.enableGradient, roundCorners: this.props.roundCorners, onFocusCallback: this._focusCallback, hoverOnCallback: this._hoverCallback, hoverLeaveCallback: this._hoverLeave, uniqText: this._uniqText, onBlurCallback: this._onBlur, activeArc: this._getHighlightedLegend(), focusedArcId: this.state.focusedArcId || '', href: this.props.href, calloutId: this._calloutId, valueInsideDonut: this._toLocaleString(valueInsideDonut), theme: this.props.theme, showLabelsInPercent: this.props.showLabelsInPercent, hideLabels: this.props.hideLabels })))),
|
|
134
140
|
React.createElement(Callout_1.Callout, tslib_1.__assign({ target: this._currentHoverElement, alignTargetEdge: true, isBeakVisible: false, directionalHint: Callout_1.DirectionalHint.topAutoEdge, gapSpace: 15, hidden: !(!this.props.hideTooltip && this.state.showHover), id: this._calloutId, onDismiss: this._closeCallout, preventDismissOnLostFocus: true,
|
|
135
141
|
/** Keep the callout updated with details of focused/hovered arc */
|
|
136
142
|
shouldUpdateWhenHidden: true }, this.props.calloutProps, (0, index_3.getAccessibleDataObject)(this.state.callOutAccessibilityData, 'text', false)), this.props.onRenderCalloutPerDataPoint ? (this.props.onRenderCalloutPerDataPoint(this.state.dataPointCalloutProps)) : (React.createElement(index_1.ChartHoverCard, { Legend: this.state.xCalloutValue ? this.state.xCalloutValue : this.state.legend, YValue: this.state.yCalloutValue ? this.state.yCalloutValue : this.state.value, color: this.state.color, culture: this.props.culture }))),
|
|
@@ -164,7 +170,10 @@ define(["require", "exports", "tslib", "react", "@fluentui/react/lib/Utilities",
|
|
|
164
170
|
DonutChartBase.prototype._createLegends = function (chartData) {
|
|
165
171
|
var _this = this;
|
|
166
172
|
var legendDataItems = chartData.map(function (point, index) {
|
|
167
|
-
var
|
|
173
|
+
var _a, _b;
|
|
174
|
+
var color = _this.props.enableGradient
|
|
175
|
+
? ((_a = point.gradient) === null || _a === void 0 ? void 0 : _a[0]) || (0, index_3.getNextGradient)(index, 0, (_b = _this.props.theme) === null || _b === void 0 ? void 0 : _b.isInverted)[0]
|
|
176
|
+
: point.color;
|
|
168
177
|
// mapping data to the format Legends component needs
|
|
169
178
|
var legend = {
|
|
170
179
|
title: point.legend,
|