@semcore/d3-chart 16.5.0 → 17.0.0-prerelease.8
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 +10 -0
- package/lib/cjs/AnimatedClipPath.js +28 -41
- package/lib/cjs/AnimatedClipPath.js.map +1 -1
- package/lib/cjs/Area.js +187 -223
- package/lib/cjs/Area.js.map +1 -1
- package/lib/cjs/Axis.js +248 -327
- package/lib/cjs/Axis.js.map +1 -1
- package/lib/cjs/Bar.js +162 -185
- package/lib/cjs/Bar.js.map +1 -1
- package/lib/cjs/Bubble.js +219 -248
- package/lib/cjs/Bubble.js.map +1 -1
- package/lib/cjs/CompactHorizontalBar.js +448 -482
- package/lib/cjs/CompactHorizontalBar.js.map +1 -1
- package/lib/cjs/Donut.js +349 -396
- package/lib/cjs/Donut.js.map +1 -1
- package/lib/cjs/Dots.js +67 -86
- package/lib/cjs/Dots.js.map +1 -1
- package/lib/cjs/GroupBar.js +78 -93
- package/lib/cjs/GroupBar.js.map +1 -1
- package/lib/cjs/HorizontalBar.js +149 -167
- package/lib/cjs/HorizontalBar.js.map +1 -1
- package/lib/cjs/Hover.js +178 -207
- package/lib/cjs/Hover.js.map +1 -1
- package/lib/cjs/Line.js +182 -222
- package/lib/cjs/Line.js.map +1 -1
- package/lib/cjs/Pattern.js +124 -126
- package/lib/cjs/Pattern.js.map +1 -1
- package/lib/cjs/Plot.js +100 -126
- package/lib/cjs/Plot.js.map +1 -1
- package/lib/cjs/Radar.js +576 -681
- package/lib/cjs/Radar.js.map +1 -1
- package/lib/cjs/RadialTree.js +518 -571
- package/lib/cjs/RadialTree.js.map +1 -1
- package/lib/cjs/Reference.js +147 -178
- package/lib/cjs/Reference.js.map +1 -1
- package/lib/cjs/ResponsiveContainer.js +64 -82
- package/lib/cjs/ResponsiveContainer.js.map +1 -1
- package/lib/cjs/ScatterPlot.js +169 -199
- package/lib/cjs/ScatterPlot.js.map +1 -1
- package/lib/cjs/StackBar.js +135 -177
- package/lib/cjs/StackBar.js.map +1 -1
- package/lib/cjs/StackedArea.js +60 -73
- package/lib/cjs/StackedArea.js.map +1 -1
- package/lib/cjs/Tooltip.js +193 -208
- package/lib/cjs/Tooltip.js.map +1 -1
- package/lib/cjs/Venn.js +182 -217
- package/lib/cjs/Venn.js.map +1 -1
- package/lib/cjs/a11y/DataAccessibilityTable.js +45 -83
- package/lib/cjs/a11y/DataAccessibilityTable.js.map +1 -1
- package/lib/cjs/a11y/PlotA11yModule.js +37 -97
- package/lib/cjs/a11y/PlotA11yModule.js.map +1 -1
- package/lib/cjs/a11y/PlotA11yView.js +97 -91
- package/lib/cjs/a11y/PlotA11yView.js.map +1 -1
- package/lib/cjs/a11y/bezier.js +17 -23
- package/lib/cjs/a11y/bezier.js.map +1 -1
- package/lib/cjs/a11y/focus.js +16 -16
- package/lib/cjs/a11y/focus.js.map +1 -1
- package/lib/cjs/a11y/hints.js +72 -75
- package/lib/cjs/a11y/hints.js.map +1 -1
- package/lib/cjs/a11y/insights.js +354 -525
- package/lib/cjs/a11y/insights.js.map +1 -1
- package/lib/cjs/a11y/intl.js +5 -5
- package/lib/cjs/a11y/intl.js.map +1 -1
- package/lib/cjs/a11y/locale.js +12 -19
- package/lib/cjs/a11y/locale.js.map +1 -1
- package/lib/cjs/a11y/serialize.js +164 -203
- package/lib/cjs/a11y/serialize.js.map +1 -1
- package/lib/cjs/a11y/summarize.js +7 -6
- package/lib/cjs/a11y/summarize.js.map +1 -1
- package/lib/cjs/a11y/translations/module/__intergalactic-dynamic-locales.js +16 -16
- package/lib/cjs/a11y/translations/module/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/cjs/a11y/translations/module/de.json +2 -2
- package/lib/cjs/a11y/translations/module/en.json +2 -2
- package/lib/cjs/a11y/translations/module/es.json +2 -2
- package/lib/cjs/a11y/translations/module/fr.json +2 -2
- package/lib/cjs/a11y/translations/module/it.json +2 -2
- package/lib/cjs/a11y/translations/module/ja.json +2 -2
- package/lib/cjs/a11y/translations/module/ko.json +2 -2
- package/lib/cjs/a11y/translations/module/nl.json +2 -2
- package/lib/cjs/a11y/translations/module/pl.json +2 -2
- package/lib/cjs/a11y/translations/module/pt.json +2 -2
- package/lib/cjs/a11y/translations/module/sv.json +2 -2
- package/lib/cjs/a11y/translations/module/tr.json +2 -2
- package/lib/cjs/a11y/translations/module/vi.json +2 -2
- package/lib/cjs/a11y/translations/module/zh.json +2 -2
- package/lib/cjs/a11y/translations/view/__intergalactic-dynamic-locales.js +16 -16
- package/lib/cjs/a11y/translations/view/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/cjs/color.js +1 -1
- package/lib/cjs/color.js.map +1 -1
- package/lib/cjs/component/Chart/AbstractChart.js +421 -466
- package/lib/cjs/component/Chart/AbstractChart.js.map +1 -1
- package/lib/cjs/component/Chart/AbstractChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/AreaChart.js +97 -115
- package/lib/cjs/component/Chart/AreaChart.js.map +1 -1
- package/lib/cjs/component/Chart/AreaChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/BarChart.js +229 -216
- package/lib/cjs/component/Chart/BarChart.js.map +1 -1
- package/lib/cjs/component/Chart/BarChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/BubbleChart.js +114 -136
- package/lib/cjs/component/Chart/BubbleChart.js.map +1 -1
- package/lib/cjs/component/Chart/BubbleChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/CigaretteChart.js +280 -305
- package/lib/cjs/component/Chart/CigaretteChart.js.map +1 -1
- package/lib/cjs/component/Chart/CompactHorizontalBarChart.js +76 -108
- package/lib/cjs/component/Chart/CompactHorizontalBarChart.js.map +1 -1
- package/lib/cjs/component/Chart/CompactHorizontalBarChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/DonutChart.js +80 -95
- package/lib/cjs/component/Chart/DonutChart.js.map +1 -1
- package/lib/cjs/component/Chart/DonutChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/HistogramChart.js +126 -148
- package/lib/cjs/component/Chart/HistogramChart.js.map +1 -1
- package/lib/cjs/component/Chart/HistogramChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/LineChart.js +95 -113
- package/lib/cjs/component/Chart/LineChart.js.map +1 -1
- package/lib/cjs/component/Chart/LineChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/RadarChart.js +84 -110
- package/lib/cjs/component/Chart/RadarChart.js.map +1 -1
- package/lib/cjs/component/Chart/RadarChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/ScatterPlotChart.js +119 -143
- package/lib/cjs/component/Chart/ScatterPlotChart.js.map +1 -1
- package/lib/cjs/component/Chart/ScatterPlotChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/VennChart.js +103 -122
- package/lib/cjs/component/Chart/VennChart.js.map +1 -1
- package/lib/cjs/component/Chart/VennChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/index.js +2 -2
- package/lib/cjs/component/Chart/index.js.map +1 -1
- package/lib/cjs/component/ChartLegend/BaseLegend.js +72 -105
- package/lib/cjs/component/ChartLegend/BaseLegend.js.map +1 -1
- package/lib/cjs/component/ChartLegend/BaseLegend.type.js.map +1 -1
- package/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.js +58 -70
- package/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.js.map +1 -1
- package/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.type.js.map +1 -1
- package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js +208 -221
- package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js.map +1 -1
- package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.type.js +1 -1
- package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.type.js.map +1 -1
- package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js +63 -73
- package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js.map +1 -1
- package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.type.js.map +1 -1
- package/lib/cjs/component/ChartLegend/index.js +4 -4
- package/lib/cjs/component/ChartLegend/index.js.map +1 -1
- package/lib/cjs/component/Cigarette/Cigarette.js +115 -129
- package/lib/cjs/component/Cigarette/Cigarette.js.map +1 -1
- package/lib/cjs/component/StackGroupBar/StackGroupBar.js +107 -137
- package/lib/cjs/component/StackGroupBar/StackGroupBar.js.map +1 -1
- package/lib/cjs/component/SvgElement.js +7 -7
- package/lib/cjs/component/SvgElement.js.map +1 -1
- package/lib/cjs/createElement.js +66 -65
- package/lib/cjs/createElement.js.map +1 -1
- package/lib/cjs/index.js +62 -62
- package/lib/cjs/style/axis.shadow.css +3 -0
- package/lib/cjs/style/plot.shadow.css +1 -3
- package/lib/cjs/style/plotA11yModule.shadow.css +10 -11
- package/lib/cjs/style/plotA11yView.shadow.css +13 -26
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js +15 -15
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/cjs/types/Axis.d.js.map +1 -1
- package/lib/cjs/types/CompactHorizontalBar.d.js.map +1 -1
- package/lib/cjs/types/Hover.d.js.map +1 -1
- package/lib/cjs/types/Line.d.js.map +1 -1
- package/lib/cjs/types/Plot.d.js.map +1 -1
- package/lib/cjs/types/Radar.d.js.map +1 -1
- package/lib/cjs/types/ResponsiveContainer.d.js.map +1 -1
- package/lib/cjs/types/Tooltip.d.js.map +1 -1
- package/lib/cjs/types/Venn.d.js.map +1 -1
- package/lib/cjs/types/index.d.js +80 -80
- package/lib/cjs/types/index.d.js.map +1 -1
- package/lib/cjs/utils.js +122 -145
- package/lib/cjs/utils.js.map +1 -1
- package/lib/es6/AnimatedClipPath.js +24 -37
- package/lib/es6/AnimatedClipPath.js.map +1 -1
- package/lib/es6/Area.js +179 -215
- package/lib/es6/Area.js.map +1 -1
- package/lib/es6/Axis.js +242 -321
- package/lib/es6/Axis.js.map +1 -1
- package/lib/es6/Bar.js +154 -177
- package/lib/es6/Bar.js.map +1 -1
- package/lib/es6/Bubble.js +206 -235
- package/lib/es6/Bubble.js.map +1 -1
- package/lib/es6/CompactHorizontalBar.js +433 -467
- package/lib/es6/CompactHorizontalBar.js.map +1 -1
- package/lib/es6/Donut.js +337 -384
- package/lib/es6/Donut.js.map +1 -1
- package/lib/es6/Dots.js +60 -79
- package/lib/es6/Dots.js.map +1 -1
- package/lib/es6/GroupBar.js +74 -89
- package/lib/es6/GroupBar.js.map +1 -1
- package/lib/es6/HorizontalBar.js +141 -159
- package/lib/es6/HorizontalBar.js.map +1 -1
- package/lib/es6/Hover.js +174 -203
- package/lib/es6/Hover.js.map +1 -1
- package/lib/es6/Line.js +173 -213
- package/lib/es6/Line.js.map +1 -1
- package/lib/es6/Pattern.js +68 -74
- package/lib/es6/Pattern.js.map +1 -1
- package/lib/es6/Plot.js +95 -121
- package/lib/es6/Plot.js.map +1 -1
- package/lib/es6/Radar.js +554 -659
- package/lib/es6/Radar.js.map +1 -1
- package/lib/es6/RadialTree.js +500 -553
- package/lib/es6/RadialTree.js.map +1 -1
- package/lib/es6/Reference.js +140 -171
- package/lib/es6/Reference.js.map +1 -1
- package/lib/es6/ResponsiveContainer.js +58 -76
- package/lib/es6/ResponsiveContainer.js.map +1 -1
- package/lib/es6/ScatterPlot.js +161 -191
- package/lib/es6/ScatterPlot.js.map +1 -1
- package/lib/es6/StackBar.js +130 -172
- package/lib/es6/StackBar.js.map +1 -1
- package/lib/es6/StackedArea.js +56 -69
- package/lib/es6/StackedArea.js.map +1 -1
- package/lib/es6/Tooltip.js +183 -198
- package/lib/es6/Tooltip.js.map +1 -1
- package/lib/es6/Venn.js +169 -204
- package/lib/es6/Venn.js.map +1 -1
- package/lib/es6/a11y/DataAccessibilityTable.js +41 -80
- package/lib/es6/a11y/DataAccessibilityTable.js.map +1 -1
- package/lib/es6/a11y/PlotA11yModule.js +35 -95
- package/lib/es6/a11y/PlotA11yModule.js.map +1 -1
- package/lib/es6/a11y/PlotA11yView.js +89 -84
- package/lib/es6/a11y/PlotA11yView.js.map +1 -1
- package/lib/es6/a11y/bezier.js +16 -23
- package/lib/es6/a11y/bezier.js.map +1 -1
- package/lib/es6/a11y/focus.js +15 -16
- package/lib/es6/a11y/focus.js.map +1 -1
- package/lib/es6/a11y/hints.js +67 -73
- package/lib/es6/a11y/hints.js.map +1 -1
- package/lib/es6/a11y/insights.js +353 -524
- package/lib/es6/a11y/insights.js.map +1 -1
- package/lib/es6/a11y/intl.js +4 -5
- package/lib/es6/a11y/intl.js.map +1 -1
- package/lib/es6/a11y/locale.js +11 -18
- package/lib/es6/a11y/locale.js.map +1 -1
- package/lib/es6/a11y/serialize.js +162 -203
- package/lib/es6/a11y/serialize.js.map +1 -1
- package/lib/es6/a11y/summarize.js +6 -6
- package/lib/es6/a11y/summarize.js.map +1 -1
- package/lib/es6/a11y/translations/module/__intergalactic-dynamic-locales.js +15 -15
- package/lib/es6/a11y/translations/module/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/a11y/translations/module/de.json +2 -2
- package/lib/es6/a11y/translations/module/en.json +2 -2
- package/lib/es6/a11y/translations/module/es.json +2 -2
- package/lib/es6/a11y/translations/module/fr.json +2 -2
- package/lib/es6/a11y/translations/module/it.json +2 -2
- package/lib/es6/a11y/translations/module/ja.json +2 -2
- package/lib/es6/a11y/translations/module/ko.json +2 -2
- package/lib/es6/a11y/translations/module/nl.json +2 -2
- package/lib/es6/a11y/translations/module/pl.json +2 -2
- package/lib/es6/a11y/translations/module/pt.json +2 -2
- package/lib/es6/a11y/translations/module/sv.json +2 -2
- package/lib/es6/a11y/translations/module/tr.json +2 -2
- package/lib/es6/a11y/translations/module/vi.json +2 -2
- package/lib/es6/a11y/translations/module/zh.json +2 -2
- package/lib/es6/a11y/translations/view/__intergalactic-dynamic-locales.js +15 -15
- package/lib/es6/a11y/translations/view/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/color.js +1 -1
- package/lib/es6/color.js.map +1 -1
- package/lib/es6/component/Chart/AbstractChart.js +416 -462
- package/lib/es6/component/Chart/AbstractChart.js.map +1 -1
- package/lib/es6/component/Chart/AbstractChart.type.js.map +1 -1
- package/lib/es6/component/Chart/AreaChart.js +92 -111
- package/lib/es6/component/Chart/AreaChart.js.map +1 -1
- package/lib/es6/component/Chart/AreaChart.type.js.map +1 -1
- package/lib/es6/component/Chart/BarChart.js +225 -213
- package/lib/es6/component/Chart/BarChart.js.map +1 -1
- package/lib/es6/component/Chart/BarChart.type.js.map +1 -1
- package/lib/es6/component/Chart/BubbleChart.js +109 -132
- package/lib/es6/component/Chart/BubbleChart.js.map +1 -1
- package/lib/es6/component/Chart/BubbleChart.type.js.map +1 -1
- package/lib/es6/component/Chart/CigaretteChart.js +276 -301
- package/lib/es6/component/Chart/CigaretteChart.js.map +1 -1
- package/lib/es6/component/Chart/CompactHorizontalBarChart.js +70 -103
- package/lib/es6/component/Chart/CompactHorizontalBarChart.js.map +1 -1
- package/lib/es6/component/Chart/CompactHorizontalBarChart.type.js.map +1 -1
- package/lib/es6/component/Chart/DonutChart.js +74 -90
- package/lib/es6/component/Chart/DonutChart.js.map +1 -1
- package/lib/es6/component/Chart/DonutChart.type.js.map +1 -1
- package/lib/es6/component/Chart/HistogramChart.js +121 -144
- package/lib/es6/component/Chart/HistogramChart.js.map +1 -1
- package/lib/es6/component/Chart/HistogramChart.type.js.map +1 -1
- package/lib/es6/component/Chart/LineChart.js +90 -109
- package/lib/es6/component/Chart/LineChart.js.map +1 -1
- package/lib/es6/component/Chart/LineChart.type.js.map +1 -1
- package/lib/es6/component/Chart/RadarChart.js +80 -107
- package/lib/es6/component/Chart/RadarChart.js.map +1 -1
- package/lib/es6/component/Chart/RadarChart.type.js.map +1 -1
- package/lib/es6/component/Chart/ScatterPlotChart.js +113 -138
- package/lib/es6/component/Chart/ScatterPlotChart.js.map +1 -1
- package/lib/es6/component/Chart/ScatterPlotChart.type.js.map +1 -1
- package/lib/es6/component/Chart/VennChart.js +97 -117
- package/lib/es6/component/Chart/VennChart.js.map +1 -1
- package/lib/es6/component/Chart/VennChart.type.js.map +1 -1
- package/lib/es6/component/ChartLegend/BaseLegend.js +70 -104
- package/lib/es6/component/ChartLegend/BaseLegend.js.map +1 -1
- package/lib/es6/component/ChartLegend/BaseLegend.type.js.map +1 -1
- package/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.js +53 -65
- package/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.js.map +1 -1
- package/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.type.js.map +1 -1
- package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js +198 -211
- package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js.map +1 -1
- package/lib/es6/component/ChartLegend/LegendItem/LegendItem.type.js +1 -1
- package/lib/es6/component/ChartLegend/LegendItem/LegendItem.type.js.map +1 -1
- package/lib/es6/component/ChartLegend/LegendTable/LegendTable.js +58 -68
- package/lib/es6/component/ChartLegend/LegendTable/LegendTable.js.map +1 -1
- package/lib/es6/component/ChartLegend/LegendTable/LegendTable.type.js.map +1 -1
- package/lib/es6/component/Cigarette/Cigarette.js +108 -122
- package/lib/es6/component/Cigarette/Cigarette.js.map +1 -1
- package/lib/es6/component/StackGroupBar/StackGroupBar.js +100 -130
- package/lib/es6/component/StackGroupBar/StackGroupBar.js.map +1 -1
- package/lib/es6/component/SvgElement.js +4 -5
- package/lib/es6/component/SvgElement.js.map +1 -1
- package/lib/es6/createElement.js +55 -54
- package/lib/es6/createElement.js.map +1 -1
- package/lib/es6/style/axis.shadow.css +3 -0
- package/lib/es6/style/plot.shadow.css +1 -3
- package/lib/es6/style/plotA11yModule.shadow.css +10 -11
- package/lib/es6/style/plotA11yView.shadow.css +13 -26
- package/lib/es6/translations/__intergalactic-dynamic-locales.js +14 -14
- package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/types/Axis.d.js.map +1 -1
- package/lib/es6/types/CompactHorizontalBar.d.js.map +1 -1
- package/lib/es6/types/Hover.d.js.map +1 -1
- package/lib/es6/types/Line.d.js.map +1 -1
- package/lib/es6/types/Plot.d.js.map +1 -1
- package/lib/es6/types/Radar.d.js.map +1 -1
- package/lib/es6/types/ResponsiveContainer.d.js.map +1 -1
- package/lib/es6/types/Tooltip.d.js.map +1 -1
- package/lib/es6/types/Venn.d.js.map +1 -1
- package/lib/es6/utils.js +105 -144
- package/lib/es6/utils.js.map +1 -1
- package/lib/esm/AnimatedClipPath.mjs +24 -36
- package/lib/esm/Area.mjs +178 -149
- package/lib/esm/Axis.mjs +241 -242
- package/lib/esm/Bar.mjs +155 -137
- package/lib/esm/Bubble.mjs +205 -171
- package/lib/esm/CompactHorizontalBar.mjs +428 -383
- package/lib/esm/Donut.mjs +315 -266
- package/lib/esm/Dots.mjs +60 -49
- package/lib/esm/GroupBar.mjs +71 -75
- package/lib/esm/HorizontalBar.mjs +142 -120
- package/lib/esm/Hover.mjs +173 -163
- package/lib/esm/Line.mjs +174 -145
- package/lib/esm/Pattern.mjs +67 -63
- package/lib/esm/Plot.mjs +98 -95
- package/lib/esm/Radar.mjs +550 -498
- package/lib/esm/RadialTree.mjs +512 -416
- package/lib/esm/Reference.mjs +137 -122
- package/lib/esm/ResponsiveContainer.mjs +58 -69
- package/lib/esm/ScatterPlot.mjs +163 -162
- package/lib/esm/StackBar.mjs +126 -147
- package/lib/esm/StackedArea.mjs +53 -61
- package/lib/esm/Tooltip.mjs +185 -175
- package/lib/esm/Venn.mjs +170 -170
- package/lib/esm/a11y/DataAccessibilityTable.mjs +46 -73
- package/lib/esm/a11y/PlotA11yModule.mjs +37 -80
- package/lib/esm/a11y/PlotA11yView.mjs +99 -74
- package/lib/esm/a11y/bezier.mjs +16 -23
- package/lib/esm/a11y/focus.mjs +15 -16
- package/lib/esm/a11y/hints.mjs +65 -71
- package/lib/esm/a11y/insights.mjs +347 -495
- package/lib/esm/a11y/intl.mjs +4 -5
- package/lib/esm/a11y/locale.mjs +12 -14
- package/lib/esm/a11y/serialize.mjs +139 -152
- package/lib/esm/a11y/summarize.mjs +3 -3
- package/lib/esm/a11y/translations/module/__intergalactic-dynamic-locales.mjs +1 -1
- package/lib/esm/a11y/translations/module/de.json.mjs +2 -4
- package/lib/esm/a11y/translations/module/en.json.mjs +2 -4
- package/lib/esm/a11y/translations/module/es.json.mjs +2 -4
- package/lib/esm/a11y/translations/module/fr.json.mjs +2 -4
- package/lib/esm/a11y/translations/module/it.json.mjs +2 -4
- package/lib/esm/a11y/translations/module/ja.json.mjs +2 -4
- package/lib/esm/a11y/translations/module/ko.json.mjs +2 -4
- package/lib/esm/a11y/translations/module/nl.json.mjs +2 -4
- package/lib/esm/a11y/translations/module/pl.json.mjs +2 -4
- package/lib/esm/a11y/translations/module/pt.json.mjs +2 -4
- package/lib/esm/a11y/translations/module/sv.json.mjs +2 -4
- package/lib/esm/a11y/translations/module/tr.json.mjs +2 -4
- package/lib/esm/a11y/translations/module/vi.json.mjs +2 -4
- package/lib/esm/a11y/translations/module/zh.json.mjs +2 -4
- package/lib/esm/a11y/translations/view/__intergalactic-dynamic-locales.mjs +1 -1
- package/lib/esm/color.mjs +1 -1
- package/lib/esm/component/Chart/AbstractChart.mjs +422 -415
- package/lib/esm/component/Chart/AreaChart.mjs +92 -91
- package/lib/esm/component/Chart/BarChart.mjs +225 -177
- package/lib/esm/component/Chart/BubbleChart.mjs +110 -118
- package/lib/esm/component/Chart/CigaretteChart.mjs +277 -268
- package/lib/esm/component/Chart/CompactHorizontalBarChart.mjs +70 -87
- package/lib/esm/component/Chart/DonutChart.mjs +74 -84
- package/lib/esm/component/Chart/HistogramChart.mjs +121 -117
- package/lib/esm/component/Chart/LineChart.mjs +90 -89
- package/lib/esm/component/Chart/RadarChart.mjs +81 -97
- package/lib/esm/component/Chart/ScatterPlotChart.mjs +113 -111
- package/lib/esm/component/Chart/VennChart.mjs +98 -111
- package/lib/esm/component/ChartLegend/BaseLegend.mjs +75 -97
- package/lib/esm/component/ChartLegend/LegendFlex/LegendFlex.mjs +54 -55
- package/lib/esm/component/ChartLegend/LegendItem/LegendItem.mjs +194 -165
- package/lib/esm/component/ChartLegend/LegendItem/LegendItem.type.mjs +1 -1
- package/lib/esm/component/ChartLegend/LegendTable/LegendTable.mjs +60 -58
- package/lib/esm/component/Cigarette/Cigarette.mjs +109 -99
- package/lib/esm/component/StackGroupBar/StackGroupBar.mjs +97 -111
- package/lib/esm/component/SvgElement.mjs +4 -4
- package/lib/esm/createElement.mjs +54 -37
- package/lib/esm/style/axis.shadow.css +3 -0
- package/lib/esm/style/plot.shadow.css +1 -3
- package/lib/esm/style/plotA11yModule.shadow.css +10 -11
- package/lib/esm/style/plotA11yView.shadow.css +13 -26
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +1 -1
- package/lib/esm/utils.mjs +103 -138
- package/lib/types/Axis.d.ts +4 -0
- package/lib/types/CompactHorizontalBar.d.ts +1 -1
- package/lib/types/Hover.d.ts +1 -1
- package/lib/types/Line.d.ts +1 -1
- package/lib/types/Plot.d.ts +1 -1
- package/lib/types/Radar.d.ts +1 -1
- package/lib/types/ResponsiveContainer.d.ts +1 -1
- package/lib/types/Tooltip.d.ts +1 -3
- package/lib/types/Venn.d.ts +1 -1
- package/lib/types/a11y/PlotA11yModule.d.ts +4 -11
- package/lib/types/a11y/PlotA11yView.d.ts +12 -1
- package/lib/types/a11y/translations/module/__intergalactic-dynamic-locales.d.ts +14 -14
- package/lib/types/component/Chart/AbstractChart.d.ts +1 -1
- package/lib/types/component/Chart/AbstractChart.type.d.ts +1 -1
- package/lib/types/component/Chart/AreaChart.type.d.ts +1 -1
- package/lib/types/component/Chart/BarChart.type.d.ts +1 -1
- package/lib/types/component/Chart/BubbleChart.type.d.ts +1 -1
- package/lib/types/component/Chart/CompactHorizontalBarChart.type.d.ts +1 -1
- package/lib/types/component/Chart/DonutChart.type.d.ts +1 -1
- package/lib/types/component/Chart/HistogramChart.type.d.ts +1 -1
- package/lib/types/component/Chart/LineChart.type.d.ts +1 -1
- package/lib/types/component/Chart/RadarChart.type.d.ts +1 -1
- package/lib/types/component/Chart/ScatterPlotChart.type.d.ts +1 -1
- package/lib/types/component/Chart/VennChart.type.d.ts +1 -1
- package/lib/types/component/ChartLegend/BaseLegend.d.ts +1 -1
- package/lib/types/component/ChartLegend/BaseLegend.type.d.ts +1 -1
- package/lib/types/component/ChartLegend/LegendFlex/LegendFlex.type.d.ts +1 -1
- package/lib/types/component/ChartLegend/LegendItem/LegendItem.type.d.ts +1 -1
- package/lib/types/component/ChartLegend/LegendTable/LegendTable.type.d.ts +1 -1
- package/lib/types/utils.d.ts +10 -10
- package/package.json +11 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DonutChart.js","names":["
|
|
1
|
+
{"version":3,"file":"DonutChart.js","names":["Flex","createComponent","i18nEnhance","Text","scaleLinear","React","Donut","AbstractChart","localizedMessages","DonutChartComponent","xScale","asProps","yScale","defaultLegendProps","legendType","renderChart","innerRadius","halfsize","innerLabel","onClickPie","dataDefinitions","highlightedLine","state","checkedLegendItems","filter","item","checked","createElement","onClick","length","EmptyData","map","index","Pie","key","id","dataKey","name","label","color","active","Label","renderTooltip","data","Tooltip","title","find","children","Fragment","Title","justifyContent","bold","tooltipValueFormatter","getLegendAriaLabel","getI18nText","chartType","_defineProperty","direction","alignItems","marginX","marginY","DonutChart"],"sources":["../../../../src/component/Chart/DonutChart.tsx"],"sourcesContent":["import { Flex } from '@semcore/base-components';\nimport { createComponent } from '@semcore/core';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport { Text } from '@semcore/typography';\nimport { scaleLinear } from 'd3-scale';\nimport React from 'react';\n\n// @ts-ignore\nimport { Donut } from '../..';\nimport { AbstractChart } from './AbstractChart';\nimport type { DonutChartData, DonutChartProps, DonutChartType } from './DonutChart.type';\nimport { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';\n\nclass DonutChartComponent extends AbstractChart<\n DonutChartData,\n DonutChartProps,\n typeof DonutChartComponent.enhance\n> {\n static displayName = 'Chart.Donut';\n static defaultProps: Partial<DonutChartProps> = {\n direction: 'row-reverse',\n alignItems: 'flex-start',\n innerRadius: 100,\n marginX: 0,\n marginY: 0,\n };\n\n static enhance = [i18nEnhance(localizedMessages)] as const;\n\n get xScale() {\n const { xScale } = this.asProps;\n\n if (xScale) {\n return xScale;\n }\n\n return scaleLinear();\n }\n\n get yScale() {\n const { yScale } = this.asProps;\n\n if (yScale) {\n return yScale;\n }\n\n return scaleLinear();\n }\n\n defaultLegendProps() {\n return {\n legendType: 'Table' as const,\n };\n }\n\n renderChart() {\n const { innerRadius, halfsize, innerLabel, onClickPie } = this.asProps;\n const { dataDefinitions, highlightedLine } = this.state;\n\n const checkedLegendItems = dataDefinitions.filter((item) => item.checked);\n\n return (\n <Donut onClick={onClickPie} halfsize={halfsize} innerRadius={innerRadius}>\n {checkedLegendItems.length === 0 && <Donut.EmptyData />}\n {checkedLegendItems.map((item, index) => {\n return (\n <Donut.Pie\n key={item.id}\n dataKey={item.id}\n name={item.label}\n color={item.color}\n active={highlightedLine === index}\n />\n );\n })}\n {innerLabel && <Donut.Label>{innerLabel}</Donut.Label>}\n </Donut>\n );\n }\n\n renderTooltip() {\n const { data } = this.asProps;\n const { dataDefinitions } = this.state;\n\n return (\n <Donut.Tooltip>\n {({ dataKey }: any) => {\n const title = dataDefinitions.find((item) => item.id === dataKey);\n\n return {\n children: (\n <>\n <Donut.Tooltip.Title>{title?.label || dataKey}</Donut.Tooltip.Title>\n <Flex justifyContent='space-between'>\n <Text bold>{this.tooltipValueFormatter(data[dataKey])}</Text>\n </Flex>\n </>\n ),\n };\n }}\n </Donut.Tooltip>\n );\n }\n\n protected getLegendAriaLabel(): string {\n return this.asProps.getI18nText('legendForChart', { chartType: 'Donut' });\n }\n}\n\nexport const DonutChart: DonutChartType = createComponent(DonutChartComponent);\n"],"mappings":";AAAA,SAASA,IAAI,QAAQ,0BAA0B;AAC/C,SAASC,eAAe,QAAQ,eAAe;AAC/C,OAAOC,WAAW,MAAM,8CAA8C;AACtE,SAASC,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1C,OAAO,CAAC2C,WAAW,CAAC,gBAAgB,EAAE;MAAEC,SAAS,EAAE;IAAQ,CAAC,CAAC;EAC3E;AACF;AAACC,eAAA,CA9FK/C,mBAAmB,iBAKF,aAAa;AAAA+C,eAAA,CAL9B/C,mBAAmB,kBAMyB;EAC9CgD,SAAS,EAAE,aAAa;EACxBC,UAAU,EAAE,YAAY;EACxB1C,WAAW,EAAE,GAAG;EAChB2C,OAAO,EAAE,CAAC;EACVC,OAAO,EAAE;AACX,CAAC;AAAAJ,eAAA,CAZG/C,mBAAmB,aAcN,CAACP,WAAW,CAACM,iBAAiB,CAAC,CAAC;AAkFnD,OAAO,MAAMqD,UAA0B,GAAG5D,eAAe,CAACQ,mBAAmB,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DonutChart.type.js","names":[],"sources":["../../../../src/component/Chart/DonutChart.type.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"DonutChart.type.js","names":[],"sources":["../../../../src/component/Chart/DonutChart.type.ts"],"sourcesContent":["import type { Flex } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport type { ScaleLinear } from 'd3-scale';\nimport type React from 'react';\n\nimport type { BaseChartProps } from './AbstractChart.type';\n\nexport type DataKey = string;\n\nexport type DonutChartData = Record<DataKey, number>;\n\nexport type DonutChartProps = Intergalactic.InternalTypings.EfficientOmit<\n BaseChartProps<DonutChartData>,\n 'showTotalInTooltip'\n> & {\n /** Internal */\n groupKey?: never;\n /** Custom x-axis scale */\n xScale?: ScaleLinear<any, any>;\n /** Custom y-axis scale */\n yScale?: ScaleLinear<any, any>;\n /** Controls the inner radius of the donut */\n innerRadius?: number;\n /** Creates a semi-donut chart when enabled */\n halfsize?: boolean;\n /** Content displayed in the center of the donut */\n innerLabel?: React.ReactNode;\n /** Callback triggered when a user clicks on a pie */\n onClickPie?: (key: DataKey, e: React.SyntheticEvent) => void;\n};\n\nexport type DonutChartType = Intergalactic.Component<typeof Flex, DonutChartProps>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
|
-
import _callSuper from "@babel/runtime/helpers/callSuper";
|
|
6
|
-
import _superPropGet from "@babel/runtime/helpers/superPropGet";
|
|
7
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
8
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
3
|
import { createComponent } from '@semcore/core';
|
|
10
4
|
import i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';
|
|
@@ -15,151 +9,134 @@ import React from 'react';
|
|
|
15
9
|
import { Bar, minMax, HoverRect, StackBar } from '../..';
|
|
16
10
|
import { AbstractChart } from './AbstractChart';
|
|
17
11
|
import { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
marginX = _this$asProps$marginX === void 0 ? 30 : _this$asProps$marginX,
|
|
33
|
-
plotWidth = _this$asProps.plotWidth,
|
|
34
|
-
plotHeight = _this$asProps.plotHeight,
|
|
35
|
-
invertAxis = _this$asProps.invertAxis,
|
|
36
|
-
data = _this$asProps.data,
|
|
37
|
-
groupKey = _this$asProps.groupKey;
|
|
38
|
-
if (xScale) {
|
|
39
|
-
return xScale;
|
|
40
|
-
}
|
|
41
|
-
var testItem = data[0][groupKey];
|
|
42
|
-
var range = invertAxis ? [plotHeight - marginX, this.plotPadding] : [marginY, plotWidth - this.plotPadding];
|
|
43
|
-
if (testItem instanceof Date && !Number.isNaN(testItem.getMilliseconds())) {
|
|
44
|
-
var _domain = minMax(data, groupKey);
|
|
45
|
-
return scaleTime(_domain, range);
|
|
46
|
-
}
|
|
47
|
-
var domain = data.map(function (item) {
|
|
48
|
-
return item[groupKey];
|
|
49
|
-
});
|
|
50
|
-
return scaleBand(domain, range).paddingInner(0.05).paddingOuter(0.2);
|
|
51
|
-
}
|
|
52
|
-
}, {
|
|
53
|
-
key: "yScale",
|
|
54
|
-
get: function get() {
|
|
55
|
-
var _this$asProps2 = this.asProps,
|
|
56
|
-
yScale = _this$asProps2.yScale,
|
|
57
|
-
_this$asProps2$margin = _this$asProps2.marginY,
|
|
58
|
-
marginY = _this$asProps2$margin === void 0 ? 30 : _this$asProps2$margin,
|
|
59
|
-
_this$asProps2$margin2 = _this$asProps2.marginX,
|
|
60
|
-
marginX = _this$asProps2$margin2 === void 0 ? 30 : _this$asProps2$margin2,
|
|
61
|
-
plotHeight = _this$asProps2.plotHeight,
|
|
62
|
-
plotWidth = _this$asProps2.plotWidth,
|
|
63
|
-
invertAxis = _this$asProps2.invertAxis,
|
|
64
|
-
data = _this$asProps2.data;
|
|
65
|
-
var max;
|
|
66
|
-
if (this.isStack) {
|
|
67
|
-
max = data.reduce(function (max, item) {
|
|
68
|
-
var barSum = Object.values(item).reduce(function (sum, val) {
|
|
69
|
-
if (val instanceof Date && !Number.isNaN(val.getMilliseconds())) {
|
|
70
|
-
return sum + val.getMilliseconds();
|
|
71
|
-
}
|
|
72
|
-
return sum + val;
|
|
73
|
-
}, 0);
|
|
74
|
-
if (barSum > max) {
|
|
75
|
-
max = barSum;
|
|
76
|
-
}
|
|
77
|
-
return max;
|
|
78
|
-
}, 0);
|
|
79
|
-
} else {
|
|
80
|
-
var flatValues = _superPropGet(HistogramChartComponent, "flatValues", this, 1);
|
|
81
|
-
max = Math.max.apply(Math, _toConsumableArray(flatValues));
|
|
82
|
-
}
|
|
83
|
-
return yScale !== null && yScale !== void 0 ? yScale : scaleLinear().range(invertAxis ? [marginY, plotWidth - this.plotPadding] : [plotHeight - marginX, this.plotPadding]).domain([0, max]);
|
|
12
|
+
class HistogramChartComponent extends AbstractChart {
|
|
13
|
+
get xScale() {
|
|
14
|
+
const {
|
|
15
|
+
xScale,
|
|
16
|
+
marginY = 30,
|
|
17
|
+
marginX = 30,
|
|
18
|
+
plotWidth,
|
|
19
|
+
plotHeight,
|
|
20
|
+
invertAxis,
|
|
21
|
+
data,
|
|
22
|
+
groupKey
|
|
23
|
+
} = this.asProps;
|
|
24
|
+
if (xScale) {
|
|
25
|
+
return xScale;
|
|
84
26
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
return
|
|
27
|
+
const testItem = data[0][groupKey];
|
|
28
|
+
const range = invertAxis ? [plotHeight - marginX, this.plotPadding] : [marginY, plotWidth - this.plotPadding];
|
|
29
|
+
if (testItem instanceof Date && !Number.isNaN(testItem.getMilliseconds())) {
|
|
30
|
+
const domain = minMax(data, groupKey);
|
|
31
|
+
return scaleTime(domain, range);
|
|
90
32
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
if (invertAxis) {
|
|
111
|
-
commonBarComponentProps.x = item.id;
|
|
112
|
-
} else {
|
|
113
|
-
commonBarComponentProps.y = item.id;
|
|
33
|
+
const domain = data.map(item => item[groupKey]);
|
|
34
|
+
return scaleBand(domain, range).paddingInner(0.05).paddingOuter(0.2);
|
|
35
|
+
}
|
|
36
|
+
get yScale() {
|
|
37
|
+
const {
|
|
38
|
+
yScale,
|
|
39
|
+
marginY = 30,
|
|
40
|
+
marginX = 30,
|
|
41
|
+
plotHeight,
|
|
42
|
+
plotWidth,
|
|
43
|
+
invertAxis,
|
|
44
|
+
data
|
|
45
|
+
} = this.asProps;
|
|
46
|
+
let max;
|
|
47
|
+
if (this.isStack) {
|
|
48
|
+
max = data.reduce((max, item) => {
|
|
49
|
+
const barSum = Object.values(item).reduce((sum, val) => {
|
|
50
|
+
if (val instanceof Date && !Number.isNaN(val.getMilliseconds())) {
|
|
51
|
+
return sum + val.getMilliseconds();
|
|
114
52
|
}
|
|
115
|
-
return
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
color: item.color
|
|
126
|
-
});
|
|
53
|
+
return sum + val;
|
|
54
|
+
}, 0);
|
|
55
|
+
if (barSum > max) {
|
|
56
|
+
max = barSum;
|
|
57
|
+
}
|
|
58
|
+
return max;
|
|
59
|
+
}, 0);
|
|
60
|
+
} else {
|
|
61
|
+
const flatValues = super.flatValues;
|
|
62
|
+
max = Math.max(...flatValues);
|
|
127
63
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
64
|
+
return yScale ?? scaleLinear().range(invertAxis ? [marginY, plotWidth - this.plotPadding] : [plotHeight - marginX, this.plotPadding]).domain([0, max]);
|
|
65
|
+
}
|
|
66
|
+
get isStack() {
|
|
67
|
+
const {
|
|
68
|
+
dataDefinitions
|
|
69
|
+
} = this.state;
|
|
70
|
+
return dataDefinitions.length > 1;
|
|
71
|
+
}
|
|
72
|
+
renderChart() {
|
|
73
|
+
const {
|
|
74
|
+
groupKey,
|
|
75
|
+
invertAxis
|
|
76
|
+
} = this.asProps;
|
|
77
|
+
const {
|
|
78
|
+
dataDefinitions,
|
|
79
|
+
highlightedLine
|
|
80
|
+
} = this.state;
|
|
81
|
+
if (this.isStack) {
|
|
82
|
+
return /*#__PURE__*/React.createElement(StackBar, {
|
|
137
83
|
x: invertAxis ? undefined : groupKey,
|
|
138
|
-
y: invertAxis ? groupKey : undefined
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
var dataItem = data[index];
|
|
145
|
-
return {
|
|
146
|
-
children: _this.getTooltipChildren({
|
|
147
|
-
Tooltip: HoverRect.Tooltip,
|
|
148
|
-
dataItem: dataItem
|
|
149
|
-
})
|
|
84
|
+
y: invertAxis ? groupKey : undefined
|
|
85
|
+
}, dataDefinitions.map((item, index) => {
|
|
86
|
+
const BarComponent = invertAxis ? StackBar.HorizontalBar : StackBar.Bar;
|
|
87
|
+
const commonBarComponentProps = {
|
|
88
|
+
color: item.color,
|
|
89
|
+
transparent: highlightedLine !== -1 && highlightedLine !== index
|
|
150
90
|
};
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
91
|
+
if (invertAxis) {
|
|
92
|
+
commonBarComponentProps.x = item.id;
|
|
93
|
+
} else {
|
|
94
|
+
commonBarComponentProps.y = item.id;
|
|
95
|
+
}
|
|
96
|
+
return item.checked && /*#__PURE__*/React.createElement(BarComponent, _extends({
|
|
97
|
+
key: item.id
|
|
98
|
+
}, commonBarComponentProps));
|
|
99
|
+
}));
|
|
159
100
|
}
|
|
160
|
-
|
|
161
|
-
|
|
101
|
+
const item = dataDefinitions[0];
|
|
102
|
+
return item.checked && /*#__PURE__*/React.createElement(Bar, {
|
|
103
|
+
x: invertAxis ? item.id : groupKey,
|
|
104
|
+
y: invertAxis ? groupKey : item.id,
|
|
105
|
+
key: item.id,
|
|
106
|
+
color: item.color
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
renderTooltip() {
|
|
110
|
+
const {
|
|
111
|
+
data,
|
|
112
|
+
groupKey,
|
|
113
|
+
invertAxis
|
|
114
|
+
} = this.asProps;
|
|
115
|
+
return /*#__PURE__*/React.createElement(HoverRect.Tooltip, {
|
|
116
|
+
x: invertAxis ? undefined : groupKey,
|
|
117
|
+
y: invertAxis ? groupKey : undefined,
|
|
118
|
+
wMin: 100
|
|
119
|
+
}, ({
|
|
120
|
+
xIndex,
|
|
121
|
+
yIndex
|
|
122
|
+
}) => {
|
|
123
|
+
const index = invertAxis ? yIndex : xIndex;
|
|
124
|
+
const dataItem = data[index];
|
|
125
|
+
return {
|
|
126
|
+
children: this.getTooltipChildren({
|
|
127
|
+
Tooltip: HoverRect.Tooltip,
|
|
128
|
+
dataItem
|
|
129
|
+
})
|
|
130
|
+
};
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
getLegendAriaLabel() {
|
|
134
|
+
return this.asProps.getI18nText('legendForChart', {
|
|
135
|
+
chartType: 'Histogram'
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
162
139
|
_defineProperty(HistogramChartComponent, "displayName", 'Chart.Histogram');
|
|
163
140
|
_defineProperty(HistogramChartComponent, "enhance", [i18nEnhance(localizedMessages)]);
|
|
164
|
-
export
|
|
141
|
+
export const HistogramChart = createComponent(HistogramChartComponent);
|
|
165
142
|
//# sourceMappingURL=HistogramChart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HistogramChart.js","names":["createComponent","i18nEnhance","scaleBand","scaleLinear","scaleTime","React","Bar","minMax","HoverRect","StackBar","AbstractChart","localizedMessages","HistogramChartComponent","_AbstractChart","_classCallCheck","_callSuper","arguments","_inherits","_createClass","key","get","_this$asProps","asProps","xScale","_this$asProps$marginY","marginY","_this$asProps$marginX","marginX","plotWidth","plotHeight","invertAxis","data","groupKey","testItem","range","plotPadding","Date","Number","isNaN","getMilliseconds","domain","map","item","paddingInner","paddingOuter","_this$asProps2","yScale","_this$asProps2$margin","_this$asProps2$margin2","max","isStack","reduce","barSum","Object","values","sum","val","flatValues","_superPropGet","Math","apply","_toConsumableArray","dataDefinitions","state","length","value","renderChart","_this$asProps3","_this$state","highlightedLine","createElement","x","undefined","y","index","BarComponent","HorizontalBar","commonBarComponentProps","color","transparent","id","checked","_extends","renderTooltip","_this","_this$asProps4","Tooltip","wMin","_ref","xIndex","yIndex","dataItem","children","getTooltipChildren","getLegendAriaLabel","getI18nText","chartType","_defineProperty","HistogramChart"],"sources":["../../../../src/component/Chart/HistogramChart.tsx"],"sourcesContent":["import { createComponent } from '@semcore/core';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport { scaleBand, scaleLinear, type ScaleLinear, scaleTime } from 'd3-scale';\nimport React from 'react';\n\n// @ts-ignore\nimport { Bar, minMax, HoverRect, StackBar, type BarProps } from '../..';\nimport { AbstractChart } from './AbstractChart';\nimport type { HistogramChartData, HistogramChartProps, HistogramChartType } from './HistogramChart.type';\nimport { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';\n\nclass HistogramChartComponent extends AbstractChart<\n HistogramChartData,\n HistogramChartProps,\n typeof HistogramChartComponent.enhance\n> {\n static displayName = 'Chart.Histogram';\n\n static enhance = [i18nEnhance(localizedMessages)] as const;\n\n get xScale() {\n const {\n xScale,\n marginY = 30,\n marginX = 30,\n plotWidth,\n plotHeight,\n invertAxis,\n data,\n groupKey,\n } = this.asProps;\n\n if (xScale) {\n return xScale;\n }\n\n const testItem = data[0][groupKey];\n const range = invertAxis\n ? [plotHeight - marginX, this.plotPadding]\n : [marginY, plotWidth - this.plotPadding];\n\n if (testItem instanceof Date && !Number.isNaN(testItem.getMilliseconds())) {\n const domain = minMax(data, groupKey);\n\n return scaleTime(domain, range);\n }\n\n const domain = data.map((item) => item[groupKey]);\n\n return scaleBand(domain, range).paddingInner(0.05).paddingOuter(0.2);\n }\n\n get yScale(): ScaleLinear<any, any> {\n const {\n yScale,\n marginY = 30,\n marginX = 30,\n plotHeight,\n plotWidth,\n invertAxis,\n data,\n } = this.asProps;\n\n let max: number;\n\n if (this.isStack) {\n max = data.reduce((max, item) => {\n const barSum = Object.values(item).reduce<number>((sum, val) => {\n if (val instanceof Date && !Number.isNaN(val.getMilliseconds())) {\n return sum + val.getMilliseconds();\n }\n\n return sum + (val as number);\n }, 0);\n\n if (barSum > max) {\n max = barSum;\n }\n\n return max;\n }, 0);\n } else {\n const flatValues = super.flatValues;\n\n max = Math.max(...flatValues);\n }\n\n return (\n yScale ??\n scaleLinear()\n .range(\n invertAxis\n ? [marginY, plotWidth - this.plotPadding]\n : [plotHeight - marginX, this.plotPadding],\n )\n .domain([0, max])\n );\n }\n\n get isStack(): boolean {\n const { dataDefinitions } = this.state;\n\n return dataDefinitions.length > 1;\n }\n\n renderChart() {\n const { groupKey, invertAxis } = this.asProps;\n const { dataDefinitions, highlightedLine } = this.state;\n\n if (this.isStack) {\n return (\n <StackBar x={invertAxis ? undefined : groupKey} y={invertAxis ? groupKey : undefined}>\n {dataDefinitions.map((item, index) => {\n const BarComponent = invertAxis ? StackBar.HorizontalBar : StackBar.Bar;\n\n const commonBarComponentProps: BarProps = {\n color: item.color,\n transparent: highlightedLine !== -1 && highlightedLine !== index,\n };\n\n if (invertAxis) {\n commonBarComponentProps.x = item.id;\n } else {\n commonBarComponentProps.y = item.id;\n }\n\n return item.checked && <BarComponent key={item.id} {...commonBarComponentProps} />;\n })}\n </StackBar>\n );\n }\n\n const item = dataDefinitions[0];\n\n return (\n item.checked && (\n <Bar\n x={invertAxis ? item.id : groupKey}\n y={invertAxis ? groupKey : item.id}\n key={item.id}\n color={item.color}\n />\n )\n );\n }\n\n renderTooltip(): React.ReactNode {\n const { data, groupKey, invertAxis } = this.asProps;\n\n return (\n <HoverRect.Tooltip\n x={invertAxis ? undefined : groupKey}\n y={invertAxis ? groupKey : undefined}\n wMin={100}\n >\n {({ xIndex, yIndex }: any) => {\n const index = invertAxis ? yIndex : xIndex;\n const dataItem = data[index];\n\n return {\n children: this.getTooltipChildren({\n Tooltip: HoverRect.Tooltip,\n dataItem,\n }),\n };\n }}\n </HoverRect.Tooltip>\n );\n }\n\n protected getLegendAriaLabel(): string {\n return this.asProps.getI18nText('legendForChart', { chartType: 'Histogram' });\n }\n}\n\nexport const HistogramChart: HistogramChartType = createComponent(HistogramChartComponent);\n"],"mappings":";;;;;;;;AAAA,SAASA,eAAe,QAAQ,eAAe;AAC/C,OAAOC,WAAW,MAAM,8CAA8C;AACtE,SAASC,SAAS,EAAEC,WAAW,EAAoBC,SAAS,QAAQ,UAAU;AAC9E,OAAOC,KAAK,MAAM,OAAO;;AAEzB;AACA,SAASC,GAAG,EAAEC,MAAM,EAAEC,SAAS,EAAEC,QAAQ,QAAuB,OAAO;AACvE,SAASC,aAAa,QAAQ,iBAAiB;AAE/C,SAASC,iBAAiB,QAAQ,oDAAoD;AAAC,IAEjFC,uBAAuB,0BAAAC,cAAA;EAAA,SAAAD,wBAAA;IAAAE,eAAA,OAAAF,uBAAA;IAAA,OAAAG,UAAA,OAAAH,uBAAA,EAAAI,SAAA;EAAA;EAAAC,SAAA,CAAAL,uBAAA,EAAAC,cAAA;EAAA,OAAAK,YAAA,CAAAN,uBAAA;IAAAO,GAAA;IAAAC,GAAA,EAS3B,SAAAA,IAAA,EAAa;MACX,IAAAC,aAAA,GASI,IAAI,CAACC,OAAO;QARdC,MAAM,GAAAF,aAAA,CAANE,MAAM;QAAAC,qBAAA,GAAAH,aAAA,CACNI,OAAO;QAAPA,OAAO,GAAAD,qBAAA,cAAG,EAAE,GAAAA,qBAAA;QAAAE,qBAAA,GAAAL,aAAA,CACZM,OAAO;QAAPA,OAAO,GAAAD,qBAAA,cAAG,EAAE,GAAAA,qBAAA;QACZE,SAAS,GAAAP,aAAA,CAATO,SAAS;QACTC,UAAU,GAAAR,aAAA,CAAVQ,UAAU;QACVC,UAAU,GAAAT,aAAA,CAAVS,UAAU;QACVC,IAAI,GAAAV,aAAA,CAAJU,IAAI;QACJC,QAAQ,GAAAX,aAAA,CAARW,QAAQ;MAGV,IAAIT,MAAM,EAAE;QACV,OAAOA,MAAM;MACf;MA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ACrC,OAAO,IAAI,CAACxE,OAAO,CAACyE,WAAW,CAAC,gBAAgB,EAAE;QAAEC,SAAS,EAAE;MAAY,CAAC,CAAC;IAC/E;EAAC;AAAA,EAjKmCtF,aAAa;AAAAuF,eAAA,CAA7CrF,uBAAuB,iBAKN,iBAAiB;AAAAqF,eAAA,CALlCrF,uBAAuB,aAOV,CAACX,WAAW,CAACU,iBAAiB,CAAC,CAAC;AA6JnD,OAAO,IAAMuF,cAAkC,GAAGlG,eAAe,CAACY,uBAAuB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"HistogramChart.js","names":["createComponent","i18nEnhance","scaleBand","scaleLinear","scaleTime","React","Bar","minMax","HoverRect","StackBar","AbstractChart","localizedMessages","HistogramChartComponent","xScale","marginY","marginX","plotWidth","plotHeight","invertAxis","data","groupKey","asProps","testItem","range","plotPadding","Date","Number","isNaN","getMilliseconds","domain","map","item","paddingInner","paddingOuter","yScale","max","isStack","reduce","barSum","Object","values","sum","val","flatValues","Math","dataDefinitions","state","length","renderChart","highlightedLine","createElement","x","undefined","y","index","BarComponent","HorizontalBar","commonBarComponentProps","color","transparent","id","checked","_extends","key","renderTooltip","Tooltip","wMin","xIndex","yIndex","dataItem","children","getTooltipChildren","getLegendAriaLabel","getI18nText","chartType","_defineProperty","HistogramChart"],"sources":["../../../../src/component/Chart/HistogramChart.tsx"],"sourcesContent":["import { createComponent } from '@semcore/core';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport { scaleBand, scaleLinear, type ScaleLinear, scaleTime } from 'd3-scale';\nimport React from 'react';\n\n// @ts-ignore\nimport { Bar, minMax, HoverRect, StackBar, type BarProps } from '../..';\nimport { AbstractChart } from './AbstractChart';\nimport type { HistogramChartData, HistogramChartProps, HistogramChartType } from './HistogramChart.type';\nimport { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';\n\nclass HistogramChartComponent extends AbstractChart<\n HistogramChartData,\n HistogramChartProps,\n typeof HistogramChartComponent.enhance\n> {\n static displayName = 'Chart.Histogram';\n\n static enhance = [i18nEnhance(localizedMessages)] as const;\n\n get xScale() {\n const {\n xScale,\n marginY = 30,\n marginX = 30,\n plotWidth,\n plotHeight,\n invertAxis,\n data,\n groupKey,\n } = this.asProps;\n\n if (xScale) {\n return xScale;\n }\n\n const testItem = data[0][groupKey];\n const range = invertAxis\n ? [plotHeight - marginX, this.plotPadding]\n : [marginY, plotWidth - this.plotPadding];\n\n if (testItem instanceof Date && !Number.isNaN(testItem.getMilliseconds())) {\n const domain = minMax(data, groupKey);\n\n return scaleTime(domain, range);\n }\n\n const domain = data.map((item) => item[groupKey]);\n\n return scaleBand(domain, range).paddingInner(0.05).paddingOuter(0.2);\n }\n\n get yScale(): ScaleLinear<any, any> {\n const {\n yScale,\n marginY = 30,\n marginX = 30,\n plotHeight,\n plotWidth,\n invertAxis,\n data,\n } = this.asProps;\n\n let max: number;\n\n if (this.isStack) {\n max = data.reduce((max, item) => {\n const barSum = Object.values(item).reduce<number>((sum, val) => {\n if (val instanceof Date && !Number.isNaN(val.getMilliseconds())) {\n return sum + val.getMilliseconds();\n }\n\n return sum + (val as number);\n }, 0);\n\n if (barSum > max) {\n max = barSum;\n }\n\n return max;\n }, 0);\n } else {\n const flatValues = super.flatValues;\n\n max = Math.max(...flatValues);\n }\n\n return (\n yScale ??\n scaleLinear()\n .range(\n invertAxis\n ? [marginY, plotWidth - this.plotPadding]\n : [plotHeight - marginX, this.plotPadding],\n )\n .domain([0, max])\n );\n }\n\n get isStack(): boolean {\n const { dataDefinitions } = this.state;\n\n return dataDefinitions.length > 1;\n }\n\n renderChart() {\n const { groupKey, invertAxis } = this.asProps;\n const { dataDefinitions, highlightedLine } = this.state;\n\n if (this.isStack) {\n return (\n <StackBar x={invertAxis ? undefined : groupKey} y={invertAxis ? groupKey : undefined}>\n {dataDefinitions.map((item, index) => {\n const BarComponent = invertAxis ? StackBar.HorizontalBar : StackBar.Bar;\n\n const commonBarComponentProps: BarProps = {\n color: item.color,\n transparent: highlightedLine !== -1 && highlightedLine !== index,\n };\n\n if (invertAxis) {\n commonBarComponentProps.x = item.id;\n } else {\n commonBarComponentProps.y = item.id;\n }\n\n return item.checked && <BarComponent key={item.id} {...commonBarComponentProps} />;\n })}\n </StackBar>\n );\n }\n\n const item = dataDefinitions[0];\n\n return (\n item.checked && (\n <Bar\n x={invertAxis ? item.id : groupKey}\n y={invertAxis ? groupKey : item.id}\n key={item.id}\n color={item.color}\n />\n )\n );\n }\n\n renderTooltip(): React.ReactNode {\n const { data, groupKey, invertAxis } = this.asProps;\n\n return (\n <HoverRect.Tooltip\n x={invertAxis ? undefined : groupKey}\n y={invertAxis ? groupKey : undefined}\n wMin={100}\n >\n {({ xIndex, yIndex }: any) => {\n const index = invertAxis ? yIndex : xIndex;\n const dataItem = data[index];\n\n return {\n children: this.getTooltipChildren({\n Tooltip: HoverRect.Tooltip,\n dataItem,\n }),\n };\n }}\n </HoverRect.Tooltip>\n );\n }\n\n protected getLegendAriaLabel(): string {\n return this.asProps.getI18nText('legendForChart', { chartType: 'Histogram' });\n }\n}\n\nexport const HistogramChart: HistogramChartType = createComponent(HistogramChartComponent);\n"],"mappings":";;AAAA,SAASA,eAAe,QAAQ,eAAe;AAC/C,OAAOC,WAAW,MAAM,8CAA8C;AACtE,SAASC,SAAS,EAAEC,WAAW,EAAoBC,SAAS,QAAQ,UAAU;AAC9E,OAAOC,KAAK,MAAM,OAAO;;AAEzB;AACA,SAASC,GAAG,EAAEC,MAAM,EAAEC,SAAS,EAAEC,QAAQ,QAAuB,OAAO;AACvE,SAASC,aAAa,QAAQ,iBAAiB;AAE/C,SAASC,iBAAiB,QAAQ,oDAAoD;AAEtF,MAAMC,uBAAuB,SAASF,aAAa,CAIjD;EAKA,IAAIG,MAAMA,CAAA,EAAG;IACX,MAAM;MACJA,MAAM;MACNC,OAAO,GAAG,EAAE;MACZC,OAAO,GAAG,EAAE;MACZC,SAAS;MACTC,UAAU;MACVC,UAAU;MACVC,IAAI;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AU,GAAGkC,SAAS,GAAGhC,QAAS;MACrCiC,CAAC,EAAEnC,UAAU,GAAGE,QAAQ,GAAGgC,SAAU;MACrCc,IAAI,EAAE;IAAI,GAET,CAAC;MAAEC,MAAM;MAAEC;IAAY,CAAC,KAAK;MAC5B,MAAMd,KAAK,GAAGpC,UAAU,GAAGkD,MAAM,GAAGD,MAAM;MAC1C,MAAME,QAAQ,GAAGlD,IAAI,CAACmC,KAAK,CAAC;MAE5B,OAAO;QACLgB,QAAQ,EAAE,IAAI,CAACC,kBAAkB,CAAC;UAChCN,OAAO,EAAEzD,SAAS,CAACyD,OAAO;UAC1BI;QACF,CAAC;MACH,CAAC;IACH,CACiB,CAAC;EAExB;EAEUG,kBAAkBA,CAAA,EAAW;IACrC,OAAO,IAAI,CAACnD,OAAO,CAACoD,WAAW,CAAC,gBAAgB,EAAE;MAAEC,SAAS,EAAE;IAAY,CAAC,CAAC;EAC/E;AACF;AAACC,eAAA,CAlKK/D,uBAAuB,iBAKN,iBAAiB;AAAA+D,eAAA,CALlC/D,uBAAuB,aAOV,CAACX,WAAW,CAACU,iBAAiB,CAAC,CAAC;AA6JnD,OAAO,MAAMiE,cAAkC,GAAG5E,eAAe,CAACY,uBAAuB,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HistogramChart.type.js","names":[],"sources":["../../../../src/component/Chart/HistogramChart.type.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"HistogramChart.type.js","names":[],"sources":["../../../../src/component/Chart/HistogramChart.type.ts"],"sourcesContent":["import type { Flex } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport type { ScaleBand, ScaleLinear, ScaleTime } from 'd3-scale';\n\nimport type { BaseChartProps } from './AbstractChart.type';\n\nexport type HistogramChartData = Array<Record<string, number | Date>>;\n\nexport type HistogramChartProps = BaseChartProps<HistogramChartData> & {\n /** Field name that groups the data points */\n groupKey: string;\n /** Custom x-axis scale */\n xScale?: ScaleBand<any> | ScaleTime<any, any>;\n /** Custom y-axis scale */\n yScale?: ScaleLinear<any, any>;\n};\n\nexport type HistogramChartType = Intergalactic.Component<typeof Flex, HistogramChartProps>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import _callSuper from "@babel/runtime/helpers/callSuper";
|
|
5
|
-
import _superPropGet from "@babel/runtime/helpers/superPropGet";
|
|
6
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
2
|
import { createComponent } from '@semcore/core';
|
|
9
3
|
import i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';
|
|
@@ -13,112 +7,99 @@ import React from 'react';
|
|
|
13
7
|
import { Line, minMax, HoverLine } from '../..';
|
|
14
8
|
import { AbstractChart } from './AbstractChart';
|
|
15
9
|
import { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
_this$asProps$marginY = _this$asProps.marginY,
|
|
28
|
-
marginY = _this$asProps$marginY === void 0 ? 30 : _this$asProps$marginY,
|
|
29
|
-
plotWidth = _this$asProps.plotWidth,
|
|
30
|
-
data = _this$asProps.data,
|
|
31
|
-
groupKey = _this$asProps.groupKey;
|
|
32
|
-
if (xScale) {
|
|
33
|
-
return xScale;
|
|
34
|
-
}
|
|
35
|
-
var testItem = data[0][groupKey];
|
|
36
|
-
var range = [marginY, plotWidth - this.plotPadding];
|
|
37
|
-
var domain = minMax(data, groupKey);
|
|
38
|
-
if (testItem instanceof Date && !Number.isNaN(testItem.getMilliseconds())) {
|
|
39
|
-
return scaleTime(domain, range);
|
|
40
|
-
}
|
|
41
|
-
return scaleLinear(domain, range);
|
|
42
|
-
}
|
|
43
|
-
}, {
|
|
44
|
-
key: "yScale",
|
|
45
|
-
get: function get() {
|
|
46
|
-
var _this$asProps2 = this.asProps,
|
|
47
|
-
yScale = _this$asProps2.yScale,
|
|
48
|
-
_this$asProps2$margin = _this$asProps2.marginX,
|
|
49
|
-
marginX = _this$asProps2$margin === void 0 ? 30 : _this$asProps2$margin,
|
|
50
|
-
plotHeight = _this$asProps2.plotHeight;
|
|
51
|
-
if (yScale) {
|
|
52
|
-
return yScale;
|
|
53
|
-
}
|
|
54
|
-
var flatValues = _superPropGet(LineChartComponent, "flatValues", this, 1);
|
|
55
|
-
var max = Math.max.apply(Math, _toConsumableArray(flatValues));
|
|
56
|
-
var min = Math.min.apply(Math, _toConsumableArray(flatValues));
|
|
57
|
-
return scaleLinear().range([plotHeight - marginX, this.plotPadding]).domain([min, max]);
|
|
10
|
+
class LineChartComponent extends AbstractChart {
|
|
11
|
+
get xScale() {
|
|
12
|
+
const {
|
|
13
|
+
xScale,
|
|
14
|
+
marginY = 30,
|
|
15
|
+
plotWidth,
|
|
16
|
+
data,
|
|
17
|
+
groupKey
|
|
18
|
+
} = this.asProps;
|
|
19
|
+
if (xScale) {
|
|
20
|
+
return xScale;
|
|
58
21
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
curve = _this$asProps3.curve,
|
|
65
|
-
showDots = _this$asProps3.showDots,
|
|
66
|
-
area = _this$asProps3.area,
|
|
67
|
-
areaCurve = _this$asProps3.areaCurve,
|
|
68
|
-
onClickLine = _this$asProps3.onClickLine;
|
|
69
|
-
var _this$state = this.state,
|
|
70
|
-
dataDefinitions = _this$state.dataDefinitions,
|
|
71
|
-
highlightedLine = _this$state.highlightedLine;
|
|
72
|
-
return dataDefinitions.map(function (item, index) {
|
|
73
|
-
return item.checked && /*#__PURE__*/React.createElement(Line, {
|
|
74
|
-
x: groupKey.toString(),
|
|
75
|
-
y: item.id,
|
|
76
|
-
key: item.id,
|
|
77
|
-
color: item.color,
|
|
78
|
-
transparent: highlightedLine !== -1 && highlightedLine !== index,
|
|
79
|
-
curve: curve,
|
|
80
|
-
onClick: onClickLine
|
|
81
|
-
}, showDots && /*#__PURE__*/React.createElement(Line.Dots, {
|
|
82
|
-
display: true
|
|
83
|
-
}), (area === null || area === void 0 ? void 0 : area[item.id]) && /*#__PURE__*/React.createElement(Line.Area, {
|
|
84
|
-
area: area[item.id],
|
|
85
|
-
y0: "y0",
|
|
86
|
-
y1: "y1",
|
|
87
|
-
curve: areaCurve
|
|
88
|
-
}));
|
|
89
|
-
});
|
|
22
|
+
const testItem = data[0][groupKey];
|
|
23
|
+
const range = [marginY, plotWidth - this.plotPadding];
|
|
24
|
+
const domain = minMax(data, groupKey);
|
|
25
|
+
if (testItem instanceof Date && !Number.isNaN(testItem.getMilliseconds())) {
|
|
26
|
+
return scaleTime(domain, range);
|
|
90
27
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}, function (_ref) {
|
|
102
|
-
var xIndex = _ref.xIndex;
|
|
103
|
-
var dataItem = data[xIndex];
|
|
104
|
-
return {
|
|
105
|
-
children: _this.getTooltipChildren({
|
|
106
|
-
Tooltip: HoverLine.Tooltip,
|
|
107
|
-
dataItem: dataItem
|
|
108
|
-
})
|
|
109
|
-
};
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
}, {
|
|
113
|
-
key: "getLegendAriaLabel",
|
|
114
|
-
value: function getLegendAriaLabel() {
|
|
115
|
-
return this.asProps.getI18nText('legendForChart', {
|
|
116
|
-
chartType: 'Line'
|
|
117
|
-
});
|
|
28
|
+
return scaleLinear(domain, range);
|
|
29
|
+
}
|
|
30
|
+
get yScale() {
|
|
31
|
+
const {
|
|
32
|
+
yScale,
|
|
33
|
+
marginX = 30,
|
|
34
|
+
plotHeight
|
|
35
|
+
} = this.asProps;
|
|
36
|
+
if (yScale) {
|
|
37
|
+
return yScale;
|
|
118
38
|
}
|
|
119
|
-
|
|
120
|
-
|
|
39
|
+
const flatValues = super.flatValues;
|
|
40
|
+
const max = Math.max(...flatValues);
|
|
41
|
+
const min = Math.min(...flatValues);
|
|
42
|
+
return scaleLinear().range([plotHeight - marginX, this.plotPadding]).domain([min, max]);
|
|
43
|
+
}
|
|
44
|
+
renderChart() {
|
|
45
|
+
const {
|
|
46
|
+
groupKey,
|
|
47
|
+
curve,
|
|
48
|
+
showDots,
|
|
49
|
+
area,
|
|
50
|
+
areaCurve,
|
|
51
|
+
onClickLine
|
|
52
|
+
} = this.asProps;
|
|
53
|
+
const {
|
|
54
|
+
dataDefinitions,
|
|
55
|
+
highlightedLine
|
|
56
|
+
} = this.state;
|
|
57
|
+
return dataDefinitions.map((item, index) => {
|
|
58
|
+
return item.checked && /*#__PURE__*/React.createElement(Line, {
|
|
59
|
+
x: groupKey.toString(),
|
|
60
|
+
y: item.id,
|
|
61
|
+
key: item.id,
|
|
62
|
+
color: item.color,
|
|
63
|
+
transparent: highlightedLine !== -1 && highlightedLine !== index,
|
|
64
|
+
curve: curve,
|
|
65
|
+
onClick: onClickLine
|
|
66
|
+
}, showDots && /*#__PURE__*/React.createElement(Line.Dots, {
|
|
67
|
+
display: true
|
|
68
|
+
}), area?.[item.id] && /*#__PURE__*/React.createElement(Line.Area, {
|
|
69
|
+
area: area[item.id],
|
|
70
|
+
y0: "y0",
|
|
71
|
+
y1: "y1",
|
|
72
|
+
curve: areaCurve
|
|
73
|
+
}));
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
renderTooltip() {
|
|
77
|
+
const {
|
|
78
|
+
data,
|
|
79
|
+
groupKey
|
|
80
|
+
} = this.asProps;
|
|
81
|
+
return /*#__PURE__*/React.createElement(HoverLine.Tooltip, {
|
|
82
|
+
x: groupKey,
|
|
83
|
+
wMin: 100
|
|
84
|
+
}, ({
|
|
85
|
+
xIndex
|
|
86
|
+
}) => {
|
|
87
|
+
const dataItem = data[xIndex];
|
|
88
|
+
return {
|
|
89
|
+
children: this.getTooltipChildren({
|
|
90
|
+
Tooltip: HoverLine.Tooltip,
|
|
91
|
+
dataItem
|
|
92
|
+
})
|
|
93
|
+
};
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
getLegendAriaLabel() {
|
|
97
|
+
return this.asProps.getI18nText('legendForChart', {
|
|
98
|
+
chartType: 'Line'
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
121
102
|
_defineProperty(LineChartComponent, "displayName", 'Chart.Line');
|
|
122
103
|
_defineProperty(LineChartComponent, "enhance", [i18nEnhance(localizedMessages)]);
|
|
123
|
-
export
|
|
104
|
+
export const LineChart = createComponent(LineChartComponent);
|
|
124
105
|
//# sourceMappingURL=LineChart.js.map
|