@semcore/d3-chart 3.61.0-prerelease.5 → 3.61.0-prerelease.6
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/lib/cjs/AnimatedClipPath.js +15 -11
- package/lib/cjs/AnimatedClipPath.js.map +1 -1
- package/lib/cjs/Area.js +48 -71
- package/lib/cjs/Area.js.map +1 -1
- package/lib/cjs/Axis.js +108 -170
- package/lib/cjs/Axis.js.map +1 -1
- package/lib/cjs/Bar.js +34 -29
- package/lib/cjs/Bar.js.map +1 -1
- package/lib/cjs/Bubble.js +137 -211
- package/lib/cjs/Bubble.js.map +1 -1
- package/lib/cjs/CompactHorizontalBar.js +82 -92
- package/lib/cjs/CompactHorizontalBar.js.map +1 -1
- package/lib/cjs/Donut.js +139 -154
- package/lib/cjs/Donut.js.map +1 -1
- package/lib/cjs/Dots.js +38 -55
- package/lib/cjs/Dots.js.map +1 -1
- package/lib/cjs/GroupBar.js +18 -15
- package/lib/cjs/GroupBar.js.map +1 -1
- package/lib/cjs/HorizontalBar.js +34 -29
- package/lib/cjs/HorizontalBar.js.map +1 -1
- package/lib/cjs/Hover.js +45 -52
- package/lib/cjs/Hover.js.map +1 -1
- package/lib/cjs/Line.js +41 -63
- package/lib/cjs/Line.js.map +1 -1
- package/lib/cjs/Pattern.js +12 -16
- package/lib/cjs/Pattern.js.map +1 -1
- package/lib/cjs/Plot.js +36 -29
- package/lib/cjs/Plot.js.map +1 -1
- package/lib/cjs/Radar.js +261 -281
- package/lib/cjs/Radar.js.map +1 -1
- package/lib/cjs/RadialTree.js +154 -169
- package/lib/cjs/RadialTree.js.map +1 -1
- package/lib/cjs/Reference.js +51 -45
- package/lib/cjs/Reference.js.map +1 -1
- package/lib/cjs/ResponsiveContainer.js +25 -20
- package/lib/cjs/ResponsiveContainer.js.map +1 -1
- package/lib/cjs/ScatterPlot.js +61 -71
- package/lib/cjs/ScatterPlot.js.map +1 -1
- package/lib/cjs/StackBar.js +31 -20
- package/lib/cjs/StackBar.js.map +1 -1
- package/lib/cjs/StackedArea.js +16 -12
- package/lib/cjs/StackedArea.js.map +1 -1
- package/lib/cjs/Tooltip.js +73 -73
- package/lib/cjs/Tooltip.js.map +1 -1
- package/lib/cjs/Venn.js +52 -77
- package/lib/cjs/Venn.js.map +1 -1
- package/lib/cjs/a11y/DataAccessibilityTable.js +3 -2
- package/lib/cjs/a11y/DataAccessibilityTable.js.map +1 -1
- package/lib/cjs/a11y/PlotA11yModule.js +86 -43
- package/lib/cjs/a11y/PlotA11yModule.js.map +1 -1
- package/lib/cjs/a11y/PlotA11yView.js +19 -44
- package/lib/cjs/a11y/PlotA11yView.js.map +1 -1
- package/lib/cjs/a11y/bezier.js +2 -1
- package/lib/cjs/a11y/bezier.js.map +1 -1
- package/lib/cjs/a11y/focus.js +6 -5
- package/lib/cjs/a11y/focus.js.map +1 -1
- package/lib/cjs/a11y/hints.js +9 -6
- package/lib/cjs/a11y/hints.js.map +1 -1
- package/lib/cjs/a11y/insights.js +64 -63
- package/lib/cjs/a11y/insights.js.map +1 -1
- package/lib/cjs/a11y/intl.js +2 -1
- package/lib/cjs/a11y/intl.js.map +1 -1
- package/lib/cjs/a11y/locale.js +5 -5
- package/lib/cjs/a11y/locale.js.map +1 -1
- package/lib/cjs/a11y/serialize.js +17 -15
- package/lib/cjs/a11y/serialize.js.map +1 -1
- package/lib/cjs/a11y/summarize.js +2 -1
- package/lib/cjs/a11y/summarize.js.map +1 -1
- package/lib/cjs/a11y/translations/module/__intergalactic-dynamic-locales.js +5 -4
- 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 +5 -4
- package/lib/cjs/a11y/translations/view/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/cjs/color.js +3 -2
- package/lib/cjs/color.js.map +1 -1
- package/lib/cjs/component/Chart/AbstractChart.js +83 -157
- 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 +51 -24
- 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 +69 -85
- 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 +27 -31
- 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 +147 -340
- package/lib/cjs/component/Chart/CigaretteChart.js.map +1 -1
- package/lib/cjs/component/Chart/CigaretteChart.type.js.map +1 -1
- package/lib/cjs/component/Chart/CompactHorizontalBarChart.js +15 -11
- 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 +22 -16
- 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 +44 -16
- 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 +48 -22
- 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 +19 -15
- 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 +21 -16
- 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 +19 -16
- 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 +8 -7
- package/lib/cjs/component/Chart/index.js.map +1 -1
- package/lib/cjs/component/ChartLegend/BaseLegend.js +23 -45
- 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 +24 -19
- 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 +83 -108
- package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js.map +1 -1
- package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.type.js +2 -1
- package/lib/cjs/component/ChartLegend/LegendItem/LegendItem.type.js.map +1 -1
- package/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js +23 -18
- 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 +2 -1
- package/lib/cjs/component/ChartLegend/index.js.map +1 -1
- package/lib/cjs/component/Cigarette/Cigarette.js +20 -16
- package/lib/cjs/component/Cigarette/Cigarette.js.map +1 -1
- package/lib/cjs/component/StackGroupBar/StackGroupBar.js +24 -19
- package/lib/cjs/component/StackGroupBar/StackGroupBar.js.map +1 -1
- package/lib/cjs/component/StackGroupBar/StackGroupBar.type.js.map +1 -1
- package/lib/cjs/createElement.d.js.map +1 -1
- package/lib/cjs/createElement.js +12 -10
- package/lib/cjs/createElement.js.map +1 -1
- package/lib/cjs/index.js +2 -9
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/style/axis.shadow.css +1 -39
- package/lib/cjs/style/bubble.shadow.css +0 -8
- package/lib/cjs/style/hover.shadow.css +2 -2
- package/lib/cjs/style/plot.shadow.css +6 -8
- package/lib/cjs/style/plotA11yModule.shadow.css +11 -10
- package/lib/cjs/style/plotA11yView.shadow.css +26 -13
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js +5 -4
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/cjs/translations/de.json +0 -1
- package/lib/cjs/translations/es.json +0 -1
- package/lib/cjs/translations/fr.json +0 -1
- package/lib/cjs/translations/it.json +0 -1
- package/lib/cjs/translations/ja.json +0 -1
- package/lib/cjs/translations/ko.json +0 -1
- package/lib/cjs/translations/nl.json +0 -1
- package/lib/cjs/translations/pl.json +0 -1
- package/lib/cjs/translations/pt.json +0 -1
- package/lib/cjs/translations/sv.json +0 -1
- package/lib/cjs/translations/tr.json +1 -2
- package/lib/cjs/translations/vi.json +0 -1
- package/lib/cjs/translations/zh.json +0 -1
- package/lib/cjs/types/Area.d.js.map +1 -1
- package/lib/cjs/types/Axis.d.js.map +1 -1
- package/lib/cjs/types/Bar.d.js.map +1 -1
- package/lib/cjs/types/Bubble.d.js.map +1 -1
- package/lib/cjs/types/ClipPath.d.js.map +1 -1
- package/lib/cjs/types/CompactHorizontalBar.d.js.map +1 -1
- package/lib/cjs/types/Donut.d.js.map +1 -1
- package/lib/cjs/types/GroupBar.d.js.map +1 -1
- package/lib/cjs/types/HorizontalBar.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/Reference.d.js.map +1 -1
- package/lib/cjs/types/ResponsiveContainer.d.js.map +1 -1
- package/lib/cjs/types/ScatterPlot.d.js.map +1 -1
- package/lib/cjs/types/StackBar.d.js.map +1 -1
- package/lib/cjs/types/StackedArea.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/context.d.js.map +1 -1
- package/lib/cjs/types/index.d.js +2 -14
- package/lib/cjs/types/index.d.js.map +1 -1
- package/lib/cjs/utils.js +55 -36
- package/lib/cjs/utils.js.map +1 -1
- package/lib/es6/AnimatedClipPath.js +11 -9
- package/lib/es6/AnimatedClipPath.js.map +1 -1
- package/lib/es6/Area.js +45 -70
- package/lib/es6/Area.js.map +1 -1
- package/lib/es6/Axis.js +104 -168
- package/lib/es6/Axis.js.map +1 -1
- package/lib/es6/Bar.js +29 -27
- package/lib/es6/Bar.js.map +1 -1
- package/lib/es6/Bubble.js +135 -211
- package/lib/es6/Bubble.js.map +1 -1
- package/lib/es6/CompactHorizontalBar.js +77 -89
- package/lib/es6/CompactHorizontalBar.js.map +1 -1
- package/lib/es6/Donut.js +137 -154
- package/lib/es6/Donut.js.map +1 -1
- package/lib/es6/Dots.js +36 -55
- package/lib/es6/Dots.js.map +1 -1
- package/lib/es6/GroupBar.js +15 -13
- package/lib/es6/GroupBar.js.map +1 -1
- package/lib/es6/HorizontalBar.js +29 -27
- package/lib/es6/HorizontalBar.js.map +1 -1
- package/lib/es6/Hover.js +41 -51
- package/lib/es6/Hover.js.map +1 -1
- package/lib/es6/Line.js +37 -61
- package/lib/es6/Line.js.map +1 -1
- package/lib/es6/Pattern.js +3 -7
- package/lib/es6/Pattern.js.map +1 -1
- package/lib/es6/Plot.js +32 -28
- package/lib/es6/Plot.js.map +1 -1
- package/lib/es6/Radar.js +257 -279
- package/lib/es6/Radar.js.map +1 -1
- package/lib/es6/RadialTree.js +151 -168
- package/lib/es6/RadialTree.js.map +1 -1
- package/lib/es6/Reference.js +45 -43
- package/lib/es6/Reference.js.map +1 -1
- package/lib/es6/ResponsiveContainer.js +19 -16
- package/lib/es6/ResponsiveContainer.js.map +1 -1
- package/lib/es6/ScatterPlot.js +59 -71
- package/lib/es6/ScatterPlot.js.map +1 -1
- package/lib/es6/StackBar.js +27 -17
- package/lib/es6/StackBar.js.map +1 -1
- package/lib/es6/StackedArea.js +13 -10
- package/lib/es6/StackedArea.js.map +1 -1
- package/lib/es6/Tooltip.js +65 -68
- package/lib/es6/Tooltip.js.map +1 -1
- package/lib/es6/Venn.js +48 -75
- package/lib/es6/Venn.js.map +1 -1
- package/lib/es6/a11y/DataAccessibilityTable.js.map +1 -1
- package/lib/es6/a11y/PlotA11yModule.js +86 -43
- package/lib/es6/a11y/PlotA11yModule.js.map +1 -1
- package/lib/es6/a11y/PlotA11yView.js +16 -43
- package/lib/es6/a11y/PlotA11yView.js.map +1 -1
- package/lib/es6/a11y/bezier.js.map +1 -1
- package/lib/es6/a11y/focus.js +4 -4
- package/lib/es6/a11y/focus.js.map +1 -1
- package/lib/es6/a11y/hints.js +2 -2
- package/lib/es6/a11y/hints.js.map +1 -1
- package/lib/es6/a11y/insights.js +61 -61
- package/lib/es6/a11y/insights.js.map +1 -1
- package/lib/es6/a11y/intl.js.map +1 -1
- package/lib/es6/a11y/locale.js +2 -3
- package/lib/es6/a11y/locale.js.map +1 -1
- package/lib/es6/a11y/serialize.js +13 -14
- package/lib/es6/a11y/serialize.js.map +1 -1
- package/lib/es6/a11y/summarize.js.map +1 -1
- package/lib/es6/a11y/translations/module/__intergalactic-dynamic-locales.js +2 -2
- 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 +2 -2
- 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 +80 -159
- 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 +48 -23
- 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 +67 -84
- 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 +24 -30
- 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 +144 -341
- package/lib/es6/component/Chart/CigaretteChart.js.map +1 -1
- package/lib/es6/component/Chart/CigaretteChart.type.js.map +1 -1
- package/lib/es6/component/Chart/CompactHorizontalBarChart.js +12 -9
- 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 +18 -14
- 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 +41 -15
- 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 +45 -20
- 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 +16 -13
- 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 +18 -15
- 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 +16 -14
- 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/Chart/index.js +6 -6
- package/lib/es6/component/Chart/index.js.map +1 -1
- package/lib/es6/component/ChartLegend/BaseLegend.js +20 -43
- 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 +19 -17
- 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 +74 -102
- package/lib/es6/component/ChartLegend/LegendItem/LegendItem.js.map +1 -1
- package/lib/es6/component/ChartLegend/LegendItem/LegendItem.type.js.map +1 -1
- package/lib/es6/component/ChartLegend/LegendTable/LegendTable.js +17 -15
- 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/ChartLegend/index.js.map +1 -1
- package/lib/es6/component/Cigarette/Cigarette.js +17 -14
- package/lib/es6/component/Cigarette/Cigarette.js.map +1 -1
- package/lib/es6/component/StackGroupBar/StackGroupBar.js +21 -17
- package/lib/es6/component/StackGroupBar/StackGroupBar.js.map +1 -1
- package/lib/es6/component/StackGroupBar/StackGroupBar.type.js.map +1 -1
- package/lib/es6/createElement.d.js.map +1 -1
- package/lib/es6/createElement.js +7 -7
- package/lib/es6/createElement.js.map +1 -1
- package/lib/es6/index.js +0 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/style/axis.shadow.css +1 -39
- package/lib/es6/style/bubble.shadow.css +0 -8
- package/lib/es6/style/hover.shadow.css +2 -2
- package/lib/es6/style/plot.shadow.css +6 -8
- package/lib/es6/style/plotA11yModule.shadow.css +11 -10
- package/lib/es6/style/plotA11yView.shadow.css +26 -13
- package/lib/es6/translations/__intergalactic-dynamic-locales.js +2 -2
- package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/translations/de.json +0 -1
- package/lib/es6/translations/es.json +0 -1
- package/lib/es6/translations/fr.json +0 -1
- package/lib/es6/translations/it.json +0 -1
- package/lib/es6/translations/ja.json +0 -1
- package/lib/es6/translations/ko.json +0 -1
- package/lib/es6/translations/nl.json +0 -1
- package/lib/es6/translations/pl.json +0 -1
- package/lib/es6/translations/pt.json +0 -1
- package/lib/es6/translations/sv.json +0 -1
- package/lib/es6/translations/tr.json +1 -2
- package/lib/es6/translations/vi.json +0 -1
- package/lib/es6/translations/zh.json +0 -1
- package/lib/es6/types/Area.d.js.map +1 -1
- package/lib/es6/types/Axis.d.js.map +1 -1
- package/lib/es6/types/Bar.d.js.map +1 -1
- package/lib/es6/types/Bubble.d.js.map +1 -1
- package/lib/es6/types/ClipPath.d.js.map +1 -1
- package/lib/es6/types/CompactHorizontalBar.d.js.map +1 -1
- package/lib/es6/types/Donut.d.js.map +1 -1
- package/lib/es6/types/GroupBar.d.js.map +1 -1
- package/lib/es6/types/HorizontalBar.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/Reference.d.js.map +1 -1
- package/lib/es6/types/ResponsiveContainer.d.js.map +1 -1
- package/lib/es6/types/ScatterPlot.d.js.map +1 -1
- package/lib/es6/types/StackBar.d.js.map +1 -1
- package/lib/es6/types/StackedArea.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/types/context.d.js.map +1 -1
- package/lib/es6/types/index.d.js +0 -2
- package/lib/es6/types/index.d.js.map +1 -1
- package/lib/es6/utils.js +16 -16
- package/lib/es6/utils.js.map +1 -1
- package/lib/esm/AnimatedClipPath.mjs +16 -9
- package/lib/esm/Area.mjs +36 -51
- package/lib/esm/Axis.mjs +86 -143
- package/lib/esm/Bar.mjs +34 -31
- package/lib/esm/Bubble.mjs +106 -154
- package/lib/esm/CompactHorizontalBar.mjs +80 -88
- package/lib/esm/Donut.mjs +75 -87
- package/lib/esm/Dots.mjs +34 -50
- package/lib/esm/GroupBar.mjs +14 -12
- package/lib/esm/HorizontalBar.mjs +34 -31
- package/lib/esm/Hover.mjs +50 -53
- package/lib/esm/Line.mjs +31 -45
- package/lib/esm/Pattern.mjs +2 -4
- package/lib/esm/Plot.mjs +35 -30
- package/lib/esm/Radar.mjs +175 -188
- package/lib/esm/RadialTree.mjs +111 -105
- package/lib/esm/Reference.mjs +40 -37
- package/lib/esm/ResponsiveContainer.mjs +21 -18
- package/lib/esm/ScatterPlot.mjs +40 -49
- package/lib/esm/StackBar.mjs +28 -18
- package/lib/esm/StackedArea.mjs +16 -13
- package/lib/esm/Tooltip.mjs +59 -56
- package/lib/esm/Venn.mjs +47 -67
- package/lib/esm/a11y/DataAccessibilityTable.mjs +2 -2
- package/lib/esm/a11y/PlotA11yModule.mjs +74 -35
- package/lib/esm/a11y/PlotA11yView.mjs +17 -41
- package/lib/esm/a11y/focus.mjs +4 -4
- package/lib/esm/a11y/hints.mjs +2 -2
- package/lib/esm/a11y/insights.mjs +76 -76
- package/lib/esm/a11y/locale.mjs +2 -2
- package/lib/esm/a11y/serialize.mjs +12 -12
- package/lib/esm/a11y/translations/module/__intergalactic-dynamic-locales.mjs +2 -2
- package/lib/esm/a11y/translations/module/de.json.mjs +4 -2
- package/lib/esm/a11y/translations/module/en.json.mjs +4 -2
- package/lib/esm/a11y/translations/module/es.json.mjs +4 -2
- package/lib/esm/a11y/translations/module/fr.json.mjs +4 -2
- package/lib/esm/a11y/translations/module/it.json.mjs +4 -2
- package/lib/esm/a11y/translations/module/ja.json.mjs +4 -2
- package/lib/esm/a11y/translations/module/ko.json.mjs +4 -2
- package/lib/esm/a11y/translations/module/nl.json.mjs +4 -2
- package/lib/esm/a11y/translations/module/pl.json.mjs +4 -2
- package/lib/esm/a11y/translations/module/pt.json.mjs +4 -2
- package/lib/esm/a11y/translations/module/sv.json.mjs +4 -2
- package/lib/esm/a11y/translations/module/tr.json.mjs +4 -2
- package/lib/esm/a11y/translations/module/vi.json.mjs +4 -2
- package/lib/esm/a11y/translations/module/zh.json.mjs +4 -2
- package/lib/esm/a11y/translations/view/__intergalactic-dynamic-locales.mjs +2 -2
- package/lib/esm/component/Chart/AbstractChart.mjs +65 -141
- package/lib/esm/component/Chart/AreaChart.mjs +51 -27
- package/lib/esm/component/Chart/BarChart.mjs +51 -64
- package/lib/esm/component/Chart/BubbleChart.mjs +25 -30
- package/lib/esm/component/Chart/CigaretteChart.mjs +119 -298
- package/lib/esm/component/Chart/CompactHorizontalBarChart.mjs +15 -13
- package/lib/esm/component/Chart/DonutChart.mjs +19 -16
- package/lib/esm/component/Chart/HistogramChart.mjs +46 -22
- package/lib/esm/component/Chart/LineChart.mjs +46 -23
- package/lib/esm/component/Chart/RadarChart.mjs +18 -16
- package/lib/esm/component/Chart/ScatterPlotChart.mjs +21 -18
- package/lib/esm/component/Chart/VennChart.mjs +19 -16
- package/lib/esm/component/Chart/index.mjs +6 -6
- package/lib/esm/component/ChartLegend/BaseLegend.mjs +22 -45
- package/lib/esm/component/ChartLegend/LegendFlex/LegendFlex.mjs +22 -19
- package/lib/esm/component/ChartLegend/LegendItem/LegendItem.mjs +75 -88
- package/lib/esm/component/ChartLegend/LegendTable/LegendTable.mjs +25 -22
- package/lib/esm/component/ChartLegend/index.mjs +0 -2
- package/lib/esm/component/Cigarette/Cigarette.mjs +19 -16
- package/lib/esm/component/StackGroupBar/StackGroupBar.mjs +22 -18
- package/lib/esm/createElement.mjs +10 -8
- package/lib/esm/index.mjs +0 -3
- package/lib/esm/style/axis.shadow.css +1 -39
- package/lib/esm/style/bubble.shadow.css +0 -8
- package/lib/esm/style/hover.shadow.css +2 -2
- package/lib/esm/style/plot.shadow.css +6 -8
- package/lib/esm/style/plotA11yModule.shadow.css +11 -10
- package/lib/esm/style/plotA11yView.shadow.css +26 -13
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +2 -2
- package/lib/esm/translations/es.json.mjs +0 -1
- package/lib/esm/translations/fr.json.mjs +0 -1
- package/lib/esm/translations/it.json.mjs +0 -1
- package/lib/esm/translations/ja.json.mjs +0 -1
- package/lib/esm/translations/ko.json.mjs +0 -1
- package/lib/esm/translations/nl.json.mjs +0 -1
- package/lib/esm/translations/pl.json.mjs +0 -1
- package/lib/esm/translations/pt.json.mjs +0 -1
- package/lib/esm/translations/sv.json.mjs +0 -1
- package/lib/esm/translations/tr.json.mjs +1 -2
- package/lib/esm/translations/vi.json.mjs +0 -1
- package/lib/esm/translations/zh.json.mjs +0 -1
- package/lib/esm/utils.mjs +11 -11
- package/lib/types/Area.d.ts +6 -9
- package/lib/types/Axis.d.ts +3 -10
- package/lib/types/Bar.d.ts +6 -7
- package/lib/types/Bubble.d.ts +5 -21
- package/lib/types/ClipPath.d.ts +3 -4
- package/lib/types/CompactHorizontalBar.d.ts +8 -7
- package/lib/types/Donut.d.ts +5 -8
- package/lib/types/GroupBar.d.ts +6 -6
- package/lib/types/HorizontalBar.d.ts +6 -7
- package/lib/types/Hover.d.ts +8 -8
- package/lib/types/Line.d.ts +6 -9
- package/lib/types/Pattern.d.ts +51 -51
- package/lib/types/Plot.d.ts +9 -11
- package/lib/types/Radar.d.ts +7 -10
- package/lib/types/RadialTree.d.ts +54 -10
- package/lib/types/Reference.d.ts +5 -6
- package/lib/types/ResponsiveContainer.d.ts +4 -5
- package/lib/types/ScatterPlot.d.ts +5 -8
- package/lib/types/StackBar.d.ts +6 -7
- package/lib/types/StackedArea.d.ts +5 -6
- package/lib/types/Tooltip.d.ts +12 -12
- package/lib/types/Venn.d.ts +6 -7
- package/lib/types/a11y/DataAccessibilityTable.d.ts +2 -2
- package/lib/types/a11y/PlotA11yModule.d.ts +11 -4
- package/lib/types/a11y/PlotA11yView.d.ts +2 -13
- package/lib/types/a11y/hints.d.ts +5 -5
- package/lib/types/a11y/insights.d.ts +1 -1
- package/lib/types/a11y/intl.d.ts +1 -1
- package/lib/types/a11y/serialize.d.ts +7 -7
- package/lib/types/a11y/summarize.d.ts +2 -2
- package/lib/types/a11y/translations/module/__intergalactic-dynamic-locales.d.ts +14 -14
- package/lib/types/component/Chart/AbstractChart.d.ts +13 -20
- package/lib/types/component/Chart/AbstractChart.type.d.ts +25 -39
- package/lib/types/component/Chart/AreaChart.d.ts +1 -1
- package/lib/types/component/Chart/AreaChart.type.d.ts +7 -17
- package/lib/types/component/Chart/BarChart.d.ts +1 -1
- package/lib/types/component/Chart/BarChart.type.d.ts +9 -14
- package/lib/types/component/Chart/BubbleChart.d.ts +1 -1
- package/lib/types/component/Chart/BubbleChart.type.d.ts +5 -10
- package/lib/types/component/Chart/CigaretteChart.d.ts +1 -1
- package/lib/types/component/Chart/CigaretteChart.type.d.ts +8 -18
- package/lib/types/component/Chart/CompactHorizontalBarChart.d.ts +1 -1
- package/lib/types/component/Chart/CompactHorizontalBarChart.type.d.ts +6 -10
- package/lib/types/component/Chart/DonutChart.d.ts +1 -1
- package/lib/types/component/Chart/DonutChart.type.d.ts +7 -16
- package/lib/types/component/Chart/HistogramChart.d.ts +1 -1
- package/lib/types/component/Chart/HistogramChart.type.d.ts +4 -7
- package/lib/types/component/Chart/LineChart.d.ts +1 -1
- package/lib/types/component/Chart/LineChart.type.d.ts +7 -16
- package/lib/types/component/Chart/RadarChart.d.ts +1 -1
- package/lib/types/component/Chart/RadarChart.type.d.ts +5 -7
- package/lib/types/component/Chart/ScatterPlotChart.d.ts +1 -1
- package/lib/types/component/Chart/ScatterPlotChart.type.d.ts +6 -12
- package/lib/types/component/Chart/VennChart.d.ts +1 -1
- package/lib/types/component/Chart/VennChart.type.d.ts +6 -12
- package/lib/types/component/ChartLegend/BaseLegend.d.ts +6 -8
- package/lib/types/component/ChartLegend/BaseLegend.type.d.ts +5 -4
- package/lib/types/component/ChartLegend/LegendFlex/LegendFlex.d.ts +1 -1
- package/lib/types/component/ChartLegend/LegendFlex/LegendFlex.type.d.ts +5 -4
- package/lib/types/component/ChartLegend/LegendItem/LegendItem.d.ts +1 -1
- package/lib/types/component/ChartLegend/LegendItem/LegendItem.type.d.ts +10 -17
- package/lib/types/component/ChartLegend/LegendTable/LegendTable.d.ts +1 -1
- package/lib/types/component/ChartLegend/LegendTable/LegendTable.type.d.ts +5 -5
- package/lib/types/component/StackGroupBar/StackGroupBar.d.ts +1 -1
- package/lib/types/component/StackGroupBar/StackGroupBar.type.d.ts +4 -3
- package/lib/types/index.d.ts +1 -3
- package/lib/types/translations/__intergalactic-dynamic-locales.d.ts +0 -12
- package/lib/types/utils.d.ts +17 -17
- package/package.json +10 -10
- package/lib/cjs/component/SvgElement.js +0 -21
- package/lib/cjs/component/SvgElement.js.map +0 -1
- package/lib/cjs/style/abstract-chart.shadow.css +0 -12
- package/lib/es6/component/SvgElement.js +0 -14
- package/lib/es6/component/SvgElement.js.map +0 -1
- package/lib/es6/style/abstract-chart.shadow.css +0 -12
- package/lib/esm/component/SvgElement.mjs +0 -14
- package/lib/esm/style/abstract-chart.shadow.css +0 -12
- package/lib/types/component/SvgElement.d.ts +0 -10
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import _get from "@babel/runtime/helpers/get";
|
|
5
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
6
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
|
+
import _createSuper from "@babel/runtime/helpers/createSuper";
|
|
7
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
import { createComponent } from '@semcore/core';
|
|
9
|
-
import i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';
|
|
10
|
-
import { scaleLinear, scaleTime } from 'd3-scale';
|
|
11
9
|
import React from 'react';
|
|
12
|
-
|
|
10
|
+
import createComponent from '@semcore/core';
|
|
11
|
+
import { scaleLinear, scaleTime } from 'd3-scale';
|
|
13
12
|
// @ts-ignore
|
|
14
13
|
import { Area, minMax, HoverLine, StackedArea } from '../..';
|
|
15
14
|
import { AbstractChart } from './AbstractChart';
|
|
15
|
+
import { Flex, Box } from '@semcore/flex-box';
|
|
16
|
+
import { Text } from '@semcore/typography';
|
|
16
17
|
import { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';
|
|
18
|
+
import i18nEnhance from '@semcore/utils/lib/enhances/i18nEnhance';
|
|
17
19
|
var AreaChartComponent = /*#__PURE__*/function (_AbstractChart) {
|
|
20
|
+
_inherits(AreaChartComponent, _AbstractChart);
|
|
21
|
+
var _super = _createSuper(AreaChartComponent);
|
|
18
22
|
function AreaChartComponent() {
|
|
19
23
|
_classCallCheck(this, AreaChartComponent);
|
|
20
|
-
return
|
|
24
|
+
return _super.apply(this, arguments);
|
|
21
25
|
}
|
|
22
|
-
|
|
23
|
-
return _createClass(AreaChartComponent, [{
|
|
26
|
+
_createClass(AreaChartComponent, [{
|
|
24
27
|
key: "xScale",
|
|
25
28
|
get: function get() {
|
|
26
29
|
var _this$asProps = this.asProps,
|
|
@@ -49,13 +52,15 @@ var AreaChartComponent = /*#__PURE__*/function (_AbstractChart) {
|
|
|
49
52
|
_this$asProps2$margin = _this$asProps2.marginX,
|
|
50
53
|
marginX = _this$asProps2$margin === void 0 ? 24 : _this$asProps2$margin,
|
|
51
54
|
plotHeight = _this$asProps2.plotHeight,
|
|
52
|
-
stacked = _this$asProps2.stacked
|
|
55
|
+
stacked = _this$asProps2.stacked,
|
|
56
|
+
data = _this$asProps2.data,
|
|
57
|
+
groupKey = _this$asProps2.groupKey;
|
|
53
58
|
if (yScale) {
|
|
54
59
|
return yScale;
|
|
55
60
|
}
|
|
56
|
-
var flatValues =
|
|
61
|
+
var flatValues = _get(_getPrototypeOf(AreaChartComponent.prototype), "flatValues", this);
|
|
57
62
|
var min = Math.min.apply(Math, _toConsumableArray(flatValues));
|
|
58
|
-
var max = stacked ?
|
|
63
|
+
var max = stacked ? _get(_getPrototypeOf(AreaChartComponent.prototype), "maxStackedValue", this) : Math.max.apply(Math, _toConsumableArray(flatValues));
|
|
59
64
|
return scaleLinear().range([plotHeight - marginX, this.plotPadding]).domain([min, max]);
|
|
60
65
|
}
|
|
61
66
|
}, {
|
|
@@ -65,8 +70,7 @@ var AreaChartComponent = /*#__PURE__*/function (_AbstractChart) {
|
|
|
65
70
|
groupKey = _this$asProps3.groupKey,
|
|
66
71
|
curve = _this$asProps3.curve,
|
|
67
72
|
showDots = _this$asProps3.showDots,
|
|
68
|
-
stacked = _this$asProps3.stacked
|
|
69
|
-
onClickArea = _this$asProps3.onClickArea;
|
|
73
|
+
stacked = _this$asProps3.stacked;
|
|
70
74
|
var _this$state = this.state,
|
|
71
75
|
dataDefinitions = _this$state.dataDefinitions,
|
|
72
76
|
highlightedLine = _this$state.highlightedLine;
|
|
@@ -80,8 +84,7 @@ var AreaChartComponent = /*#__PURE__*/function (_AbstractChart) {
|
|
|
80
84
|
key: item.id,
|
|
81
85
|
color: item.color,
|
|
82
86
|
transparent: highlightedLine !== -1 && highlightedLine !== index,
|
|
83
|
-
curve: curve
|
|
84
|
-
onClick: onClickArea
|
|
87
|
+
curve: curve
|
|
85
88
|
}, showDots && /*#__PURE__*/React.createElement(StackedArea.Area.Dots, {
|
|
86
89
|
display: true
|
|
87
90
|
}));
|
|
@@ -94,8 +97,7 @@ var AreaChartComponent = /*#__PURE__*/function (_AbstractChart) {
|
|
|
94
97
|
key: item.id,
|
|
95
98
|
color: item.color,
|
|
96
99
|
transparent: highlightedLine !== -1 && highlightedLine !== index,
|
|
97
|
-
curve: curve
|
|
98
|
-
onClick: onClickArea
|
|
100
|
+
curve: curve
|
|
99
101
|
}, showDots && /*#__PURE__*/React.createElement(Area.Dots, {
|
|
100
102
|
display: true
|
|
101
103
|
}));
|
|
@@ -107,18 +109,40 @@ var AreaChartComponent = /*#__PURE__*/function (_AbstractChart) {
|
|
|
107
109
|
var _this = this;
|
|
108
110
|
var _this$asProps4 = this.asProps,
|
|
109
111
|
data = _this$asProps4.data,
|
|
110
|
-
groupKey = _this$asProps4.groupKey
|
|
112
|
+
groupKey = _this$asProps4.groupKey,
|
|
113
|
+
showTotalInTooltip = _this$asProps4.showTotalInTooltip,
|
|
114
|
+
showTooltip = _this$asProps4.showTooltip;
|
|
115
|
+
var dataDefinitions = this.state.dataDefinitions;
|
|
116
|
+
if (!showTooltip) {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
111
119
|
return /*#__PURE__*/React.createElement(HoverLine.Tooltip, {
|
|
112
120
|
x: groupKey,
|
|
113
121
|
wMin: 100
|
|
114
122
|
}, function (_ref) {
|
|
123
|
+
var _dataItem$groupKey;
|
|
115
124
|
var xIndex = _ref.xIndex;
|
|
116
125
|
var dataItem = data[xIndex];
|
|
126
|
+
var total = _this.totalValue(dataItem);
|
|
117
127
|
return {
|
|
118
|
-
children:
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
128
|
+
children: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(HoverLine.Tooltip.Title, null, (_dataItem$groupKey = dataItem[groupKey]) === null || _dataItem$groupKey === void 0 ? void 0 : _dataItem$groupKey.toString()), dataDefinitions.map(function (item) {
|
|
129
|
+
return item.checked && /*#__PURE__*/React.createElement(Flex, {
|
|
130
|
+
justifyContent: "space-between",
|
|
131
|
+
key: item.id
|
|
132
|
+
}, /*#__PURE__*/React.createElement(HoverLine.Tooltip.Dot, {
|
|
133
|
+
mr: 4,
|
|
134
|
+
color: item.color
|
|
135
|
+
}, item.label), /*#__PURE__*/React.createElement(Text, {
|
|
136
|
+
bold: true
|
|
137
|
+
}, _this.tooltipValueFormatter(dataItem[item.id])));
|
|
138
|
+
}), showTotalInTooltip === true && /*#__PURE__*/React.createElement(Flex, {
|
|
139
|
+
mt: 2,
|
|
140
|
+
justifyContent: "space-between"
|
|
141
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
142
|
+
mr: 4
|
|
143
|
+
}, "Total"), /*#__PURE__*/React.createElement(Text, {
|
|
144
|
+
bold: true
|
|
145
|
+
}, total)))
|
|
122
146
|
};
|
|
123
147
|
});
|
|
124
148
|
}
|
|
@@ -130,6 +154,7 @@ var AreaChartComponent = /*#__PURE__*/function (_AbstractChart) {
|
|
|
130
154
|
});
|
|
131
155
|
}
|
|
132
156
|
}]);
|
|
157
|
+
return AreaChartComponent;
|
|
133
158
|
}(AbstractChart);
|
|
134
159
|
_defineProperty(AreaChartComponent, "displayName", 'Chart.Area');
|
|
135
160
|
_defineProperty(AreaChartComponent, "enhance", [i18nEnhance(localizedMessages)]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AreaChart.js","names":["createComponent","i18nEnhance","scaleLinear","scaleTime","React","Area","minMax","HoverLine","StackedArea","AbstractChart","localizedMessages","AreaChartComponent","_AbstractChart","_classCallCheck","_callSuper","arguments","_inherits","_createClass","key","get","_this$asProps","asProps","xScale","_this$asProps$marginY","marginY","plotWidth","data","groupKey","testItem","range","plotPadding","domain","Date","Number","isNaN","getMilliseconds","_this$asProps2","yScale","_this$asProps2$margin","marginX","plotHeight","stacked","flatValues","_superPropGet","min","Math","apply","_toConsumableArray","max","value","renderChart","_this$asProps3","curve","showDots","onClickArea","_this$state","state","dataDefinitions","highlightedLine","createElement","x","map","item","index","checked","y","id","color","transparent","onClick","Dots","display","renderTooltip","_this","_this$asProps4","Tooltip","wMin","_ref","xIndex","dataItem","children","getTooltipChildren","getLegendAriaLabel","getI18nText","chartType","_defineProperty","AreaChart"],"sources":["../../../../src/component/Chart/AreaChart.tsx"],"sourcesContent":["import { Flex, Box } from '@semcore/base-components';\nimport { createComponent } from '@semcore/core';\nimport i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';\nimport { type ScaleLinear, scaleLinear, scaleTime } from 'd3-scale';\nimport React from 'react';\n\n// @ts-ignore\nimport { Area, minMax, HoverLine, StackedArea } from '../..';\nimport { AbstractChart } from './AbstractChart';\nimport type { AreaChartData, AreaChartProps, AreaChartType } from './AreaChart.type';\nimport { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';\n\nclass AreaChartComponent extends AbstractChart<\n AreaChartData,\n AreaChartProps,\n typeof AreaChartComponent.enhance\n> {\n static displayName = 'Chart.Area';\n\n static enhance = [i18nEnhance(localizedMessages)] as const;\n\n get xScale() {\n const { xScale, marginY = 40, plotWidth, data, groupKey } = this.asProps;\n\n if (xScale) {\n return xScale;\n }\n\n const testItem = data[0][groupKey];\n const range = [marginY, plotWidth - this.plotPadding];\n const domain = minMax(data, groupKey);\n\n if (testItem instanceof Date && !Number.isNaN(testItem.getMilliseconds())) {\n return scaleTime(domain, range);\n }\n\n return scaleLinear(domain, range);\n }\n\n get yScale(): ScaleLinear<any, any> {\n const { yScale, marginX = 24, plotHeight, stacked } = this.asProps;\n\n if (yScale) {\n return yScale;\n }\n\n const flatValues = super.flatValues;\n const min = Math.min(...flatValues);\n const max = stacked ? super.maxStackedValue : Math.max(...flatValues);\n\n return scaleLinear()\n .range([plotHeight - marginX, this.plotPadding])\n .domain([min, max]);\n }\n\n renderChart() {\n const { groupKey, curve, showDots, stacked, onClickArea } = this.asProps;\n const { dataDefinitions, highlightedLine } = this.state;\n\n if (stacked) {\n return (\n <StackedArea x={groupKey}>\n {dataDefinitions.map((item, index) => {\n return (\n item.checked && (\n <StackedArea.Area\n x={groupKey}\n y={item.id}\n key={item.id}\n color={item.color}\n transparent={highlightedLine !== -1 && highlightedLine !== index}\n curve={curve}\n onClick={onClickArea}\n >\n {showDots && <StackedArea.Area.Dots display />}\n </StackedArea.Area>\n )\n );\n })}\n </StackedArea>\n );\n }\n\n return dataDefinitions.map((item, index) => {\n return (\n item.checked && (\n <Area\n x={groupKey}\n y={item.id}\n key={item.id}\n color={item.color}\n transparent={highlightedLine !== -1 && highlightedLine !== index}\n curve={curve}\n onClick={onClickArea}\n >\n {showDots && <Area.Dots display />}\n </Area>\n )\n );\n });\n }\n\n renderTooltip() {\n const { data, groupKey } = this.asProps;\n\n return (\n <HoverLine.Tooltip x={groupKey} wMin={100}>\n {({ xIndex }: any) => {\n const dataItem = data[xIndex];\n\n return {\n children: this.getTooltipChildren({\n Tooltip: HoverLine.Tooltip,\n dataItem,\n }),\n };\n }}\n </HoverLine.Tooltip>\n );\n }\n\n protected getLegendAriaLabel(): string {\n return this.asProps.getI18nText('legendForChart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AAwB,GAAGtF,eAAe,CAACW,kBAAkB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"AreaChart.js","names":["React","createComponent","scaleLinear","scaleTime","Area","minMax","HoverLine","StackedArea","AbstractChart","Flex","Box","Text","localizedMessages","i18nEnhance","AreaChartComponent","_AbstractChart","_inherits","_super","_createSuper","_classCallCheck","apply","arguments","_createClass","key","get","_this$asProps","asProps","xScale","_this$asProps$marginY","marginY","plotWidth","data","groupKey","testItem","range","plotPadding","domain","Date","Number","isNaN","getMilliseconds","_this$asProps2","yScale","_this$asProps2$margin","marginX","plotHeight","stacked","flatValues","_get","_getPrototypeOf","prototype","min","Math","_toConsumableArray","max","value","renderChart","_this$asProps3","curve","showDots","_this$state","state","dataDefinitions","highlightedLine","createElement","x","map","item","index","checked","y","id","color","transparent","Dots","display","renderTooltip","_this","_this$asProps4","showTotalInTooltip","showTooltip","Tooltip","wMin","_ref","_dataItem$groupKey","xIndex","dataItem","total","totalValue","children","Fragment","Title","toString","justifyContent","Dot","mr","label","bold","tooltipValueFormatter","mt","getLegendAriaLabel","getI18nText","chartType","_defineProperty","AreaChart"],"sources":["../../../../src/component/Chart/AreaChart.tsx"],"sourcesContent":["import React from 'react';\nimport createComponent from '@semcore/core';\nimport { ScaleLinear, scaleLinear, scaleTime } from 'd3-scale';\n// @ts-ignore\nimport { Area, minMax, HoverLine, StackedArea } from '../..';\nimport { AbstractChart } from './AbstractChart';\nimport { AreaChartData, AreaChartProps, AreaChartType } from './AreaChart.type';\nimport { Flex, Box } from '@semcore/flex-box';\nimport { Text } from '@semcore/typography';\nimport { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';\nimport i18nEnhance from '@semcore/utils/lib/enhances/i18nEnhance';\n\nclass AreaChartComponent extends AbstractChart<\n AreaChartData,\n AreaChartProps,\n typeof AreaChartComponent.enhance\n> {\n static displayName = 'Chart.Area';\n\n static enhance = [i18nEnhance(localizedMessages)] as const;\n\n get xScale() {\n const { xScale, marginY = 40, plotWidth, data, groupKey } = this.asProps;\n\n if (xScale) {\n return xScale;\n }\n\n const testItem = data[0][groupKey];\n const range = [marginY, plotWidth - this.plotPadding];\n const domain = minMax(data, groupKey);\n\n if (testItem instanceof Date && !Number.isNaN(testItem.getMilliseconds())) {\n return scaleTime(domain, range);\n }\n\n return scaleLinear(domain, range);\n }\n\n get yScale(): ScaleLinear<any, any> {\n const { yScale, marginX = 24, plotHeight, stacked, data, groupKey } = this.asProps;\n\n if (yScale) {\n return yScale;\n }\n\n const flatValues = super.flatValues;\n const min = Math.min(...flatValues);\n const max = stacked ? super.maxStackedValue : Math.max(...flatValues);\n\n return scaleLinear()\n .range([plotHeight - marginX, this.plotPadding])\n .domain([min, max]);\n }\n\n renderChart() {\n const { groupKey, curve, showDots, stacked } = this.asProps;\n const { dataDefinitions, highlightedLine } = this.state;\n\n if (stacked) {\n return (\n <StackedArea x={groupKey}>\n {dataDefinitions.map((item, index) => {\n return (\n item.checked && (\n <StackedArea.Area\n x={groupKey}\n y={item.id}\n key={item.id}\n color={item.color}\n transparent={highlightedLine !== -1 && highlightedLine !== index}\n curve={curve}\n >\n {showDots && <StackedArea.Area.Dots display />}\n </StackedArea.Area>\n )\n );\n })}\n </StackedArea>\n );\n }\n\n return dataDefinitions.map((item, index) => {\n return (\n item.checked && (\n <Area\n x={groupKey}\n y={item.id}\n key={item.id}\n color={item.color}\n transparent={highlightedLine !== -1 && highlightedLine !== index}\n curve={curve}\n >\n {showDots && <Area.Dots display />}\n </Area>\n )\n );\n });\n }\n\n renderTooltip() {\n const { data, groupKey, showTotalInTooltip, showTooltip } = this.asProps;\n const { dataDefinitions } = this.state;\n\n if (!showTooltip) {\n return null;\n }\n\n return (\n <HoverLine.Tooltip x={groupKey} wMin={100}>\n {({ xIndex }: any) => {\n const dataItem = data[xIndex];\n const total = this.totalValue(dataItem);\n\n return {\n children: (\n <>\n <HoverLine.Tooltip.Title>{dataItem[groupKey]?.toString()}</HoverLine.Tooltip.Title>\n\n {dataDefinitions.map((item) => {\n return (\n item.checked && (\n <Flex justifyContent='space-between' key={item.id}>\n <HoverLine.Tooltip.Dot mr={4} color={item.color}>\n {item.label}\n </HoverLine.Tooltip.Dot>\n <Text bold>{this.tooltipValueFormatter(dataItem[item.id])}</Text>\n </Flex>\n )\n );\n })}\n\n {showTotalInTooltip === true && (\n <Flex mt={2} justifyContent='space-between'>\n <Box mr={4}>Total</Box>\n <Text bold>{total}</Text>\n </Flex>\n )}\n </>\n ),\n };\n }}\n </HoverLine.Tooltip>\n );\n }\n\n protected getLegendAriaLabel(): string {\n return this.asProps.getI18nText('legendForChart', { chartType: 'Area' });\n }\n}\n\nexport const AreaChart: AreaChartType = createComponent(AreaChartComponent);\n"],"mappings":";;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,eAAe,MAAM,eAAe;AAC3C,SAAsBC,WAAW,EAAEC,SAAS,QAAQ,UAAU;AAC9D;AACA,SAASC,IAAI,EAAEC,MAAM,EAAEC,SAAS,EAAEC,WAAW,QAAQ,OAAO;AAC5D,SAASC,aAAa,QAAQ,iBAAiB;AAE/C,SAASC,IAAI,EAAEC,GAAG,QAAQ,mBAAmB;AAC7C,SAASC,IAAI,QAAQ,qBAAqB;AAC1C,SAASC,iBAAiB,QAAQ,oDAAoD;AACtF,OAAOC,WAAW,MAAM,yCAAyC;AAAC,IAE5DC,kBAAkB,0BAAAC,cAAA;EAAAC,SAAA,CAAAF,kBAAA,EAAAC,cAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,kBAAA;EAAA,SAAAA,mBAAA;IAAAK,eAAA,OAAAL,kBAAA;IAAA,OAAAG,MAAA,CAAAG,KAAA,OAAAC,SAAA;EAAA;EAAAC,YAAA,CAAAR,kBAAA;IAAAS,GAAA;IAAAC,GAAA,EAStB,SAAAA,IAAA,EAAa;MACX,IAAAC,aAAA,GAA4D,IAAI,CAACC,OAAO;QAAhEC,MAAM,GAAAF,aAAA,CAANE,MAAM;QAAAC,qB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;YAACqF,EAAE,EAAE;UAAE,GAAC,OAAK,CAAM,eACvB/F,KAAA,CAAAgE,aAAA,CAACrD,IAAI;YAACsF,IAAI;UAAA,GAAEV,KAAK,CAAQ,CAE5B;QAGP,CAAC;MACH,CAAC,CACiB;IAExB;EAAC;IAAAhE,GAAA;IAAAgC,KAAA,EAED,SAAA6C,mBAAA,EAAuC;MACrC,OAAO,IAAI,CAAC1E,OAAO,CAAC2E,WAAW,CAAC,gBAAgB,EAAE;QAAEC,SAAS,EAAE;MAAO,CAAC,CAAC;IAC1E;EAAC;EAAA,OAAAxF,kBAAA;AAAA,EAxI8BN,aAAa;AAAA+F,eAAA,CAAxCzF,kBAAkB,iBAKD,YAAY;AAAAyF,eAAA,CAL7BzF,kBAAkB,aAOL,CAACD,WAAW,CAACD,iBAAiB,CAAC,CAAC;AAoInD,OAAO,IAAM4F,SAAwB,GAAGvG,eAAe,CAACa,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AreaChart.type.js","names":[],"sources":["../../../../src/component/Chart/AreaChart.type.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"AreaChart.type.js","names":[],"sources":["../../../../src/component/Chart/AreaChart.type.ts"],"sourcesContent":["import { Intergalactic } from '@semcore/core';\nimport { Flex } from '@semcore/flex-box';\nimport { interpolateValue } from '../../utils';\nimport { ScaleLinear, ScaleTime } from 'd3-scale';\nimport { CurveFactory } from 'd3-shape';\nimport { BaseChartProps } from './AbstractChart.type';\n\nexport type AreaChartData = Array<Record<string, number | typeof interpolateValue | Date>>;\n\nexport type AreaChartProps = BaseChartProps<AreaChartData> & {\n groupKey: string;\n xScale?: ScaleLinear<any, any> | ScaleTime<any, any>;\n yScale?: ScaleLinear<any, any>;\n showDots?: boolean;\n curve?: CurveFactory;\n stacked?: boolean;\n};\n\nexport type AreaChartType = Intergalactic.Component<typeof Flex, AreaChartProps>;\n"],"mappings":""}
|
|
@@ -2,27 +2,33 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
6
|
+
import _get from "@babel/runtime/helpers/get";
|
|
7
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
8
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
9
|
+
import _createSuper from "@babel/runtime/helpers/createSuper";
|
|
8
10
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
-
import { createComponent } from '@semcore/core';
|
|
10
|
-
import i18nEnhance from '@semcore/core/lib/utils/enhances/i18nEnhance';
|
|
11
|
-
import { scaleBand, scaleLinear, scaleTime } from 'd3-scale';
|
|
12
11
|
import React from 'react';
|
|
13
|
-
import
|
|
12
|
+
import createComponent from '@semcore/core';
|
|
13
|
+
import { scaleBand, scaleLinear, scaleTime } from 'd3-scale';
|
|
14
14
|
// @ts-ignore
|
|
15
|
-
import { minMax, GroupBar, HoverRect, StackBar, Line
|
|
15
|
+
import { minMax, GroupBar, HoverRect, StackBar, Line } from '../..';
|
|
16
|
+
import { AbstractChart } from './AbstractChart';
|
|
17
|
+
import { Box, Flex } from '@semcore/flex-box';
|
|
18
|
+
import { Text } from '@semcore/typography';
|
|
16
19
|
import { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';
|
|
20
|
+
import i18nEnhance from '@semcore/utils/lib/enhances/i18nEnhance';
|
|
17
21
|
var BarChartComponent = /*#__PURE__*/function (_AbstractChart) {
|
|
22
|
+
_inherits(BarChartComponent, _AbstractChart);
|
|
23
|
+
var _super = _createSuper(BarChartComponent);
|
|
18
24
|
function BarChartComponent() {
|
|
19
25
|
var _this;
|
|
20
26
|
_classCallCheck(this, BarChartComponent);
|
|
21
27
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
22
28
|
args[_key] = arguments[_key];
|
|
23
29
|
}
|
|
24
|
-
_this =
|
|
25
|
-
_defineProperty(_this, "handleClickBar", function (_data, e, barIndex, barKey) {
|
|
30
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
31
|
+
_defineProperty(_assertThisInitialized(_this), "handleClickBar", function (_data, e, barIndex, barKey) {
|
|
26
32
|
var onClickBar = _this.asProps.onClickBar;
|
|
27
33
|
if (onClickBar) {
|
|
28
34
|
onClickBar(barIndex, barKey, e);
|
|
@@ -30,8 +36,7 @@ var BarChartComponent = /*#__PURE__*/function (_AbstractChart) {
|
|
|
30
36
|
});
|
|
31
37
|
return _this;
|
|
32
38
|
}
|
|
33
|
-
|
|
34
|
-
return _createClass(BarChartComponent, [{
|
|
39
|
+
_createClass(BarChartComponent, [{
|
|
35
40
|
key: "xScale",
|
|
36
41
|
get: function get() {
|
|
37
42
|
var _this$asProps = this.asProps,
|
|
@@ -68,6 +73,8 @@ var BarChartComponent = /*#__PURE__*/function (_AbstractChart) {
|
|
|
68
73
|
value: function renderTrend(key) {
|
|
69
74
|
var _this$asProps3 = this.asProps,
|
|
70
75
|
groupKey = _this$asProps3.groupKey,
|
|
76
|
+
_this$asProps3$type = _this$asProps3.type,
|
|
77
|
+
type = _this$asProps3$type === void 0 ? 'group' : _this$asProps3$type,
|
|
71
78
|
invertAxis = _this$asProps3.invertAxis,
|
|
72
79
|
trend = _this$asProps3.trend;
|
|
73
80
|
var withTrend = this.state.withTrend;
|
|
@@ -78,7 +85,7 @@ var BarChartComponent = /*#__PURE__*/function (_AbstractChart) {
|
|
|
78
85
|
key: "".concat(key, "_").concat(groupKey),
|
|
79
86
|
x: invertAxis ? 'y' : 'x',
|
|
80
87
|
y: invertAxis ? 'x' : 'y',
|
|
81
|
-
color:
|
|
88
|
+
color: 'wall',
|
|
82
89
|
style: {
|
|
83
90
|
strokeWidth: 3,
|
|
84
91
|
strokeDasharray: 5
|
|
@@ -105,7 +112,7 @@ var BarChartComponent = /*#__PURE__*/function (_AbstractChart) {
|
|
|
105
112
|
if (dataDefinitions.length === 1) {
|
|
106
113
|
var item = dataDefinitions[0];
|
|
107
114
|
var BarComponent = invertAxis ? GroupBar.HorizontalBar : GroupBar.Bar;
|
|
108
|
-
return
|
|
115
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(BarComponent, {
|
|
109
116
|
x: invertAxis ? item.id : groupKey,
|
|
110
117
|
y: invertAxis ? groupKey : item.id,
|
|
111
118
|
key: item.id,
|
|
@@ -168,73 +175,48 @@ var BarChartComponent = /*#__PURE__*/function (_AbstractChart) {
|
|
|
168
175
|
var _this$asProps5 = this.asProps,
|
|
169
176
|
data = _this$asProps5.data,
|
|
170
177
|
groupKey = _this$asProps5.groupKey,
|
|
178
|
+
showTotalInTooltip = _this$asProps5.showTotalInTooltip,
|
|
179
|
+
showTooltip = _this$asProps5.showTooltip,
|
|
171
180
|
invertAxis = _this$asProps5.invertAxis,
|
|
172
181
|
onClickHoverRect = _this$asProps5.onClickHoverRect;
|
|
182
|
+
var dataDefinitions = this.state.dataDefinitions;
|
|
183
|
+
if (!showTooltip) {
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
173
186
|
return /*#__PURE__*/React.createElement(HoverRect.Tooltip, {
|
|
174
187
|
x: invertAxis ? undefined : groupKey,
|
|
175
188
|
y: invertAxis ? groupKey : undefined,
|
|
176
189
|
wMin: 100,
|
|
177
190
|
onClick: onClickHoverRect
|
|
178
191
|
}, function (_ref) {
|
|
192
|
+
var _dataItem$groupKey;
|
|
179
193
|
var xIndex = _ref.xIndex,
|
|
180
194
|
yIndex = _ref.yIndex;
|
|
181
195
|
var index = invertAxis ? yIndex : xIndex;
|
|
182
196
|
var dataItem = data[index];
|
|
197
|
+
var total = _this3.totalValue(dataItem);
|
|
183
198
|
return {
|
|
184
|
-
children:
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
199
|
+
children: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(HoverRect.Tooltip.Title, null, (_dataItem$groupKey = dataItem[groupKey]) === null || _dataItem$groupKey === void 0 ? void 0 : _dataItem$groupKey.toString()), dataDefinitions.map(function (item) {
|
|
200
|
+
return item.checked && /*#__PURE__*/React.createElement(Flex, {
|
|
201
|
+
justifyContent: "space-between",
|
|
202
|
+
key: item.id
|
|
203
|
+
}, /*#__PURE__*/React.createElement(HoverRect.Tooltip.Dot, {
|
|
204
|
+
mr: 4,
|
|
205
|
+
color: item.color
|
|
206
|
+
}, item.label), /*#__PURE__*/React.createElement(Text, {
|
|
207
|
+
bold: true
|
|
208
|
+
}, _this3.tooltipValueFormatter(dataItem[item.id])));
|
|
209
|
+
}), showTotalInTooltip === true && /*#__PURE__*/React.createElement(Flex, {
|
|
210
|
+
mt: 2,
|
|
211
|
+
justifyContent: "space-between"
|
|
212
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
213
|
+
mr: 4
|
|
214
|
+
}, "Total"), /*#__PURE__*/React.createElement(Text, {
|
|
215
|
+
bold: true
|
|
216
|
+
}, total)))
|
|
188
217
|
};
|
|
189
218
|
});
|
|
190
219
|
}
|
|
191
|
-
}, {
|
|
192
|
-
key: "renderAxis",
|
|
193
|
-
value: function renderAxis() {
|
|
194
|
-
var _this$asProps6 = this.asProps,
|
|
195
|
-
invertAxis = _this$asProps6.invertAxis,
|
|
196
|
-
showXAxis = _this$asProps6.showXAxis,
|
|
197
|
-
showYAxis = _this$asProps6.showYAxis,
|
|
198
|
-
data = _this$asProps6.data,
|
|
199
|
-
axisXValueFormatter = _this$asProps6.axisXValueFormatter,
|
|
200
|
-
axisYValueFormatter = _this$asProps6.axisYValueFormatter,
|
|
201
|
-
multilineXTicks = _this$asProps6.multilineXTicks,
|
|
202
|
-
multilineYTicks = _this$asProps6.multilineYTicks;
|
|
203
|
-
if (!Array.isArray(data)) {
|
|
204
|
-
return null;
|
|
205
|
-
}
|
|
206
|
-
var xTicks = this.xTicks;
|
|
207
|
-
var yTicks = this.yTicks;
|
|
208
|
-
var childrenX = axisXValueFormatter ? function (_ref2) {
|
|
209
|
-
var value = _ref2.value;
|
|
210
|
-
return {
|
|
211
|
-
children: axisXValueFormatter(value)
|
|
212
|
-
};
|
|
213
|
-
} : undefined;
|
|
214
|
-
var childrenY = axisYValueFormatter ? function (_ref3) {
|
|
215
|
-
var value = _ref3.value;
|
|
216
|
-
return {
|
|
217
|
-
children: axisYValueFormatter(value)
|
|
218
|
-
};
|
|
219
|
-
} : undefined;
|
|
220
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, showYAxis && /*#__PURE__*/React.createElement(YAxis, null, yTicks ? /*#__PURE__*/React.createElement(YAxis.Ticks, {
|
|
221
|
-
primaryText: invertAxis,
|
|
222
|
-
multiline: multilineYTicks,
|
|
223
|
-
ticks: yTicks
|
|
224
|
-
}, childrenY) : /*#__PURE__*/React.createElement(YAxis.Ticks, {
|
|
225
|
-
primaryText: invertAxis,
|
|
226
|
-
multiline: multilineYTicks
|
|
227
|
-
}, childrenY), invertAxis !== true && (yTicks ? /*#__PURE__*/React.createElement(YAxis.Grid, {
|
|
228
|
-
ticks: yTicks
|
|
229
|
-
}) : /*#__PURE__*/React.createElement(YAxis.Grid, null))), showXAxis && /*#__PURE__*/React.createElement(XAxis, null, xTicks ? /*#__PURE__*/React.createElement(XAxis.Ticks, {
|
|
230
|
-
multiline: multilineXTicks,
|
|
231
|
-
ticks: xTicks
|
|
232
|
-
}, childrenX) : /*#__PURE__*/React.createElement(XAxis.Ticks, {
|
|
233
|
-
multiline: multilineXTicks
|
|
234
|
-
}, childrenX), invertAxis === true && (xTicks ? /*#__PURE__*/React.createElement(XAxis.Grid, {
|
|
235
|
-
ticks: xTicks
|
|
236
|
-
}) : /*#__PURE__*/React.createElement(XAxis.Grid, null))));
|
|
237
|
-
}
|
|
238
220
|
}, {
|
|
239
221
|
key: "getLegendAriaLabel",
|
|
240
222
|
value: function getLegendAriaLabel() {
|
|
@@ -245,16 +227,16 @@ var BarChartComponent = /*#__PURE__*/function (_AbstractChart) {
|
|
|
245
227
|
}, {
|
|
246
228
|
key: "categoryScale",
|
|
247
229
|
get: function get() {
|
|
248
|
-
var _this$
|
|
249
|
-
_this$
|
|
250
|
-
marginY = _this$
|
|
251
|
-
_this$
|
|
252
|
-
marginX = _this$
|
|
253
|
-
plotWidth = _this$
|
|
254
|
-
plotHeight = _this$
|
|
255
|
-
invertAxis = _this$
|
|
256
|
-
data = _this$
|
|
257
|
-
groupKey = _this$
|
|
230
|
+
var _this$asProps6 = this.asProps,
|
|
231
|
+
_this$asProps6$margin = _this$asProps6.marginY,
|
|
232
|
+
marginY = _this$asProps6$margin === void 0 ? 40 : _this$asProps6$margin,
|
|
233
|
+
_this$asProps6$margin2 = _this$asProps6.marginX,
|
|
234
|
+
marginX = _this$asProps6$margin2 === void 0 ? 24 : _this$asProps6$margin2,
|
|
235
|
+
plotWidth = _this$asProps6.plotWidth,
|
|
236
|
+
plotHeight = _this$asProps6.plotHeight,
|
|
237
|
+
invertAxis = _this$asProps6.invertAxis,
|
|
238
|
+
data = _this$asProps6.data,
|
|
239
|
+
groupKey = _this$asProps6.groupKey;
|
|
258
240
|
var testItem = data[0][groupKey];
|
|
259
241
|
var range = invertAxis ? [plotHeight - marginX, this.plotPadding] : [marginY, plotWidth - this.plotPadding];
|
|
260
242
|
if (testItem instanceof Date && !Number.isNaN(testItem.getMilliseconds())) {
|
|
@@ -269,19 +251,20 @@ var BarChartComponent = /*#__PURE__*/function (_AbstractChart) {
|
|
|
269
251
|
}, {
|
|
270
252
|
key: "valueScale",
|
|
271
253
|
get: function get() {
|
|
272
|
-
var _this$
|
|
273
|
-
_this$
|
|
274
|
-
marginY = _this$
|
|
275
|
-
_this$
|
|
276
|
-
marginX = _this$
|
|
277
|
-
plotWidth = _this$
|
|
278
|
-
plotHeight = _this$
|
|
279
|
-
invertAxis = _this$
|
|
280
|
-
type = _this$
|
|
281
|
-
var max = type === 'stack' ?
|
|
254
|
+
var _this$asProps7 = this.asProps,
|
|
255
|
+
_this$asProps7$margin = _this$asProps7.marginY,
|
|
256
|
+
marginY = _this$asProps7$margin === void 0 ? 40 : _this$asProps7$margin,
|
|
257
|
+
_this$asProps7$margin2 = _this$asProps7.marginX,
|
|
258
|
+
marginX = _this$asProps7$margin2 === void 0 ? 24 : _this$asProps7$margin2,
|
|
259
|
+
plotWidth = _this$asProps7.plotWidth,
|
|
260
|
+
plotHeight = _this$asProps7.plotHeight,
|
|
261
|
+
invertAxis = _this$asProps7.invertAxis,
|
|
262
|
+
type = _this$asProps7.type;
|
|
263
|
+
var max = type === 'stack' ? _get(_getPrototypeOf(BarChartComponent.prototype), "maxStackedValue", this) : Math.max.apply(Math, _toConsumableArray(_get(_getPrototypeOf(BarChartComponent.prototype), "flatValues", this)));
|
|
282
264
|
return scaleLinear().range(invertAxis ? [marginY, plotWidth - this.plotPadding] : [plotHeight - marginX, this.plotPadding]).domain([0, max]);
|
|
283
265
|
}
|
|
284
266
|
}]);
|
|
267
|
+
return BarChartComponent;
|
|
285
268
|
}(AbstractChart);
|
|
286
269
|
_defineProperty(BarChartComponent, "displayName", 'Chart.Bar');
|
|
287
270
|
_defineProperty(BarChartComponent, "enhance", [i18nEnhance(localizedMessages)]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BarChart.js","names":["createComponent","i18nEnhance","scaleBand","scaleLinear","scaleTime","React","AbstractChart","minMax","GroupBar","HoverRect","StackBar","Line","YAxis","XAxis","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","renderAxis","_this$asProps6","showXAxis","showYAxis","axisXValueFormatter","axisYValueFormatter","multilineXTicks","multilineYTicks","isArray","xTicks","yTicks","childrenX","_ref2","childrenY","_ref3","Ticks","primaryText","multiline","ticks","Grid","getLegendAriaLabel","getI18nText","chartType","_this$asProps7","_this$asProps7$margin","marginY","_this$asProps7$margin2","marginX","plotWidth","plotHeight","testItem","range","plotPadding","Date","Number","isNaN","getMilliseconds","domain","paddingInner","paddingOuter","_this$asProps8","_this$asProps8$margin","_this$asProps8$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, 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 =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cAAA,CAAVpG,UAAU;QAAE8B,IAAI,GAAAsE,cAAA,CAAJtE,IAAI;MAE3E,IAAMyE,GAAG,GAAGzE,IAAI,KAAK,OAAO,GAAA0E,aAAA,CAAAjI,iBAAA,gCAA2BkI,IAAI,CAACF,GAAG,CAAAG,KAAA,CAARD,IAAI,EAAAE,kBAAA,CAAAH,aAAA,CAAAjI,iBAAA,yBAAwB,CAAC;MAEpF,OAAOZ,WAAW,CAAC,CAAC,CACjBgI,KAAK,CACJ3F,UAAU,GACN,CAACqF,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,EAvR6BzI,aAAa;AAAAqB,eAAA,CAAvCZ,iBAAiB,iBAKA,WAAW;AAAAY,eAAA,CAL5BZ,iBAAiB,aAOJ,CAACd,WAAW,CAACa,iBAAiB,CAAC,CAAC;AAmRnD,OAAO,IAAMsI,QAAsB,GAAGpJ,eAAe,CAACe,iBAAiB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"BarChart.js","names":["React","createComponent","scaleBand","scaleLinear","scaleTime","minMax","GroupBar","HoverRect","StackBar","Line","AbstractChart","Box","Flex","Text","localizedMessages","i18nEnhance","BarChartComponent","_AbstractChart","_inherits","_super","_createSuper","_this","_classCallCheck","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty","_assertThisInitialized","_data","e","barIndex","barKey","onClickBar","asProps","_createClass","key","get","_this$asProps","xScale","invertAxis","valueScale","categoryScale","_this$asProps2","yScale","value","defaultLegendProps","props","trend","undefined","withTrend","renderTrend","_this$asProps3","groupKey","_this$asProps3$type","type","state","trendItem","createElement","data","x","y","color","style","strokeWidth","strokeDasharray","Dots","display","renderChart","_this2","_this$asProps4","_this$asProps4$type","_this$state","dataDefinitions","highlightedLine","item","BarComponent","HorizontalBar","Bar","Fragment","id","onClick","handleClickBar","map","index","commonBarComponentProps","transparent","checked","_extends","renderTooltip","_this3","_this$asProps5","showTotalInTooltip","showTooltip","onClickHoverRect","Tooltip","wMin","_ref","_dataItem$groupKey","xIndex","yIndex","dataItem","total","totalValue","children","Title","toString","justifyContent","Dot","mr","label","bold","tooltipValueFormatter","mt","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","_get","_getPrototypeOf","prototype","Math","_toConsumableArray","BarChart"],"sources":["../../../../src/component/Chart/BarChart.tsx"],"sourcesContent":["import React from 'react';\nimport createComponent from '@semcore/core';\nimport { BaseLegendProps } from './AbstractChart.type';\nimport { BarChartData, BarChartProps, BarChartType } from './BarChart.type';\nimport { scaleBand, scaleLinear, scaleTime } from 'd3-scale';\n// @ts-ignore\nimport { minMax, GroupBar, HoverRect, StackBar, Line } from '../..';\nimport { AbstractChart } from './AbstractChart';\nimport { BarProps } from '../../types';\nimport { Box, Flex } from '@semcore/flex-box';\nimport { Text } from '@semcore/typography';\nimport { LegendItemKey } from '../ChartLegend/LegendItem/LegendItem.type';\nimport { localizedMessages } from '../../translations/__intergalactic-dynamic-locales';\nimport i18nEnhance from '@semcore/utils/lib/enhances/i18nEnhance';\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, type = 'group', 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 <>\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 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, showTotalInTooltip, showTooltip, invertAxis, onClickHoverRect } =\n this.asProps;\n const { dataDefinitions } = this.state;\n\n if (!showTooltip) {\n return null;\n }\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 const total = this.totalValue(dataItem);\n\n return {\n children: (\n <>\n <HoverRect.Tooltip.Title>{dataItem[groupKey]?.toString()}</HoverRect.Tooltip.Title>\n\n {dataDefinitions.map((item) => {\n return (\n item.checked && (\n <Flex justifyContent='space-between' key={item.id}>\n <HoverRect.Tooltip.Dot mr={4} color={item.color}>\n {item.label}\n </HoverRect.Tooltip.Dot>\n <Text bold>{this.tooltipValueFormatter(dataItem[item.id])}</Text>\n </Flex>\n )\n );\n })}\n\n {showTotalInTooltip === true && (\n <Flex mt={2} justifyContent='space-between'>\n <Box mr={4}>Total</Box>\n <Text bold>{total}</Text>\n </Flex>\n )}\n </>\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 = createComponent(BarChartComponent);\n"],"mappings":";;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,eAAe,MAAM,eAAe;AAG3C,SAASC,SAAS,EAAEC,WAAW,EAAEC,SAAS,QAAQ,UAAU;AAC5D;AACA,SAASC,MAAM,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,IAAI,QAAQ,OAAO;AACnE,SAASC,aAAa,QAAQ,iBAAiB;AAE/C,SAASC,GAAG,EAAEC,IAAI,QAAQ,mBAAmB;AAC7C,SAASC,IAAI,QAAQ,qBAAqB;AAE1C,SAASC,iBAAiB,QAAQ,oDAAoD;AACtF,OAAOC,WAAW,MAAM,yCAAyC;AAAC,IAE5DC,iBAAiB,0BAAAC,cAAA;EAAAC,SAAA,CAAAF,iBAAA,EAAAC,cAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,iBAAA;EAAA,SAAAA,kBAAA;IA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,SAAA,8BAA2BC,IAAI,CAACJ,GAAG,CAAAhH,KAAA,CAARoH,IAAI,EAAAC,kBAAA,CAAAJ,IAAA,CAAAC,eAAA,CAAAhI,iBAAA,CAAAiI,SAAA,wBAAyB;MAEpF,OAAO9I,WAAW,EAAE,CACjB+H,KAAK,CACJrF,UAAU,GACN,CAAC+E,OAAO,EAAEG,SAAS,GAAG,IAAI,CAACI,WAAW,CAAC,GACvC,CAACH,UAAU,GAAGF,OAAO,EAAE,IAAI,CAACK,WAAW,CAAC,CAC7C,CACAK,MAAM,CAAC,CAAC,CAAC,EAAEM,GAAG,CAAC,CAAC;IACrB;EAAC;EAAA,OAAA9H,iBAAA;AAAA,EAxP6BN,aAAa;AAAAsB,eAAA,CAAvChB,iBAAiB,iBAKA,WAAW;AAAAgB,eAAA,CAL5BhB,iBAAiB,aAOJ,CAACD,WAAW,CAACD,iBAAiB,CAAC,CAAC;AAoPnD,OAAO,IAAMsI,QAAsB,GAAGnJ,eAAe,CAACe,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BarChart.type.js","names":[],"sources":["../../../../src/component/Chart/BarChart.type.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"BarChart.type.js","names":[],"sources":["../../../../src/component/Chart/BarChart.type.ts"],"sourcesContent":["import React from 'react';\nimport { Intergalactic } from '@semcore/core';\nimport { Flex } from '@semcore/flex-box';\nimport { ScaleBand, ScaleLinear, ScaleTime } from 'd3-scale';\nimport { BaseChartProps } from './AbstractChart.type';\nimport { LegendItemKey } from '../ChartLegend/LegendItem/LegendItem.type';\n\ntype TrendItem = {\n x: number;\n y: number;\n};\n\ntype BarKey = string;\n\nexport type BarChartData = Array<Record<BarKey, string | number | Date>>;\n\nexport type BarChartProps = BaseChartProps<BarChartData> & {\n groupKey: string;\n xScale?: ScaleBand<any> | ScaleTime<any, any>;\n yScale?: ScaleLinear<any, any>;\n type?: 'stack' | 'group';\n trend?: Record<LegendItemKey, TrendItem[]>;\n\n /** Handle click by `HoverRect`. `index` is an index of the data array. */\n onClickHoverRect?: (index: number, e: React.SyntheticEvent) => void;\n\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>;\n"],"mappings":""}
|