@fluentui/react-charts 9.0.0 → 9.0.2
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.md +33 -2
- package/dist/index.d.ts +463 -36
- package/lib/GaugeChart.js +1 -0
- package/lib/GaugeChart.js.map +1 -0
- package/lib/GroupedVerticalBarChart.js +1 -0
- package/lib/GroupedVerticalBarChart.js.map +1 -0
- package/lib/ScatterChart.js +1 -0
- package/lib/ScatterChart.js.map +1 -0
- package/lib/components/GaugeChart/GaugeChart.js +589 -0
- package/lib/components/GaugeChart/GaugeChart.js.map +1 -0
- package/lib/components/GaugeChart/GaugeChart.types.js +4 -0
- package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -0
- package/lib/components/GaugeChart/index.js +3 -0
- package/lib/components/GaugeChart/index.js.map +1 -0
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +174 -0
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +492 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js +4 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -0
- package/lib/components/GroupedVerticalBarChart/index.js +3 -0
- package/lib/components/GroupedVerticalBarChart/index.js.map +1 -0
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +90 -0
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -0
- package/lib/components/Legends/Legends.types.js.map +1 -1
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js +478 -0
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -0
- package/lib/components/ScatterChart/ScatterChart.types.js +4 -0
- package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -0
- package/lib/components/ScatterChart/index.js +3 -0
- package/lib/components/ScatterChart/index.js.map +1 -0
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js +65 -0
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -0
- package/lib/components/Sparkline/Sparkline.js.map +1 -1
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -1
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/utilities.js +123 -5
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-commonjs/GaugeChart.js +6 -0
- package/lib-commonjs/GaugeChart.js.map +1 -0
- package/lib-commonjs/GroupedVerticalBarChart.js +6 -0
- package/lib-commonjs/GroupedVerticalBarChart.js.map +1 -0
- package/lib-commonjs/ScatterChart.js +6 -0
- package/lib-commonjs/ScatterChart.js.map +1 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.js +618 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.types.js +7 -0
- package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -0
- package/lib-commonjs/components/GaugeChart/index.js +8 -0
- package/lib-commonjs/components/GaugeChart/index.js.map +1 -0
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +252 -0
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +498 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js +7 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/index.js +8 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/index.js.map +1 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +139 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/Legends/Legends.types.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +484 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js +7 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -0
- package/lib-commonjs/components/ScatterChart/index.js +8 -0
- package/lib-commonjs/components/ScatterChart/index.js.map +1 -0
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +96 -0
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/Sparkline/Sparkline.js.map +1 -1
- package/lib-commonjs/index.js +3 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +115 -5
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +9 -9
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
scatterChartClassNames: function() {
|
|
13
|
+
return scatterChartClassNames;
|
|
14
|
+
},
|
|
15
|
+
useScatterChartStyles_unstable: function() {
|
|
16
|
+
return useScatterChartStyles_unstable;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _react = require("@griffel/react");
|
|
20
|
+
const scatterChartClassNames = {
|
|
21
|
+
tooltip: 'fui-line__tooltip',
|
|
22
|
+
root: 'fui-line__root',
|
|
23
|
+
xAxis: 'fui-line__xAxis',
|
|
24
|
+
yAxis: 'fui-line__yAxis',
|
|
25
|
+
legendContainer: 'fui-line__legendContainer',
|
|
26
|
+
hover: 'fui-line__hover',
|
|
27
|
+
calloutContentRoot: 'fui-line__calloutContentRoot',
|
|
28
|
+
calloutContentX: 'fui-line__calloutContentX',
|
|
29
|
+
calloutContentY: 'fui-line__calloutContentY',
|
|
30
|
+
descriptionMessage: 'fui-line__descriptionMessage',
|
|
31
|
+
calloutDateTimeContainer: 'fui-line__calloutDateTimeContainer',
|
|
32
|
+
calloutInfoContainer: 'fui-line__calloutInfoContainer',
|
|
33
|
+
calloutBlockContainer: 'fui-line__calloutBlockContainer',
|
|
34
|
+
calloutlegendText: 'fui-line__calloutLegendText',
|
|
35
|
+
axisTitle: 'fui-line__axisTitle',
|
|
36
|
+
chartTitle: 'fui-line__chartTitle',
|
|
37
|
+
opacityChangeOnHover: 'fui-line__opacityChangeOnHover',
|
|
38
|
+
shapeStyles: 'fui-line__shapeStyles',
|
|
39
|
+
chartWrapper: 'fui-line__chartWrapper',
|
|
40
|
+
calloutBlockContainertoDrawShapefalse: '',
|
|
41
|
+
calloutBlockContainertoDrawShapetrue: ''
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Base Styles
|
|
45
|
+
*/ const useStyles = /*#__PURE__*/ (0, _react.__styles)({
|
|
46
|
+
tooltip: {
|
|
47
|
+
mc9l5x: "f22iagw",
|
|
48
|
+
Beiy3e4: "f1vx9l62",
|
|
49
|
+
z8tnut: "f17mpqex",
|
|
50
|
+
z189sj: [
|
|
51
|
+
"f1vdfbxk",
|
|
52
|
+
"f1f5gg8d"
|
|
53
|
+
],
|
|
54
|
+
Byoj8tv: "fdvome7",
|
|
55
|
+
uwmqm3: [
|
|
56
|
+
"f1f5gg8d",
|
|
57
|
+
"f1vdfbxk"
|
|
58
|
+
],
|
|
59
|
+
qhf8xq: "f1euv43f",
|
|
60
|
+
fsow6f: "f17mccla",
|
|
61
|
+
Bhzewxz: "fr6rvge",
|
|
62
|
+
Bkfmm31: "f5q6cfr",
|
|
63
|
+
Beyfa6y: 0,
|
|
64
|
+
Bbmb7ep: 0,
|
|
65
|
+
Btl43ni: 0,
|
|
66
|
+
B7oj6ja: 0,
|
|
67
|
+
Dimara: "fq9zq91",
|
|
68
|
+
Bkecrkj: "f1aehjj5"
|
|
69
|
+
}
|
|
70
|
+
}, {
|
|
71
|
+
d: [
|
|
72
|
+
".f22iagw{display:flex;}",
|
|
73
|
+
".f1vx9l62{flex-direction:column;}",
|
|
74
|
+
".f17mpqex{padding-top:var(--spacingHorizontalS);}",
|
|
75
|
+
".f1vdfbxk{padding-right:var(--spacingHorizontalS);}",
|
|
76
|
+
".f1f5gg8d{padding-left:var(--spacingHorizontalS);}",
|
|
77
|
+
".fdvome7{padding-bottom:var(--spacingHorizontalS);}",
|
|
78
|
+
".f1euv43f{position:absolute;}",
|
|
79
|
+
".f17mccla{text-align:center;}",
|
|
80
|
+
".fr6rvge{top:var(--spacingVerticalNone);}",
|
|
81
|
+
".f5q6cfr{fill:var(--colorNeutralBackground1);}",
|
|
82
|
+
[
|
|
83
|
+
".fq9zq91{border-radius:var(--borderRadiusSmall);}",
|
|
84
|
+
{
|
|
85
|
+
p: -1
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
".f1aehjj5{pointer-events:none;}"
|
|
89
|
+
]
|
|
90
|
+
});
|
|
91
|
+
const useScatterChartStyles_unstable = (props)=>{
|
|
92
|
+
const baseStyles = useStyles();
|
|
93
|
+
return {
|
|
94
|
+
tooltip: (0, _react.mergeClasses)(scatterChartClassNames.tooltip, baseStyles.tooltip /*props.styles?.tooltip*/ )
|
|
95
|
+
};
|
|
96
|
+
}; //# sourceMappingURL=useScatterChartStyles.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useScatterChartStyles.styles.js"],"sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\n/**\n * @internal\n */ export const scatterChartClassNames = {\n tooltip: 'fui-line__tooltip',\n root: 'fui-line__root',\n xAxis: 'fui-line__xAxis',\n yAxis: 'fui-line__yAxis',\n legendContainer: 'fui-line__legendContainer',\n hover: 'fui-line__hover',\n calloutContentRoot: 'fui-line__calloutContentRoot',\n calloutContentX: 'fui-line__calloutContentX',\n calloutContentY: 'fui-line__calloutContentY',\n descriptionMessage: 'fui-line__descriptionMessage',\n calloutDateTimeContainer: 'fui-line__calloutDateTimeContainer',\n calloutInfoContainer: 'fui-line__calloutInfoContainer',\n calloutBlockContainer: 'fui-line__calloutBlockContainer',\n calloutlegendText: 'fui-line__calloutLegendText',\n axisTitle: 'fui-line__axisTitle',\n chartTitle: 'fui-line__chartTitle',\n opacityChangeOnHover: 'fui-line__opacityChangeOnHover',\n shapeStyles: 'fui-line__shapeStyles',\n chartWrapper: 'fui-line__chartWrapper',\n calloutBlockContainertoDrawShapefalse: '',\n calloutBlockContainertoDrawShapetrue: ''\n};\n/**\n * Base Styles\n */ const useStyles = makeStyles({\n tooltip: {\n display: 'flex',\n flexDirection: 'column',\n ...shorthands.padding(tokens.spacingHorizontalS),\n position: 'absolute',\n textAlign: 'center',\n top: tokens.spacingVerticalNone,\n fill: tokens.colorNeutralBackground1,\n borderRadius: tokens.borderRadiusSmall,\n pointerEvents: 'none'\n }\n});\n/**\n * Apply styling to the Carousel slots based on the state\n */ export const useScatterChartStyles_unstable = (props)=>{\n const baseStyles = useStyles();\n return {\n tooltip: mergeClasses(scatterChartClassNames.tooltip, baseStyles.tooltip /*props.styles?.tooltip*/ )\n };\n};\n"],"names":["scatterChartClassNames","useScatterChartStyles_unstable","tooltip","root","xAxis","yAxis","legendContainer","hover","calloutContentRoot","calloutContentX","calloutContentY","descriptionMessage","calloutDateTimeContainer","calloutInfoContainer","calloutBlockContainer","calloutlegendText","axisTitle","chartTitle","opacityChangeOnHover","shapeStyles","chartWrapper","calloutBlockContainertoDrawShapefalse","calloutBlockContainertoDrawShapetrue","useStyles","__styles","mc9l5x","Beiy3e4","z8tnut","z189sj","Byoj8tv","uwmqm3","qhf8xq","fsow6f","Bhzewxz","Bkfmm31","Beyfa6y","Bbmb7ep","Btl43ni","B7oj6ja","Dimara","Bkecrkj","d","p","props","baseStyles","mergeClasses"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAIiBA,sBAAsB;eAAtBA;;IAwCAC,8BAA8B;eAA9BA;;;uBA5CoC;AAI1C,MAAMD,yBAAyB;IACtCE,SAAS;IACTC,MAAM;IACNC,OAAO;IACPC,OAAO;IACPC,iBAAiB;IACjBC,OAAO;IACPC,oBAAoB;IACpBC,iBAAiB;IACjBC,iBAAiB;IACjBC,oBAAoB;IACpBC,0BAA0B;IAC1BC,sBAAsB;IACtBC,uBAAuB;IACvBC,mBAAmB;IACnBC,WAAW;IACXC,YAAY;IACZC,sBAAsB;IACtBC,aAAa;IACbC,cAAc;IACdC,uCAAuC;IACvCC,sCAAsC;AAC1C;AACA;;CAEA,GAAI,MAAMC,YAAS,WAAA,GAAGC,IAAAA,eAAA,EAAA;IAAAtB,SAAA;QAAAuB,QAAA;QAAAC,SAAA;QAAAC,QAAA;QAAAC,QAAA;YAAA;YAAA;SAAA;QAAAC,SAAA;QAAAC,QAAA;YAAA;YAAA;SAAA;QAAAC,QAAA;QAAAC,QAAA;QAAAC,SAAA;QAAAC,SAAA;QAAAC,SAAA;QAAAC,SAAA;QAAAC,SAAA;QAAAC,SAAA;QAAAC,QAAA;QAAAC,SAAA;IAAA;AAAA,GAAA;IAAAC,GAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;YAAA;YAAA;gBAAAC,GAAA,CAAA;YAAA;SAAA;QAAA;KAAA;AAAA;AAeX,MAAMzC,iCAAkC0C,CAAAA;IAC/C,MAAMC,aAAarB;IACnB,OAAO;QACHrB,SAAS2C,IAAAA,mBAAY,EAAC7C,uBAAuBE,OAAO,EAAE0C,WAAW1C,OAAO,CAAC,uBAAA;IAC7E;AACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Sparkline.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useSparklineStyles } from './useSparklineStyles.styles';\nimport { scaleLinear as d3ScaleLinear } from 'd3-scale';\nimport { area as d3Area, line as d3Line, curveLinear as d3curveLinear } from 'd3-shape';\nimport { max as d3Max, extent as d3Extent } from 'd3-array';\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { LineChartDataPoint } from '../../types/DataPoint';\nimport { useRtl } from '../../utilities/index';\nimport { SparklineProps } from '../../index';\n\n/**\n * Sparkline is the context wrapper and container for all Sparkline content/controls,\n * It has no direct style or slot opinions.\n *\n * Sparkline also provides API interfaces for callbacks that will occur on navigation events.\n */\nexport const Sparkline: React.FunctionComponent<SparklineProps> = React.forwardRef<HTMLDivElement, SparklineProps>(\n (props, forwardedRef) => {\n let margin = {\n top: 2,\n right: 0,\n bottom: 0,\n left: 0,\n };\n let x: any;\n let y: any;\n let _emptyChartId: string = '_SparklineChart_empty';\n let _isRTL: boolean = useRtl();\n const [points, setPoints] = React.useState<LineChartDataPoint[]>([]);\n const width = 80;\n const height = 20;\n const valueTextWidth = 80;\n\n const line = React.useMemo(() => {\n return d3Line<LineChartDataPoint>()\n .x((d: LineChartDataPoint) => x(d.x))\n .y((d: LineChartDataPoint) => y(d.y))\n .curve(d3curveLinear);\n }, [x, y]);\n\n const area = React.useMemo(() => {\n return d3Area<LineChartDataPoint>()\n .x((d: LineChartDataPoint) => x(d.x))\n .y0(height)\n .y1((d: LineChartDataPoint) => y(d.y))\n .curve(d3curveLinear);\n }, [height, x, y]);\n\n React.useEffect(() => {\n if (!_isChartEmpty()) {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const _points = props.data!.lineChartData![0].data;\n\n /* eslint-disable @typescript-eslint/no-explicit-any */\n const [xMin, xMax] = d3Extent(_points, (d: any) => d.x);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n x = d3ScaleLinear()\n .domain([xMin, xMax])\n .range([margin.left!, width - margin.right!]);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n y = d3ScaleLinear()\n /* eslint-disable @typescript-eslint/no-explicit-any */\n .domain([0, d3Max(_points, (d: any) => d.y)])\n .range([height - margin.bottom!, margin.top!]);\n\n setPoints(_points);\n }\n }, []);\n\n const { data } = props;\n function _isChartEmpty(): boolean {\n return !(\n data &&\n data.lineChartData &&\n data.lineChartData.length > 0 &&\n data.lineChartData.filter(item => item.data.length === 0).length === 0\n );\n }\n function drawSparkline() {\n if (!line || !area) {\n return null;\n }\n return (\n <>\n <path\n className=\"line\"\n d={line(points)!}\n fill={'transparent'}\n opacity={1}\n strokeWidth={2}\n stroke={data!.lineChartData![0].color!}\n />\n <path\n className=\"area\"\n d={area(points)!}\n opacity={1}\n fillOpacity={0.2}\n fill={data!.lineChartData![0].color!}\n role=\"img\"\n aria-hidden\n />\n </>\n );\n }\n\n const classes = useSparklineStyles(props);\n const focusAttributes = useFocusableGroup();\n return !_isChartEmpty() ? (\n <div className={classes.inlineBlock} {...focusAttributes}>\n {width >= 50 && height >= 16 ? (\n <svg\n width={width}\n height={height}\n aria-label={`Sparkline with label ${data!.lineChartData![0].legend!}`}\n tabIndex={0}\n >\n {points ? drawSparkline() : null}\n </svg>\n ) : (\n <></>\n )}\n {props.showLegend && props.data!.lineChartData![0].legend ? (\n <svg width={valueTextWidth} height={height}>\n <text x=\"0%\" textAnchor={_isRTL ? 'end' : 'start'} dx={8} y=\"100%\" dy={-5} className={classes.valueText}>\n {props.data!.lineChartData![0].legend!}\n </text>\n </svg>\n ) : (\n <></>\n )}\n </div>\n ) : (\n <div id={_emptyChartId} role={'alert'} style={{ opacity: '0' }} aria-label={'Graph has no data to display'} />\n );\n },\n);\nSparkline.displayName = 'Sparkline';\n"],"names":["Sparkline","React","forwardRef","props","forwardedRef","margin","top","right","bottom","left","x","y","_emptyChartId","_isRTL","useRtl","points","setPoints","useState","width","height","valueTextWidth","line","useMemo","d3Line","d","curve","d3curveLinear","area","d3Area","y0","y1","useEffect","_isChartEmpty","_points","data","lineChartData","xMin","xMax","d3Extent","d3ScaleLinear","domain","range","d3Max","length","filter","item","drawSparkline","createElement","Fragment","path","className","fill","opacity","strokeWidth","stroke","color","fillOpacity","role","aria-hidden","classes","useSparklineStyles","focusAttributes","useFocusableGroup","div","inlineBlock","svg","aria-label","legend","tabIndex","showLegend","text","textAnchor","dx","dy","valueText","id","style","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAgBaA;;;eAAAA;;;;iEAhBU;0CACY;yBACU;yBACgC;yBAC5B;8BACf;uBAEX;AAShB,MAAMA,YAAAA,WAAAA,GAAqDC,OAAMC,UAAU,CAChF,CAACC,OAAOC;IACN,IAAIC,SAAS;QACXC,KAAK;QACLC,OAAO;QACPC,QAAQ;QACRC,MAAM;IACR;IACA,IAAIC;IACJ,IAAIC;IACJ,IAAIC,gBAAwB;IAC5B,IAAIC,SAAkBC,IAAAA,aAAAA;IACtB,MAAM,CAACC,QAAQC,UAAU,GAAGf,OAAMgB,QAAQ,CAAuB,EAAE;IACnE,MAAMC,QAAQ;IACd,MAAMC,SAAS;IACf,MAAMC,iBAAiB;IAEvB,MAAMC,OAAOpB,OAAMqB,OAAO,CAAC;QACzB,OAAOC,IAAAA,aAAAA,IACJb,CAAC,CAAC,CAACc,IAA0Bd,EAAEc,EAAEd,CAAC,GAClCC,CAAC,CAAC,CAACa,IAA0Bb,EAAEa,EAAEb,CAAC,GAClCc,KAA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AY1D,SAAS,QAAQ;QAAS2D,IAAI;QAAG7D,GAAE;QAAO8D,IAAI,CAAC;QAAGvB,WAAWS,QAAQe,SAAS;OACpGvE,MAAM+B,IAAI,CAAEC,aAAa,CAAE,EAAE,CAACgC,MAAM,KAAA,WAAA,GAIzClE,OAAA8C,aAAA,CAAA9C,OAAA+C,QAAA,EAAA,SAAA,WAAA,GAIJ/C,OAAA8C,aAAA,CAACgB,OAAAA;QAAIY,IAAI/D;QAAe6C,MAAM;QAASmB,OAAO;YAAExB,SAAS;QAAI;QAAGc,cAAY;;AAEhF;AAEFlE,UAAU6E,WAAW,GAAG"}
|
|
1
|
+
{"version":3,"sources":["Sparkline.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useSparklineStyles } from './useSparklineStyles.styles';\nimport { scaleLinear as d3ScaleLinear } from 'd3-scale';\nimport { area as d3Area, line as d3Line, curveLinear as d3curveLinear } from 'd3-shape';\nimport { max as d3Max, extent as d3Extent } from 'd3-array';\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { LineChartDataPoint } from '../../types/DataPoint';\nimport { useRtl } from '../../utilities/index';\nimport { SparklineProps } from '../../index';\n\n/**\n * Sparkline is the context wrapper and container for all Sparkline content/controls,\n * It has no direct style or slot opinions.\n *\n * Sparkline also provides API interfaces for callbacks that will occur on navigation events.\n */\nexport const Sparkline: React.FunctionComponent<SparklineProps> = React.forwardRef<HTMLDivElement, SparklineProps>(\n (props, forwardedRef) => {\n let margin = {\n top: 2,\n right: 0,\n bottom: 0,\n left: 0,\n };\n let x: any;\n let y: any;\n let _emptyChartId: string = '_SparklineChart_empty';\n let _isRTL: boolean = useRtl();\n const [points, setPoints] = React.useState<LineChartDataPoint[]>([]);\n const width = 80;\n const height = 20;\n const valueTextWidth = 80;\n\n const line = React.useMemo(() => {\n return d3Line<LineChartDataPoint>()\n .x((d: LineChartDataPoint) => x(d.x))\n .y((d: LineChartDataPoint) => y(d.y))\n .curve(d3curveLinear);\n }, [x, y]);\n\n const area = React.useMemo(() => {\n return d3Area<LineChartDataPoint>()\n .x((d: LineChartDataPoint) => x(d.x))\n .y0(height)\n .y1((d: LineChartDataPoint) => y(d.y))\n .curve(d3curveLinear);\n }, [height, x, y]);\n\n React.useEffect(() => {\n if (!_isChartEmpty()) {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const _points = props.data!.lineChartData![0].data;\n\n /* eslint-disable @typescript-eslint/no-explicit-any */\n const [xMin, xMax] = d3Extent(_points, (d: any) => d.x);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n x = d3ScaleLinear()\n .domain([xMin, xMax])\n .range([margin.left!, width - margin.right!]);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n y = d3ScaleLinear()\n /* eslint-disable @typescript-eslint/no-explicit-any */\n .domain([0, d3Max(_points, (d: any) => d.y)])\n .range([height - margin.bottom!, margin.top!]);\n\n setPoints(_points as LineChartDataPoint[]);\n }\n }, []);\n\n const { data } = props;\n function _isChartEmpty(): boolean {\n return !(\n data &&\n data.lineChartData &&\n data.lineChartData.length > 0 &&\n data.lineChartData.filter(item => item.data.length === 0).length === 0\n );\n }\n function drawSparkline() {\n if (!line || !area) {\n return null;\n }\n return (\n <>\n <path\n className=\"line\"\n d={line(points)!}\n fill={'transparent'}\n opacity={1}\n strokeWidth={2}\n stroke={data!.lineChartData![0].color!}\n />\n <path\n className=\"area\"\n d={area(points)!}\n opacity={1}\n fillOpacity={0.2}\n fill={data!.lineChartData![0].color!}\n role=\"img\"\n aria-hidden\n />\n </>\n );\n }\n\n const classes = useSparklineStyles(props);\n const focusAttributes = useFocusableGroup();\n return !_isChartEmpty() ? (\n <div className={classes.inlineBlock} {...focusAttributes}>\n {width >= 50 && height >= 16 ? (\n <svg\n width={width}\n height={height}\n aria-label={`Sparkline with label ${data!.lineChartData![0].legend!}`}\n tabIndex={0}\n >\n {points ? drawSparkline() : null}\n </svg>\n ) : (\n <></>\n )}\n {props.showLegend && props.data!.lineChartData![0].legend ? (\n <svg width={valueTextWidth} height={height}>\n <text x=\"0%\" textAnchor={_isRTL ? 'end' : 'start'} dx={8} y=\"100%\" dy={-5} className={classes.valueText}>\n {props.data!.lineChartData![0].legend!}\n </text>\n </svg>\n ) : (\n <></>\n )}\n </div>\n ) : (\n <div id={_emptyChartId} role={'alert'} style={{ opacity: '0' }} aria-label={'Graph has no data to display'} />\n );\n },\n);\nSparkline.displayName = 'Sparkline';\n"],"names":["Sparkline","React","forwardRef","props","forwardedRef","margin","top","right","bottom","left","x","y","_emptyChartId","_isRTL","useRtl","points","setPoints","useState","width","height","valueTextWidth","line","useMemo","d3Line","d","curve","d3curveLinear","area","d3Area","y0","y1","useEffect","_isChartEmpty","_points","data","lineChartData","xMin","xMax","d3Extent","d3ScaleLinear","domain","range","d3Max","length","filter","item","drawSparkline","createElement","Fragment","path","className","fill","opacity","strokeWidth","stroke","color","fillOpacity","role","aria-hidden","classes","useSparklineStyles","focusAttributes","useFocusableGroup","div","inlineBlock","svg","aria-label","legend","tabIndex","showLegend","text","textAnchor","dx","dy","valueText","id","style","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAgBaA;;;eAAAA;;;;iEAhBU;0CACY;yBACU;yBACgC;yBAC5B;8BACf;uBAEX;AAShB,MAAMA,YAAAA,WAAAA,GAAqDC,OAAMC,UAAU,CAChF,CAACC,OAAOC;IACN,IAAIC,SAAS;QACXC,KAAK;QACLC,OAAO;QACPC,QAAQ;QACRC,MAAM;IACR;IACA,IAAIC;IACJ,IAAIC;IACJ,IAAIC,gBAAwB;IAC5B,IAAIC,SAAkBC,IAAAA,aAAAA;IACtB,MAAM,CAACC,QAAQC,UAAU,GAAGf,OAAMgB,QAAQ,CAAuB,EAAE;IACnE,MAAMC,QAAQ;IACd,MAAMC,SAAS;IAC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AAU,IAAIlE,MAAM+B,IAAI,CAAEC,aAAa,CAAE,EAAE,CAACgC,MAAM,GAAA,WAAA,GACvDlE,OAAA8C,aAAA,CAACkB,OAAAA;QAAI/C,OAAOE;QAAgBD,QAAQA;qBAClClB,OAAA8C,aAAA,CAACuB,QAAAA;QAAK5D,GAAE;QAAK6D,YAAY1D,SAAS,QAAQ;QAAS2D,IAAI;QAAG7D,GAAE;QAAO8D,IAAI,CAAC;QAAGvB,WAAWS,QAAQe,SAAS;OACpGvE,MAAM+B,IAAI,CAAEC,aAAa,CAAE,EAAE,CAACgC,MAAM,KAAA,WAAA,GAIzClE,OAAA8C,aAAA,CAAA9C,OAAA+C,QAAA,EAAA,SAAA,WAAA,GAIJ/C,OAAA8C,aAAA,CAACgB,OAAAA;QAAIY,IAAI/D;QAAe6C,MAAM;QAASmB,OAAO;YAAExB,SAAS;QAAI;QAAGc,cAAY;;AAEhF;AAEFlE,UAAU6E,WAAW,GAAG"}
|
package/lib-commonjs/index.js
CHANGED
|
@@ -8,9 +8,12 @@ _export_star._(require("./DonutChart"), exports);
|
|
|
8
8
|
_export_star._(require("./Legends"), exports);
|
|
9
9
|
_export_star._(require("./LineChart"), exports);
|
|
10
10
|
_export_star._(require("./VerticalBarChart"), exports);
|
|
11
|
+
_export_star._(require("./GroupedVerticalBarChart"), exports);
|
|
11
12
|
_export_star._(require("./CartesianChart"), exports);
|
|
12
13
|
_export_star._(require("./types/index"), exports);
|
|
13
14
|
_export_star._(require("./Sparkline"), exports);
|
|
15
|
+
_export_star._(require("./ScatterChart"), exports);
|
|
16
|
+
_export_star._(require("./GaugeChart"), exports);
|
|
14
17
|
_export_star._(require("./utilities/colors"), exports);
|
|
15
18
|
_export_star._(require("./Popover"), exports);
|
|
16
19
|
_export_star._(require("./ResponsiveContainer"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './HorizontalBarChart';\nexport * from './DonutChart';\nexport * from './Legends';\nexport * from './LineChart';\nexport * from './VerticalBarChart';\nexport * from './CartesianChart';\nexport * from './types/index';\nexport * from './Sparkline';\nexport * from './utilities/colors';\nexport * from './Popover';\nexport * from './ResponsiveContainer';\nexport * from './DeclarativeChart';\n"],"names":[],"rangeMappings":"
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './HorizontalBarChart';\nexport * from './DonutChart';\nexport * from './Legends';\nexport * from './LineChart';\nexport * from './VerticalBarChart';\nexport * from './GroupedVerticalBarChart';\nexport * from './CartesianChart';\nexport * from './types/index';\nexport * from './Sparkline';\nexport * from './ScatterChart';\nexport * from './GaugeChart';\nexport * from './utilities/colors';\nexport * from './Popover';\nexport * from './ResponsiveContainer';\nexport * from './DeclarativeChart';\n"],"names":[],"rangeMappings":";;;;;;;;;;;;;;;;;;;","mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["DataPoint.ts"],"sourcesContent":["import { SVGProps } from 'react';\nimport { LegendShape } from '../components/Legends/Legends.types';\n\nexport interface Basestate {\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 RefArrayData {\n index?: string;\n refElement?: SVGGElement;\n}\n\n/**\n * {@docCategory ChartProps}\n */\nexport interface Margins {\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 ChartData}\n */\nexport interface DataPoint {\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 ChartData}\n */\nexport interface VerticalStackedBarDataPoint extends Omit<DataPoint, '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 ChartData}\n */\nexport interface HorizontalDataPoint {\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 * Total value of a single point bar chart.\n */\n total?: number;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface ChartDataPoint {\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?: HorizontalDataPoint;\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?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface VerticalBarChartDataPoint {\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?: LineDataInVerticalBarChart;\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?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface HorizontalBarChartWithAxisDataPoint {\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?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface LineDataInVerticalBarChart {\n y: VerticalBarChartDataPoint['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 ChartData}\n */\nexport interface LineChartDataPoint {\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?: AccessibilityProps;\n\n /**\n * X axis Accessibility data for callout\n */\n xAxisCalloutAccessibilityData?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface LineChartGap {\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 ChartProps}\n */\nexport interface LineChartLineOptions 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 ChartData}\n */\nexport interface LineChartPoints {\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: LineChartDataPoint[];\n\n /**\n * gaps in the line chart where a line is not drawn\n */\n gaps?: LineChartGap[];\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?: LineChartLineOptions;\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 ChartProps}\n */\nexport interface ChartProps {\n /**\n * chart title for the chart\n */\n chartTitle?: string;\n\n /**\n * Accessibility data for chart title\n */\n chartTitleAccessibilityData?: AccessibilityProps;\n /**\n * data for the points in the chart\n */\n chartData?: ChartDataPoint[];\n\n /**\n * Accessibility data for chart data\n */\n chartDataAccessibilityData?: AccessibilityProps;\n\n /**\n * data for the points in the line chart\n */\n lineChartData?: LineChartPoints[];\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 ChartProps}\n */\nexport interface AccessibilityProps {\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 ChartData}\n */\nexport interface VSChartDataPoint {\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?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartProps}\n */\nexport interface VerticalStackedChartProps {\n /**\n * data for the points in the chart\n */\n chartData: VSChartDataPoint[];\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?: LineDataInVerticalStackedBarChart[];\n /**\n * Accessibility data for Whole stack callout\n */\n stackCallOutAccessibilityData?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface LineDataInVerticalStackedBarChart {\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 ChartData}\n */\nexport interface GVBarChartSeriesPoint {\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?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface GroupedVerticalBarChartData {\n /**\n * Data for X axis label\n */\n name: string;\n\n /**\n * Data points for Grouped vertical bar chart\n */\n series: GVBarChartSeriesPoint[];\n\n /**\n * Accessibility data for Group Bars Stack Callout\n */\n stackCallOutAccessibilityData?: AccessibilityProps;\n}\n\nexport interface GVDataPoint {\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 GVSingleDataPoint {\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]: GVDataPoint;\n}\n\nexport interface GVForBarChart {\n /**\n * While forming datapoints from given prop \"data\"\n * These datapoints are used for to draw graph.\n */\n [key: string]: GVBarChartSeriesPoint;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface CustomizedCalloutDataPoint {\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 ChartData}\n */\nexport interface CustomizedCalloutData {\n x: number | string | Date;\n values: CustomizedCalloutDataPoint[];\n}\n\n/**\n * {@docCategory Chart}\n */\nexport interface Chart {\n chartContainer: HTMLElement | null;\n}\n"],"names":[],"rangeMappings":";;","mappings":"AAsrBA;;CAEC"}
|
|
1
|
+
{"version":3,"sources":["DataPoint.ts"],"sourcesContent":["import { SVGProps } from 'react';\nimport { LegendShape } from '../components/Legends/Legends.types';\n\nexport interface Basestate {\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 RefArrayData {\n index?: string;\n refElement?: SVGGElement;\n}\n\n/**\n * {@docCategory ChartProps}\n */\nexport interface Margins {\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 ChartData}\n */\nexport interface DataPoint {\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 ChartData}\n */\nexport interface VerticalStackedBarDataPoint extends Omit<DataPoint, '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 ChartData}\n */\nexport interface HorizontalDataPoint {\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 * Total value of a single point bar chart.\n */\n total?: number;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface ChartDataPoint {\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?: HorizontalDataPoint;\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?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface VerticalBarChartDataPoint {\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?: LineDataInVerticalBarChart;\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?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface HorizontalBarChartWithAxisDataPoint {\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?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface LineDataInVerticalBarChart {\n y: VerticalBarChartDataPoint['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 ChartData}\n */\ninterface BaseDataPoint {\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?: AccessibilityProps;\n\n /**\n * X axis Accessibility data for callout\n */\n xAxisCalloutAccessibilityData?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface LineChartDataPoint extends BaseDataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n */\n x: number | Date;\n\n /**\n * Dependent value of the data point, rendered along the y-axis.\n */\n y: number;\n}\n\n/**\n * {@docCategory ChartData}\n * ScatterChartDataPoint interface.\n */\nexport interface ScatterChartDataPoint extends BaseDataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n */\n x: number | Date | string;\n\n /**\n * Dependent value of the data point, rendered along the y-axis.\n */\n y: number;\n\n /**\n * Marker size of the points\n */\n markerSize?: number;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface LineChartGap {\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 ChartProps}\n */\nexport interface LineChartLineOptions 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 ChartData}\n */\nexport interface LineChartPoints {\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: LineChartDataPoint[] | ScatterChartDataPoint[];\n\n /**\n * gaps in the line chart where a line is not drawn\n */\n gaps?: LineChartGap[];\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?: LineChartLineOptions;\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 ChartProps}\n */\nexport interface ChartProps {\n /**\n * chart title for the chart\n */\n chartTitle?: string;\n\n /**\n * Accessibility data for chart title\n */\n chartTitleAccessibilityData?: AccessibilityProps;\n /**\n * data for the points in the chart\n */\n chartData?: ChartDataPoint[];\n\n /**\n * Accessibility data for chart data\n */\n chartDataAccessibilityData?: AccessibilityProps;\n\n /**\n * data for the points in the line chart\n */\n lineChartData?: LineChartPoints[];\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 ChartProps}\n */\nexport interface AccessibilityProps {\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 ChartData}\n */\nexport interface VSChartDataPoint {\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?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartProps}\n */\nexport interface VerticalStackedChartProps {\n /**\n * data for the points in the chart\n */\n chartData: VSChartDataPoint[];\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?: LineDataInVerticalStackedBarChart[];\n /**\n * Accessibility data for Whole stack callout\n */\n stackCallOutAccessibilityData?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface LineDataInVerticalStackedBarChart {\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 ChartData}\n */\nexport interface GVBarChartSeriesPoint {\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?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface GroupedVerticalBarChartData {\n /**\n * Data for X axis label\n */\n name: string;\n\n /**\n * Data points for Grouped vertical bar chart\n */\n series: GVBarChartSeriesPoint[];\n\n /**\n * Accessibility data for Group Bars Stack Callout\n */\n stackCallOutAccessibilityData?: AccessibilityProps;\n}\n\nexport interface GVDataPoint {\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 GVSingleDataPoint {\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]: GVDataPoint;\n}\n\nexport interface GVForBarChart {\n /**\n * While forming datapoints from given prop \"data\"\n * These datapoints are used for to draw graph.\n */\n [key: string]: GVBarChartSeriesPoint;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface CustomizedCalloutDataPoint {\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 ChartData}\n */\nexport interface CustomizedCalloutData {\n x: number | string | Date;\n values: CustomizedCalloutDataPoint[];\n}\n\n/**\n * {@docCategory Chart}\n */\nexport interface Chart {\n chartContainer: HTMLElement | null;\n}\n"],"names":[],"rangeMappings":";;","mappings":"AA8sBA;;CAEC"}
|
|
@@ -33,6 +33,9 @@ _export(exports, {
|
|
|
33
33
|
YAxisType: function() {
|
|
34
34
|
return YAxisType;
|
|
35
35
|
},
|
|
36
|
+
areArraysEqual: function() {
|
|
37
|
+
return areArraysEqual;
|
|
38
|
+
},
|
|
36
39
|
calculateLongestLabelWidth: function() {
|
|
37
40
|
return calculateLongestLabelWidth;
|
|
38
41
|
},
|
|
@@ -81,12 +84,18 @@ _export(exports, {
|
|
|
81
84
|
domainRangeOfDateForAreaLineVerticalBarChart: function() {
|
|
82
85
|
return domainRangeOfDateForAreaLineVerticalBarChart;
|
|
83
86
|
},
|
|
87
|
+
domainRangeOfDateForScatterChart: function() {
|
|
88
|
+
return domainRangeOfDateForScatterChart;
|
|
89
|
+
},
|
|
84
90
|
domainRangeOfNumericForAreaChart: function() {
|
|
85
91
|
return domainRangeOfNumericForAreaChart;
|
|
86
92
|
},
|
|
87
93
|
domainRangeOfNumericForHorizontalBarChartWithAxis: function() {
|
|
88
94
|
return domainRangeOfNumericForHorizontalBarChartWithAxis;
|
|
89
95
|
},
|
|
96
|
+
domainRangeOfNumericForScatterChart: function() {
|
|
97
|
+
return domainRangeOfNumericForScatterChart;
|
|
98
|
+
},
|
|
90
99
|
domainRangeOfVSBCNumeric: function() {
|
|
91
100
|
return domainRangeOfVSBCNumeric;
|
|
92
101
|
},
|
|
@@ -189,6 +198,7 @@ var ChartTypes;
|
|
|
189
198
|
ChartTypes[ChartTypes["GroupedVerticalBarChart"] = 4] = "GroupedVerticalBarChart";
|
|
190
199
|
ChartTypes[ChartTypes["HeatMapChart"] = 5] = "HeatMapChart";
|
|
191
200
|
ChartTypes[ChartTypes["HorizontalBarChartWithAxis"] = 6] = "HorizontalBarChartWithAxis";
|
|
201
|
+
ChartTypes[ChartTypes["ScatterChart"] = 7] = "ScatterChart";
|
|
192
202
|
})(ChartTypes || (ChartTypes = {}));
|
|
193
203
|
var XAxisTypes;
|
|
194
204
|
(function(XAxisTypes) {
|
|
@@ -375,7 +385,7 @@ function createYAxis(yAxisParams, isRtl, axisData, chartType, barWidth, isIntegr
|
|
|
375
385
|
case 6:
|
|
376
386
|
return createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl, axisData, barWidth);
|
|
377
387
|
default:
|
|
378
|
-
return createYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDataset, useSecondaryYScale);
|
|
388
|
+
return createYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDataset, chartType, useSecondaryYScale);
|
|
379
389
|
}
|
|
380
390
|
}
|
|
381
391
|
function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl, axisData, barWidth) {
|
|
@@ -400,7 +410,7 @@ function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl, axisData,
|
|
|
400
410
|
yAxisElement ? (0, _d3selection.select)(yAxisElement).call((g)=>yAxis).selectAll('text').attr('aria-hidden', 'true') : '';
|
|
401
411
|
return yAxisScale;
|
|
402
412
|
}
|
|
403
|
-
function createYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDataset, useSecondaryYScale = false) {
|
|
413
|
+
function createYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDataset, chartType, useSecondaryYScale = false) {
|
|
404
414
|
const { yMinMaxValues = {
|
|
405
415
|
startValue: 0,
|
|
406
416
|
endValue: 0
|
|
@@ -410,9 +420,16 @@ function createYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDatas
|
|
|
410
420
|
const finalYmax = tempVal > yMaxValue ? tempVal : yMaxValue;
|
|
411
421
|
const finalYmin = yMinMaxValues.startValue < yMinValue ? 0 : yMinValue;
|
|
412
422
|
const domainValues = prepareDatapoints(finalYmax, finalYmin, yAxisTickCount, isIntegralDataset);
|
|
423
|
+
let yMin = finalYmin;
|
|
424
|
+
let yMax = domainValues[domainValues.length - 1];
|
|
425
|
+
if (chartType === 7) {
|
|
426
|
+
const yPadding = (yMax - yMin) * 0.1;
|
|
427
|
+
yMin = yMin - yPadding;
|
|
428
|
+
yMax = yMax + yPadding;
|
|
429
|
+
}
|
|
413
430
|
const yAxisScale = (0, _d3scale.scaleLinear)().domain([
|
|
414
|
-
|
|
415
|
-
|
|
431
|
+
yMin,
|
|
432
|
+
yMax
|
|
416
433
|
]).range([
|
|
417
434
|
containerHeight - margins.bottom,
|
|
418
435
|
margins.top + (eventAnnotationProps ? eventLabelHeight : 0)
|
|
@@ -501,8 +518,9 @@ function calloutData(values) {
|
|
|
501
518
|
}
|
|
502
519
|
});
|
|
503
520
|
const result = Object.keys(xValToDataPoints).map((xValue)=>{
|
|
521
|
+
const originalXValue = isNaN(Number(xValue)) ? xValue : Number(xValue);
|
|
504
522
|
return {
|
|
505
|
-
x:
|
|
523
|
+
x: originalXValue,
|
|
506
524
|
values: xValToDataPoints[xValue]
|
|
507
525
|
};
|
|
508
526
|
});
|
|
@@ -713,6 +731,32 @@ function domainRangeOfNumericForAreaChart(points, margins, width, isRTL) {
|
|
|
713
731
|
rEndValue
|
|
714
732
|
};
|
|
715
733
|
}
|
|
734
|
+
function domainRangeOfNumericForScatterChart(points, margins, width, isRTL) {
|
|
735
|
+
let xMin = (0, _d3array.min)(points, (point)=>{
|
|
736
|
+
return (0, _d3array.min)(point.data, (item)=>item.x);
|
|
737
|
+
});
|
|
738
|
+
let xMax = (0, _d3array.max)(points, (point)=>{
|
|
739
|
+
return (0, _d3array.max)(point.data, (item)=>{
|
|
740
|
+
return item.x;
|
|
741
|
+
});
|
|
742
|
+
});
|
|
743
|
+
const xPadding = (xMax - xMin) * 0.1;
|
|
744
|
+
xMin = xMin - xPadding;
|
|
745
|
+
xMax = xMax + xPadding;
|
|
746
|
+
const rStartValue = margins.left;
|
|
747
|
+
const rEndValue = width - margins.right;
|
|
748
|
+
return isRTL ? {
|
|
749
|
+
dStartValue: xMax,
|
|
750
|
+
dEndValue: xMin,
|
|
751
|
+
rStartValue,
|
|
752
|
+
rEndValue
|
|
753
|
+
} : {
|
|
754
|
+
dStartValue: xMin,
|
|
755
|
+
dEndValue: xMax,
|
|
756
|
+
rStartValue,
|
|
757
|
+
rEndValue
|
|
758
|
+
};
|
|
759
|
+
}
|
|
716
760
|
function domainRangeOfNumericForHorizontalBarChartWithAxis(points, margins, containerWidth, isRTL, shiftX) {
|
|
717
761
|
const xMax = (0, _d3array.max)(points, (point)=>point.x);
|
|
718
762
|
const rMin = isRTL ? margins.left : margins.left + shiftX;
|
|
@@ -809,6 +853,50 @@ function domainRangeOfDateForAreaLineVerticalBarChart(points, margins, width, is
|
|
|
809
853
|
rEndValue
|
|
810
854
|
};
|
|
811
855
|
}
|
|
856
|
+
function domainRangeOfDateForScatterChart(points, margins, width, isRTL, tickValues = []) {
|
|
857
|
+
let sDate;
|
|
858
|
+
let lDate;
|
|
859
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
860
|
+
sDate = (0, _d3array.min)(points, (point)=>{
|
|
861
|
+
return (0, _d3array.min)(point.data, (item)=>{
|
|
862
|
+
return item.x;
|
|
863
|
+
});
|
|
864
|
+
});
|
|
865
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
866
|
+
lDate = (0, _d3array.max)(points, (point)=>{
|
|
867
|
+
return (0, _d3array.max)(point.data, (item)=>{
|
|
868
|
+
return item.x;
|
|
869
|
+
});
|
|
870
|
+
});
|
|
871
|
+
const xPadding = (lDate.getTime() - sDate.getTime()) * 0.1;
|
|
872
|
+
sDate = new Date(sDate.getTime() - xPadding);
|
|
873
|
+
lDate = new Date(lDate.getTime() + xPadding);
|
|
874
|
+
// Need to draw graph with given small and large date
|
|
875
|
+
// (Which Involves customization of date axis tick values)
|
|
876
|
+
// That may be Either from given graph data or from prop 'tickValues' date values.
|
|
877
|
+
// So, Finding smallest and largest dates
|
|
878
|
+
sDate = (0, _d3array.min)([
|
|
879
|
+
...tickValues,
|
|
880
|
+
sDate
|
|
881
|
+
]);
|
|
882
|
+
lDate = (0, _d3array.max)([
|
|
883
|
+
...tickValues,
|
|
884
|
+
lDate
|
|
885
|
+
]);
|
|
886
|
+
const rStartValue = margins.left;
|
|
887
|
+
const rEndValue = width - margins.right;
|
|
888
|
+
return isRTL ? {
|
|
889
|
+
dStartValue: lDate,
|
|
890
|
+
dEndValue: sDate,
|
|
891
|
+
rStartValue,
|
|
892
|
+
rEndValue
|
|
893
|
+
} : {
|
|
894
|
+
dStartValue: sDate,
|
|
895
|
+
dEndValue: lDate,
|
|
896
|
+
rStartValue,
|
|
897
|
+
rEndValue
|
|
898
|
+
};
|
|
899
|
+
}
|
|
812
900
|
function domainRageOfVerticalNumeric(points, margins, containerWidth, isRTL, barWidth) {
|
|
813
901
|
const xMax = (0, _d3array.max)(points, (point)=>point.x);
|
|
814
902
|
const xMin = (0, _d3array.min)(points, (point)=>point.x);
|
|
@@ -843,6 +931,9 @@ function getDomainNRangeValues(points, margins, width, chartType, isRTL, xAxisTy
|
|
|
843
931
|
case 6:
|
|
844
932
|
domainNRangeValue = domainRangeOfNumericForHorizontalBarChartWithAxis(points, margins, width, isRTL, shiftX);
|
|
845
933
|
break;
|
|
934
|
+
case 7:
|
|
935
|
+
domainNRangeValue = domainRangeOfNumericForScatterChart(points, margins, width, isRTL);
|
|
936
|
+
break;
|
|
846
937
|
default:
|
|
847
938
|
domainNRangeValue = {
|
|
848
939
|
dStartValue: 0,
|
|
@@ -859,6 +950,9 @@ function getDomainNRangeValues(points, margins, width, chartType, isRTL, xAxisTy
|
|
|
859
950
|
case 3:
|
|
860
951
|
domainNRangeValue = domainRangeOfDateForAreaLineVerticalBarChart(points, margins, width, isRTL, tickValues, chartType, barWidth);
|
|
861
952
|
break;
|
|
953
|
+
case 7:
|
|
954
|
+
domainNRangeValue = domainRangeOfDateForScatterChart(points, margins, width, isRTL, tickValues);
|
|
955
|
+
break;
|
|
862
956
|
default:
|
|
863
957
|
domainNRangeValue = {
|
|
864
958
|
dStartValue: 0,
|
|
@@ -874,6 +968,7 @@ function getDomainNRangeValues(points, margins, width, chartType, isRTL, xAxisTy
|
|
|
874
968
|
case 4:
|
|
875
969
|
case 2:
|
|
876
970
|
case 5:
|
|
971
|
+
case 7:
|
|
877
972
|
domainNRangeValue = domainRangeOfXStringAxis(margins, width, isRTL);
|
|
878
973
|
break;
|
|
879
974
|
default:
|
|
@@ -954,6 +1049,7 @@ function getMinMaxOfYAxis(points, chartType, yAxisType = 0) {
|
|
|
954
1049
|
switch(chartType){
|
|
955
1050
|
case 0:
|
|
956
1051
|
case 1:
|
|
1052
|
+
case 7:
|
|
957
1053
|
minMaxValues = findNumericMinMaxOfY(points);
|
|
958
1054
|
break;
|
|
959
1055
|
case 3:
|
|
@@ -1175,6 +1271,20 @@ const formatDate = (date, useUTC)=>{
|
|
|
1175
1271
|
const timeFormat = useUTC ? _d3timeformat.utcFormat : _d3timeformat.timeFormat;
|
|
1176
1272
|
return timeFormat('%-e %b %Y, %H:%M')(date) + (useUTC ? ' GMT' : '');
|
|
1177
1273
|
};
|
|
1274
|
+
function areArraysEqual(arr1, arr2) {
|
|
1275
|
+
if (arr1 === arr2 || !arr1 && !arr2) {
|
|
1276
|
+
return true;
|
|
1277
|
+
}
|
|
1278
|
+
if (!arr1 || !arr2 || arr1.length !== arr2.length) {
|
|
1279
|
+
return false;
|
|
1280
|
+
}
|
|
1281
|
+
for(let i = 0; i < arr1.length; i++){
|
|
1282
|
+
if (arr1[i] !== arr2[i]) {
|
|
1283
|
+
return false;
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
return true;
|
|
1287
|
+
}
|
|
1178
1288
|
const cssVarRegExp = /var\((--[a-zA-Z0-9\-]+)\)/g;
|
|
1179
1289
|
function resolveCSSVariables(chartContainer, styleRules) {
|
|
1180
1290
|
const containerStyles = getComputedStyle(chartContainer);
|