@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,10 +1,4 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
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';
|
|
@@ -12,231 +6,249 @@ import { scaleBand, scaleLinear, scaleTime } from 'd3-scale';
|
|
|
12
6
|
import React from 'react';
|
|
13
7
|
import { AbstractChart } from './AbstractChart';
|
|
14
8
|
// @ts-ignore
|
|
15
|
-
import { minMax, GroupBar, HoverRect, StackBar, Line } from '../..';
|
|
9
|
+
import { minMax, GroupBar, HoverRect, StackBar, Line, YAxis, XAxis } from '../..';
|
|
16
10
|
import { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
_this = _callSuper(this, BarChartComponent, [].concat(args));
|
|
25
|
-
_defineProperty(_this, "handleClickBar", function (_data, e, barIndex, barKey) {
|
|
26
|
-
var onClickBar = _this.asProps.onClickBar;
|
|
11
|
+
class BarChartComponent extends AbstractChart {
|
|
12
|
+
constructor(...args) {
|
|
13
|
+
super(...args);
|
|
14
|
+
_defineProperty(this, "handleClickBar", (_data, e, barIndex, barKey) => {
|
|
15
|
+
const {
|
|
16
|
+
onClickBar
|
|
17
|
+
} = this.asProps;
|
|
27
18
|
if (onClickBar) {
|
|
28
19
|
onClickBar(barIndex, barKey, e);
|
|
29
20
|
}
|
|
30
21
|
});
|
|
31
|
-
return _this;
|
|
32
22
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (xScale) {
|
|
41
|
-
return xScale;
|
|
42
|
-
}
|
|
43
|
-
return invertAxis ? this.valueScale : this.categoryScale;
|
|
23
|
+
get xScale() {
|
|
24
|
+
const {
|
|
25
|
+
xScale,
|
|
26
|
+
invertAxis
|
|
27
|
+
} = this.asProps;
|
|
28
|
+
if (xScale) {
|
|
29
|
+
return xScale;
|
|
44
30
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return invertAxis ? this.categoryScale : this.valueScale;
|
|
31
|
+
return invertAxis ? this.valueScale : this.categoryScale;
|
|
32
|
+
}
|
|
33
|
+
get yScale() {
|
|
34
|
+
const {
|
|
35
|
+
yScale,
|
|
36
|
+
invertAxis
|
|
37
|
+
} = this.asProps;
|
|
38
|
+
if (yScale) {
|
|
39
|
+
return yScale;
|
|
55
40
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
return {};
|
|
41
|
+
return invertAxis ? this.categoryScale : this.valueScale;
|
|
42
|
+
}
|
|
43
|
+
defaultLegendProps() {
|
|
44
|
+
if (this.props.trend !== undefined) {
|
|
45
|
+
return {
|
|
46
|
+
withTrend: true
|
|
47
|
+
};
|
|
65
48
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
49
|
+
return {};
|
|
50
|
+
}
|
|
51
|
+
renderTrend(key) {
|
|
52
|
+
const {
|
|
53
|
+
groupKey,
|
|
54
|
+
invertAxis,
|
|
55
|
+
trend
|
|
56
|
+
} = this.asProps;
|
|
57
|
+
const {
|
|
58
|
+
withTrend
|
|
59
|
+
} = this.state;
|
|
60
|
+
const trendItem = trend?.[key];
|
|
61
|
+
if (withTrend && trendItem) {
|
|
62
|
+
return /*#__PURE__*/React.createElement(Line, {
|
|
63
|
+
data: trendItem,
|
|
64
|
+
key: `${key}_${groupKey}`,
|
|
65
|
+
x: invertAxis ? 'y' : 'x',
|
|
66
|
+
y: invertAxis ? 'x' : 'y',
|
|
67
|
+
color: "wall",
|
|
68
|
+
style: {
|
|
69
|
+
strokeWidth: 3,
|
|
70
|
+
strokeDasharray: 5
|
|
71
|
+
}
|
|
72
|
+
}, /*#__PURE__*/React.createElement(Line.Dots, {
|
|
73
|
+
data: trendItem,
|
|
74
|
+
display: true
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
renderChart() {
|
|
80
|
+
const {
|
|
81
|
+
groupKey,
|
|
82
|
+
type = 'group',
|
|
83
|
+
invertAxis
|
|
84
|
+
} = this.asProps;
|
|
85
|
+
const {
|
|
86
|
+
dataDefinitions,
|
|
87
|
+
highlightedLine
|
|
88
|
+
} = this.state;
|
|
89
|
+
if (dataDefinitions.length === 1) {
|
|
90
|
+
const item = dataDefinitions[0];
|
|
91
|
+
const BarComponent = invertAxis ? GroupBar.HorizontalBar : GroupBar.Bar;
|
|
92
|
+
return item.checked && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(BarComponent, {
|
|
93
|
+
x: invertAxis ? item.id : groupKey,
|
|
94
|
+
y: invertAxis ? groupKey : item.id,
|
|
95
|
+
key: item.id,
|
|
96
|
+
color: item.color,
|
|
97
|
+
onClick: this.handleClickBar
|
|
98
|
+
}), this.renderTrend(item.id));
|
|
92
99
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
type = _this$asProps4$type === void 0 ? 'group' : _this$asProps4$type,
|
|
101
|
-
invertAxis = _this$asProps4.invertAxis;
|
|
102
|
-
var _this$state = this.state,
|
|
103
|
-
dataDefinitions = _this$state.dataDefinitions,
|
|
104
|
-
highlightedLine = _this$state.highlightedLine;
|
|
105
|
-
if (dataDefinitions.length === 1) {
|
|
106
|
-
var item = dataDefinitions[0];
|
|
107
|
-
var BarComponent = invertAxis ? GroupBar.HorizontalBar : GroupBar.Bar;
|
|
108
|
-
return item.checked && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(BarComponent, {
|
|
109
|
-
x: invertAxis ? item.id : groupKey,
|
|
110
|
-
y: invertAxis ? groupKey : item.id,
|
|
111
|
-
key: item.id,
|
|
100
|
+
if (type === 'group') {
|
|
101
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(GroupBar, {
|
|
102
|
+
x: invertAxis ? undefined : groupKey,
|
|
103
|
+
y: invertAxis ? groupKey : undefined
|
|
104
|
+
}, dataDefinitions.map((item, index) => {
|
|
105
|
+
const BarComponent = invertAxis ? GroupBar.HorizontalBar : GroupBar.Bar;
|
|
106
|
+
const commonBarComponentProps = {
|
|
112
107
|
color: item.color,
|
|
108
|
+
transparent: highlightedLine !== -1 && highlightedLine !== index,
|
|
113
109
|
onClick: this.handleClickBar
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
transparent: highlightedLine !== -1 && highlightedLine !== index,
|
|
125
|
-
onClick: _this2.handleClickBar
|
|
126
|
-
};
|
|
127
|
-
if (invertAxis) {
|
|
128
|
-
commonBarComponentProps.x = item.id;
|
|
129
|
-
} else {
|
|
130
|
-
commonBarComponentProps.y = item.id;
|
|
131
|
-
}
|
|
132
|
-
return item.checked && /*#__PURE__*/React.createElement(BarComponent, _extends({
|
|
133
|
-
key: item.id
|
|
134
|
-
}, commonBarComponentProps));
|
|
135
|
-
})), dataDefinitions.map(function (item) {
|
|
136
|
-
return item.checked && _this2.renderTrend(item.id);
|
|
137
|
-
}));
|
|
138
|
-
}
|
|
139
|
-
if (type === 'stack') {
|
|
140
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StackBar, {
|
|
141
|
-
x: invertAxis ? undefined : groupKey,
|
|
142
|
-
y: invertAxis ? groupKey : undefined
|
|
143
|
-
}, dataDefinitions.map(function (item, index) {
|
|
144
|
-
var BarComponent = invertAxis ? StackBar.HorizontalBar : StackBar.Bar;
|
|
145
|
-
var commonBarComponentProps = {
|
|
146
|
-
color: item.color,
|
|
147
|
-
transparent: highlightedLine !== -1 && highlightedLine !== index,
|
|
148
|
-
onClick: _this2.handleClickBar
|
|
149
|
-
};
|
|
150
|
-
if (invertAxis) {
|
|
151
|
-
commonBarComponentProps.x = item.id;
|
|
152
|
-
} else {
|
|
153
|
-
commonBarComponentProps.y = item.id;
|
|
154
|
-
}
|
|
155
|
-
return item.checked && /*#__PURE__*/React.createElement(BarComponent, _extends({
|
|
156
|
-
key: item.id
|
|
157
|
-
}, commonBarComponentProps));
|
|
158
|
-
})), dataDefinitions.map(function (item) {
|
|
159
|
-
return item.checked && _this2.renderTrend(item.id);
|
|
160
|
-
}));
|
|
161
|
-
}
|
|
162
|
-
return null;
|
|
110
|
+
};
|
|
111
|
+
if (invertAxis) {
|
|
112
|
+
commonBarComponentProps.x = item.id;
|
|
113
|
+
} else {
|
|
114
|
+
commonBarComponentProps.y = item.id;
|
|
115
|
+
}
|
|
116
|
+
return item.checked && /*#__PURE__*/React.createElement(BarComponent, _extends({
|
|
117
|
+
key: item.id
|
|
118
|
+
}, commonBarComponentProps));
|
|
119
|
+
})), dataDefinitions.map(item => item.checked && this.renderTrend(item.id)));
|
|
163
120
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
value: function renderTooltip() {
|
|
167
|
-
var _this3 = this;
|
|
168
|
-
var _this$asProps5 = this.asProps,
|
|
169
|
-
data = _this$asProps5.data,
|
|
170
|
-
groupKey = _this$asProps5.groupKey,
|
|
171
|
-
invertAxis = _this$asProps5.invertAxis,
|
|
172
|
-
onClickHoverRect = _this$asProps5.onClickHoverRect;
|
|
173
|
-
return /*#__PURE__*/React.createElement(HoverRect.Tooltip, {
|
|
121
|
+
if (type === 'stack') {
|
|
122
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StackBar, {
|
|
174
123
|
x: invertAxis ? undefined : groupKey,
|
|
175
|
-
y: invertAxis ? groupKey : undefined
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
var dataItem = data[index];
|
|
183
|
-
return {
|
|
184
|
-
children: _this3.getTooltipChildren({
|
|
185
|
-
Tooltip: HoverRect.Tooltip,
|
|
186
|
-
dataItem: dataItem
|
|
187
|
-
})
|
|
124
|
+
y: invertAxis ? groupKey : undefined
|
|
125
|
+
}, dataDefinitions.map((item, index) => {
|
|
126
|
+
const BarComponent = invertAxis ? StackBar.HorizontalBar : StackBar.Bar;
|
|
127
|
+
const commonBarComponentProps = {
|
|
128
|
+
color: item.color,
|
|
129
|
+
transparent: highlightedLine !== -1 && highlightedLine !== index,
|
|
130
|
+
onClick: this.handleClickBar
|
|
188
131
|
};
|
|
189
|
-
|
|
132
|
+
if (invertAxis) {
|
|
133
|
+
commonBarComponentProps.x = item.id;
|
|
134
|
+
} else {
|
|
135
|
+
commonBarComponentProps.y = item.id;
|
|
136
|
+
}
|
|
137
|
+
return item.checked && /*#__PURE__*/React.createElement(BarComponent, _extends({
|
|
138
|
+
key: item.id
|
|
139
|
+
}, commonBarComponentProps));
|
|
140
|
+
})), dataDefinitions.map(item => item.checked && this.renderTrend(item.id)));
|
|
190
141
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
renderTooltip() {
|
|
145
|
+
const {
|
|
146
|
+
data,
|
|
147
|
+
groupKey,
|
|
148
|
+
invertAxis,
|
|
149
|
+
onClickHoverRect
|
|
150
|
+
} = this.asProps;
|
|
151
|
+
return /*#__PURE__*/React.createElement(HoverRect.Tooltip, {
|
|
152
|
+
x: invertAxis ? undefined : groupKey,
|
|
153
|
+
y: invertAxis ? groupKey : undefined,
|
|
154
|
+
wMin: 100,
|
|
155
|
+
onClick: onClickHoverRect
|
|
156
|
+
}, ({
|
|
157
|
+
xIndex,
|
|
158
|
+
yIndex
|
|
159
|
+
}) => {
|
|
160
|
+
const index = invertAxis ? yIndex : xIndex;
|
|
161
|
+
const dataItem = data[index];
|
|
162
|
+
return {
|
|
163
|
+
children: this.getTooltipChildren({
|
|
164
|
+
Tooltip: HoverRect.Tooltip,
|
|
165
|
+
dataItem
|
|
166
|
+
})
|
|
167
|
+
};
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
renderAxis() {
|
|
171
|
+
const {
|
|
172
|
+
invertAxis,
|
|
173
|
+
showXAxis,
|
|
174
|
+
showYAxis,
|
|
175
|
+
data,
|
|
176
|
+
axisXValueFormatter,
|
|
177
|
+
axisYValueFormatter,
|
|
178
|
+
multilineXTicks,
|
|
179
|
+
multilineYTicks
|
|
180
|
+
} = this.asProps;
|
|
181
|
+
if (!Array.isArray(data)) {
|
|
182
|
+
return null;
|
|
221
183
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
184
|
+
const xTicks = this.xTicks;
|
|
185
|
+
const yTicks = this.yTicks;
|
|
186
|
+
const childrenX = axisXValueFormatter ? ({
|
|
187
|
+
value
|
|
188
|
+
}) => ({
|
|
189
|
+
children: axisXValueFormatter(value)
|
|
190
|
+
}) : undefined;
|
|
191
|
+
const childrenY = axisYValueFormatter ? ({
|
|
192
|
+
value
|
|
193
|
+
}) => ({
|
|
194
|
+
children: axisYValueFormatter(value)
|
|
195
|
+
}) : undefined;
|
|
196
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, showYAxis && /*#__PURE__*/React.createElement(YAxis, null, yTicks ? /*#__PURE__*/React.createElement(YAxis.Ticks, {
|
|
197
|
+
primaryText: invertAxis,
|
|
198
|
+
multiline: multilineYTicks,
|
|
199
|
+
ticks: yTicks
|
|
200
|
+
}, childrenY) : /*#__PURE__*/React.createElement(YAxis.Ticks, {
|
|
201
|
+
primaryText: invertAxis,
|
|
202
|
+
multiline: multilineYTicks
|
|
203
|
+
}, childrenY), invertAxis !== true && (yTicks ? /*#__PURE__*/React.createElement(YAxis.Grid, {
|
|
204
|
+
ticks: yTicks
|
|
205
|
+
}) : /*#__PURE__*/React.createElement(YAxis.Grid, null))), showXAxis && /*#__PURE__*/React.createElement(XAxis, null, xTicks ? /*#__PURE__*/React.createElement(XAxis.Ticks, {
|
|
206
|
+
multiline: multilineXTicks,
|
|
207
|
+
ticks: xTicks
|
|
208
|
+
}, childrenX) : /*#__PURE__*/React.createElement(XAxis.Ticks, {
|
|
209
|
+
multiline: multilineXTicks
|
|
210
|
+
}, childrenX), invertAxis === true && (xTicks ? /*#__PURE__*/React.createElement(XAxis.Grid, {
|
|
211
|
+
ticks: xTicks
|
|
212
|
+
}) : /*#__PURE__*/React.createElement(XAxis.Grid, null))));
|
|
213
|
+
}
|
|
214
|
+
getLegendAriaLabel() {
|
|
215
|
+
return this.asProps.getI18nText('legendForChart', {
|
|
216
|
+
chartType: 'Bar'
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
get categoryScale() {
|
|
220
|
+
const {
|
|
221
|
+
marginY = 40,
|
|
222
|
+
marginX = 24,
|
|
223
|
+
plotWidth,
|
|
224
|
+
plotHeight,
|
|
225
|
+
invertAxis,
|
|
226
|
+
data,
|
|
227
|
+
groupKey
|
|
228
|
+
} = this.asProps;
|
|
229
|
+
const testItem = data[0][groupKey];
|
|
230
|
+
const range = invertAxis ? [plotHeight - marginX, this.plotPadding] : [marginY, plotWidth - this.plotPadding];
|
|
231
|
+
if (testItem instanceof Date && !Number.isNaN(testItem.getMilliseconds())) {
|
|
232
|
+
const domain = minMax(data, groupKey);
|
|
233
|
+
return scaleTime(domain, range);
|
|
236
234
|
}
|
|
237
|
-
|
|
238
|
-
|
|
235
|
+
const domain = data.map(item => item[groupKey]);
|
|
236
|
+
return scaleBand(domain, range).paddingInner(0.4).paddingOuter(0.2);
|
|
237
|
+
}
|
|
238
|
+
get valueScale() {
|
|
239
|
+
const {
|
|
240
|
+
marginY = 40,
|
|
241
|
+
marginX = 24,
|
|
242
|
+
plotWidth,
|
|
243
|
+
plotHeight,
|
|
244
|
+
invertAxis,
|
|
245
|
+
type
|
|
246
|
+
} = this.asProps;
|
|
247
|
+
const max = type === 'stack' ? super.maxStackedValue : Math.max(...super.flatValues);
|
|
248
|
+
return scaleLinear().range(invertAxis ? [marginY, plotWidth - this.plotPadding] : [plotHeight - marginX, this.plotPadding]).domain([0, max]);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
239
251
|
_defineProperty(BarChartComponent, "displayName", 'Chart.Bar');
|
|
240
252
|
_defineProperty(BarChartComponent, "enhance", [i18nEnhance(localizedMessages)]);
|
|
241
|
-
export
|
|
253
|
+
export const BarChart = createComponent(BarChartComponent);
|
|
242
254
|
//# sourceMappingURL=BarChart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BarChart.js","names":["createComponent","i18nEnhance","scaleBand","scaleLinear","scaleTime","React","AbstractChart","minMax","GroupBar","HoverRect","StackBar","Line","localizedMessages","BarChartComponent","_AbstractChart","_this","_classCallCheck","_len","arguments","length","args","Array","_key","_callSuper","concat","_defineProperty","_data","e","barIndex","barKey","onClickBar","asProps","_inherits","_createClass","key","get","_this$asProps","xScale","invertAxis","valueScale","categoryScale","_this$asProps2","yScale","value","defaultLegendProps","props","trend","undefined","withTrend","renderTrend","_this$asProps3","groupKey","state","trendItem","createElement","data","x","y","color","style","strokeWidth","strokeDasharray","Dots","display","renderChart","_this2","_this$asProps4","_this$asProps4$type","type","_this$state","dataDefinitions","highlightedLine","item","BarComponent","HorizontalBar","Bar","checked","Fragment","id","onClick","handleClickBar","map","index","commonBarComponentProps","transparent","_extends","renderTooltip","_this3","_this$asProps5","onClickHoverRect","Tooltip","wMin","_ref","xIndex","yIndex","dataItem","children","getTooltipChildren","getLegendAriaLabel","getI18nText","chartType","_this$asProps6","_this$asProps6$margin","marginY","_this$asProps6$margin2","marginX","plotWidth","plotHeight","testItem","range","plotPadding","Date","Number","isNaN","getMilliseconds","domain","paddingInner","paddingOuter","_this$asProps7","_this$asProps7$margin","_this$asProps7$margin2","max","_superPropGet","Math","apply","_toConsumableArray","BarChart"],"sources":["../../../../src/component/Chart/BarChart.tsx"],"sourcesContent":["import { createComponent } from '@semcore/core';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport { scaleBand, scaleLinear, scaleTime } from 'd3-scale';\nimport React from 'react';\n\nimport { AbstractChart } from './AbstractChart';\nimport type { BaseLegendProps } from './AbstractChart.type';\nimport type { BarChartData, BarChartProps, BarChartType } from './BarChart.type';\n// @ts-ignore\nimport { minMax, GroupBar, HoverRect, StackBar, Line } from '../..';\nimport { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';\nimport type { BarProps } from '../../types';\nimport type { LegendItemKey } from '../ChartLegend/LegendItem/LegendItem.type';\n\nclass BarChartComponent extends AbstractChart<\n BarChartData,\n BarChartProps,\n typeof BarChartComponent.enhance\n> {\n static displayName = 'Chart.Bar';\n\n static enhance = [i18nEnhance(localizedMessages)] as const;\n\n get xScale() {\n const { xScale, invertAxis } = this.asProps;\n\n if (xScale) {\n return xScale;\n }\n\n return invertAxis ? this.valueScale : this.categoryScale;\n }\n\n get yScale() {\n const { yScale, invertAxis } = this.asProps;\n\n if (yScale) {\n return yScale;\n }\n\n return invertAxis ? this.categoryScale : this.valueScale;\n }\n\n protected defaultLegendProps(): Partial<BaseLegendProps> {\n if (this.props.trend !== undefined) {\n return { withTrend: true };\n }\n\n return {};\n }\n\n renderTrend(key: LegendItemKey) {\n const { groupKey, invertAxis, trend } = this.asProps;\n const { withTrend } = this.state;\n const trendItem = trend?.[key];\n\n if (withTrend && trendItem) {\n return (\n <Line\n data={trendItem}\n key={`${key}_${groupKey}`}\n x={invertAxis ? 'y' : 'x'}\n y={invertAxis ? 'x' : 'y'}\n color='wall'\n style={{ strokeWidth: 3, strokeDasharray: 5 }}\n >\n <Line.Dots data={trendItem} display />\n </Line>\n );\n }\n\n return null;\n }\n\n renderChart() {\n const { groupKey, type = 'group', invertAxis } = this.asProps;\n const { dataDefinitions, highlightedLine } = this.state;\n\n if (dataDefinitions.length === 1) {\n const item = dataDefinitions[0];\n const BarComponent = invertAxis ? GroupBar.HorizontalBar : GroupBar.Bar;\n\n return (\n item.checked && (\n <>\n <BarComponent\n x={invertAxis ? item.id : groupKey}\n y={invertAxis ? groupKey : item.id}\n key={item.id}\n color={item.color}\n onClick={this.handleClickBar}\n />\n {this.renderTrend(item.id)}\n </>\n )\n );\n }\n\n if (type === 'group') {\n return (\n <>\n <GroupBar x={invertAxis ? undefined : groupKey} y={invertAxis ? groupKey : undefined}>\n {dataDefinitions.map((item, index) => {\n const BarComponent = invertAxis ? GroupBar.HorizontalBar : GroupBar.Bar;\n\n const commonBarComponentProps: BarProps = {\n color: item.color,\n transparent: highlightedLine !== -1 && highlightedLine !== index,\n onClick: this.handleClickBar,\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 </GroupBar>\n {dataDefinitions.map((item) => item.checked && this.renderTrend(item.id))}\n </>\n );\n }\n\n if (type === 'stack') {\n return (\n <>\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 onClick: this.handleClickBar,\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 {dataDefinitions.map((item) => item.checked && this.renderTrend(item.id))}\n </>\n );\n }\n\n return null;\n }\n\n renderTooltip(): React.ReactNode {\n const { data, groupKey, invertAxis, onClickHoverRect } = this.asProps;\n\n return (\n <HoverRect.Tooltip\n x={invertAxis ? undefined : groupKey}\n y={invertAxis ? groupKey : undefined}\n wMin={100}\n onClick={onClickHoverRect}\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: 'Bar' });\n }\n\n private handleClickBar = (\n _data: BarChartData[0],\n e: React.SyntheticEvent,\n barIndex: number,\n barKey: string,\n ) => {\n const { onClickBar } = this.asProps;\n\n if (onClickBar) {\n onClickBar(barIndex, barKey, e);\n }\n };\n\n private get categoryScale() {\n const {\n marginY = 40,\n marginX = 24,\n plotWidth,\n plotHeight,\n invertAxis,\n data,\n groupKey,\n } = this.asProps;\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.4).paddingOuter(0.2);\n }\n\n private get valueScale() {\n const { marginY = 40, marginX = 24, plotWidth, plotHeight, invertAxis, type } = this.asProps;\n\n const max = type === 'stack' ? super.maxStackedValue : Math.max(...super.flatValues);\n\n return scaleLinear()\n .range(\n invertAxis\n ? [marginY, plotWidth - this.plotPadding]\n : [plotHeight - marginX, this.plotPadding],\n )\n .domain([0, max]);\n }\n}\n\nexport const BarChart: BarChartType = createCompon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B,qBAAA,cAAG,EAAE,GAAAA,qBAAA;QAAAC,sBAAA,GAAAF,cAAA,CAAEb,OAAO;QAAPA,OAAO,GAAAe,sBAAA,cAAG,EAAE,GAAAA,sBAAA;QAAEd,SAAS,GAAAY,cAAA,CAATZ,SAAS;QAAEC,UAAU,GAAAW,cAAA,CAAVX,UAAU;QAAErE,UAAU,GAAAgF,cAAA,CAAVhF,UAAU;QAAE8B,IAAI,GAAAkD,cAAA,CAAJlD,IAAI;MAE3E,IAAMqD,GAAG,GAAGrD,IAAI,KAAK,OAAO,GAAAsD,aAAA,CAAA7G,iBAAA,gCAA2B8G,IAAI,CAACF,GAAG,CAAAG,KAAA,CAARD,IAAI,EAAAE,kBAAA,CAAAH,aAAA,CAAA7G,iBAAA,yBAAwB,CAAC;MAEpF,OAAOV,WAAW,CAAC,CAAC,CACjB0G,KAAK,CACJvE,UAAU,GACN,CAACiE,OAAO,EAAEG,SAAS,GAAG,IAAI,CAACI,WAAW,CAAC,GACvC,CAACH,UAAU,GAAGF,OAAO,EAAE,IAAI,CAACK,WAAW,CAC7C,CAAC,CACAK,MAAM,CAAC,CAAC,CAAC,EAAEM,GAAG,CAAC,CAAC;IACrB;EAAC;AAAA,EA9N6BnH,aAAa;AAAAmB,eAAA,CAAvCZ,iBAAiB,iBAKA,WAAW;AAAAY,eAAA,CAL5BZ,iBAAiB,aAOJ,CAACZ,WAAW,CAACW,iBAAiB,CAAC,CAAC;AA0NnD,OAAO,IAAMkH,QAAsB,GAAG9H,eAAe,CAACa,iBAAiB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"BarChart.js","names":["createComponent","i18nEnhance","scaleBand","scaleLinear","scaleTime","React","AbstractChart","minMax","GroupBar","HoverRect","StackBar","Line","YAxis","XAxis","localizedMessages","BarChartComponent","constructor","args","_defineProperty","_data","e","barIndex","barKey","onClickBar","asProps","xScale","invertAxis","valueScale","categoryScale","yScale","defaultLegendProps","props","trend","undefined","withTrend","renderTrend","key","groupKey","state","trendItem","createElement","data","x","y","color","style","strokeWidth","strokeDasharray","Dots","display","renderChart","type","dataDefinitions","highlightedLine","length","item","BarComponent","HorizontalBar","Bar","checked","Fragment","id","onClick","handleClickBar","map","index","commonBarComponentProps","transparent","_extends","renderTooltip","onClickHoverRect","Tooltip","wMin","xIndex","yIndex","dataItem","children","getTooltipChildren","renderAxis","showXAxis","showYAxis","axisXValueFormatter","axisYValueFormatter","multilineXTicks","multilineYTicks","Array","isArray","xTicks","yTicks","childrenX","value","childrenY","Ticks","primaryText","multiline","ticks","Grid","getLegendAriaLabel","getI18nText","chartType","marginY","marginX","plotWidth","plotHeight","testItem","range","plotPadding","Date","Number","isNaN","getMilliseconds","domain","paddingInner","paddingOuter","max","maxStackedValue","Math","flatValues","BarChart"],"sources":["../../../../src/component/Chart/BarChart.tsx"],"sourcesContent":["import { createComponent } from '@semcore/core';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport { scaleBand, scaleLinear, scaleTime } from 'd3-scale';\nimport React from 'react';\n\nimport { AbstractChart } from './AbstractChart';\nimport type { BaseLegendProps } from './AbstractChart.type';\nimport type { BarChartData, BarChartProps, BarChartType } from './BarChart.type';\n// @ts-ignore\nimport { minMax, GroupBar, HoverRect, StackBar, Line, YAxis, XAxis } from '../..';\nimport { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';\nimport type { BarProps } from '../../types';\nimport type { LegendItemKey } from '../ChartLegend/LegendItem/LegendItem.type';\n\nclass BarChartComponent extends AbstractChart<\n BarChartData,\n BarChartProps,\n typeof BarChartComponent.enhance\n> {\n static displayName = 'Chart.Bar';\n\n static enhance = [i18nEnhance(localizedMessages)] as const;\n\n get xScale() {\n const { xScale, invertAxis } = this.asProps;\n\n if (xScale) {\n return xScale;\n }\n\n return invertAxis ? this.valueScale : this.categoryScale;\n }\n\n get yScale() {\n const { yScale, invertAxis } = this.asProps;\n\n if (yScale) {\n return yScale;\n }\n\n return invertAxis ? this.categoryScale : this.valueScale;\n }\n\n protected defaultLegendProps(): Partial<BaseLegendProps> {\n if (this.props.trend !== undefined) {\n return { withTrend: true };\n }\n\n return {};\n }\n\n renderTrend(key: LegendItemKey) {\n const { groupKey, invertAxis, trend } = this.asProps;\n const { withTrend } = this.state;\n const trendItem = trend?.[key];\n\n if (withTrend && trendItem) {\n return (\n <Line\n data={trendItem}\n key={`${key}_${groupKey}`}\n x={invertAxis ? 'y' : 'x'}\n y={invertAxis ? 'x' : 'y'}\n color='wall'\n style={{ strokeWidth: 3, strokeDasharray: 5 }}\n >\n <Line.Dots data={trendItem} display />\n </Line>\n );\n }\n\n return null;\n }\n\n renderChart() {\n const { groupKey, type = 'group', invertAxis } = this.asProps;\n const { dataDefinitions, highlightedLine } = this.state;\n\n if (dataDefinitions.length === 1) {\n const item = dataDefinitions[0];\n const BarComponent = invertAxis ? GroupBar.HorizontalBar : GroupBar.Bar;\n\n return (\n item.checked && (\n <>\n <BarComponent\n x={invertAxis ? item.id : groupKey}\n y={invertAxis ? groupKey : item.id}\n key={item.id}\n color={item.color}\n onClick={this.handleClickBar}\n />\n {this.renderTrend(item.id)}\n </>\n )\n );\n }\n\n if (type === 'group') {\n return (\n <>\n <GroupBar x={invertAxis ? undefined : groupKey} y={invertAxis ? groupKey : undefined}>\n {dataDefinitions.map((item, index) => {\n const BarComponent = invertAxis ? GroupBar.HorizontalBar : GroupBar.Bar;\n\n const commonBarComponentProps: BarProps = {\n color: item.color,\n transparent: highlightedLine !== -1 && highlightedLine !== index,\n onClick: this.handleClickBar,\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 </GroupBar>\n {dataDefinitions.map((item) => item.checked && this.renderTrend(item.id))}\n </>\n );\n }\n\n if (type === 'stack') {\n return (\n <>\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 onClick: this.handleClickBar,\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 {dataDefinitions.map((item) => item.checked && this.renderTrend(item.id))}\n </>\n );\n }\n\n return null;\n }\n\n renderTooltip(): React.ReactNode {\n const { data, groupKey, invertAxis, onClickHoverRect } = this.asProps;\n\n return (\n <HoverRect.Tooltip\n x={invertAxis ? undefined : groupKey}\n y={invertAxis ? groupKey : undefined}\n wMin={100}\n onClick={onClickHoverRect}\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 override renderAxis(): React.ReactNode {\n const {\n invertAxis,\n showXAxis,\n showYAxis,\n data,\n axisXValueFormatter,\n axisYValueFormatter,\n multilineXTicks,\n multilineYTicks,\n } = this.asProps;\n\n if (!Array.isArray(data)) {\n return null;\n }\n\n const xTicks = this.xTicks;\n const yTicks = this.yTicks;\n\n const childrenX = axisXValueFormatter\n ? ({ value }: any) => ({ children: axisXValueFormatter(value) })\n : undefined;\n const childrenY = axisYValueFormatter\n ? ({ value }: any) => ({ children: axisYValueFormatter(value) })\n : undefined;\n\n return (\n <>\n {showYAxis && (\n <YAxis>\n {yTicks\n ? (\n <YAxis.Ticks primaryText={invertAxis} multiline={multilineYTicks} ticks={yTicks}>{childrenY}</YAxis.Ticks>\n )\n : (\n <YAxis.Ticks primaryText={invertAxis} multiline={multilineYTicks}>{childrenY}</YAxis.Ticks>\n )}\n {invertAxis !== true && (yTicks ? <YAxis.Grid ticks={yTicks} /> : <YAxis.Grid />)}\n </YAxis>\n )}\n\n {showXAxis && (\n <XAxis>\n {xTicks\n ? (\n <XAxis.Ticks multiline={multilineXTicks} ticks={xTicks}>{childrenX}</XAxis.Ticks>\n )\n : (\n <XAxis.Ticks multiline={multilineXTicks}>{childrenX}</XAxis.Ticks>\n )}\n {invertAxis === true && (xTicks ? <XAxis.Grid ticks={xTicks} /> : <XAxis.Grid />)}\n </XAxis>\n )}\n </>\n );\n }\n\n protected getLegendAriaLabel(): string {\n return this.asProps.getI18nText('legendForChart', { chartType: 'Bar' });\n }\n\n private handleClickBar = (\n _data: BarChartData[0],\n e: React.SyntheticEvent,\n barIndex: number,\n barKey: string,\n ) => {\n const { onClickBar } = this.asProps;\n\n if (onClickBar) {\n onClickBar(barIndex, barKey, e);\n }\n };\n\n private get categoryScale() {\n const {\n marginY = 40,\n marginX = 24,\n plotWidth,\n plotHeight,\n invertAxis,\n data,\n groupKey,\n } = this.asProps;\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.4).paddingOuter(0.2);\n }\n\n private get valueScale() {\n const { marginY = 40, marginX = 24, plotWidth, plotHeight, invertAxis, type } = this.asProps;\n\n const max = type === 'stack' ? super.maxStackedValue : Math.max(...super.flatValues);\n\n return scaleLinear()\n .range(\n invertAxis\n ? [marginY, plotWidth - this.plotPadding]\n : [plotHeight - marginX, this.plotPadding],\n )\n .domain([0, max]);\n }\n}\n\nexport const BarChart: BarChartType = createComponent(BarChartComponent);\n"],"mappings":";;AAAA,SAASA,eAAe,QAAQ,eAAe;AAC/C,OAAOC,WAAW,MAAM,8CAA8C;AACtE,SAASC,SAAS,EAAEC,WAAW,EAAEC,SAAS,QAAQ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AEyB;IAAK,CAAC,GAAG,IAAI,CAAC3B,OAAO;IAE5F,MAAM0F,GAAG,GAAG/D,IAAI,KAAK,OAAO,GAAG,KAAK,CAACgE,eAAe,GAAGC,IAAI,CAACF,GAAG,CAAC,GAAG,KAAK,CAACG,UAAU,CAAC;IAEpF,OAAOlH,WAAW,CAAC,CAAC,CACjBsG,KAAK,CACJ/E,UAAU,GACN,CAAC0E,OAAO,EAAEE,SAAS,GAAG,IAAI,CAACI,WAAW,CAAC,GACvC,CAACH,UAAU,GAAGF,OAAO,EAAE,IAAI,CAACK,WAAW,CAC7C,CAAC,CACAK,MAAM,CAAC,CAAC,CAAC,EAAEG,GAAG,CAAC,CAAC;EACrB;AACF;AAAChG,eAAA,CAxRKH,iBAAiB,iBAKA,WAAW;AAAAG,eAAA,CAL5BH,iBAAiB,aAOJ,CAACd,WAAW,CAACa,iBAAiB,CAAC,CAAC;AAmRnD,OAAO,MAAMwG,QAAsB,GAAGtH,eAAe,CAACe,iBAAiB,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BarChart.type.js","names":[],"sources":["../../../../src/component/Chart/BarChart.type.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"BarChart.type.js","names":[],"sources":["../../../../src/component/Chart/BarChart.type.ts"],"sourcesContent":["import type { Flex } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport type { ScaleBand, ScaleLinear, ScaleTime } from 'd3-scale';\nimport type React from 'react';\n\nimport type { AriaNameProps, BaseChartProps } from './AbstractChart.type';\nimport type { LegendItemKey } from '../ChartLegend/LegendItem/LegendItem.type';\n\ntype TrendItem = {\n x: number | string;\n y: number | string;\n};\n\ntype BarKey = string;\n\nexport type BarChartData = Array<Record<BarKey, string | number | Date>>;\n\nexport type BarChartProps = BaseChartProps<BarChartData> & {\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 /** Controls whether bars are grouped side-by-side or stacked */\n type?: 'stack' | 'group';\n /** Optional trend line data to overlay on the bars */\n trend?: Record<LegendItemKey, TrendItem[]>;\n /** Handle click by `HoverRect`. `index` is an index of the data array. */\n onClickHoverRect?: (index: number, e: React.SyntheticEvent) => void;\n /** Handle click by Bar. */\n onClickBar?: (barItem: number, barKey: BarKey, e: React.SyntheticEvent) => void;\n};\n\nexport type BarChartType = Intergalactic.Component<typeof Flex, BarChartProps & AriaNameProps>;\n"],"mappings":"","ignoreList":[]}
|