@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,58 +1,45 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
-
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
4
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
5
|
-
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
6
1
|
import { makeBezier } from "./bezier.mjs";
|
|
7
|
-
|
|
2
|
+
const getPropByPath = (obj, path) => {
|
|
8
3
|
if (typeof path === "number") path = String(path);
|
|
9
4
|
if (typeof path === "string") path = path.split(".");
|
|
10
|
-
for (
|
|
11
|
-
if (
|
|
5
|
+
for (let i = 0; i < path.length; i++) {
|
|
6
|
+
if (typeof obj !== "object" || obj === null) return obj;
|
|
12
7
|
obj = obj[path[i]];
|
|
13
8
|
}
|
|
14
9
|
return obj;
|
|
15
10
|
};
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
const movingAverage = (data, frame) => {
|
|
12
|
+
const result = [];
|
|
18
13
|
frame = Math.floor(frame) % 2 === data.length % 2 ? Math.floor(frame) : Math.ceil(frame);
|
|
19
|
-
for (
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
for (let i = 0; i < data.length; i++) {
|
|
15
|
+
let startIndex = Math.max(0, i - Math.floor(frame / 2));
|
|
16
|
+
let endIndex = Math.min(data.length, i + Math.ceil(frame / 2));
|
|
22
17
|
startIndex = Math.min(startIndex, Math.max(0, endIndex - frame));
|
|
23
18
|
endIndex = Math.max(endIndex, Math.min(data.length, startIndex + frame));
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}, 0);
|
|
28
|
-
var value = sum / part.length;
|
|
19
|
+
const part = data.slice(startIndex, endIndex);
|
|
20
|
+
const sum = part.reduce((sum2, item) => sum2 + item, 0);
|
|
21
|
+
const value = sum / part.length;
|
|
29
22
|
result.push(value);
|
|
30
23
|
}
|
|
31
24
|
return result;
|
|
32
25
|
};
|
|
33
|
-
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return [key2, true];
|
|
43
|
-
}));
|
|
26
|
+
const extractDataInsights = (data, hints, config) => {
|
|
27
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
28
|
+
let insights = [];
|
|
29
|
+
let dataType = config.dataType ?? hints.dataType;
|
|
30
|
+
const dataRange = [];
|
|
31
|
+
let groupKeys = [...hints.groups];
|
|
32
|
+
const dataTitle = hints.axesTitle.vertical ?? hints.axesTitle.horizontal;
|
|
33
|
+
let entitiesCount = 0;
|
|
34
|
+
const keysMap = Object.fromEntries(Object.keys((Array.isArray(data) ? data[0] : data) ?? {}).map((key) => [key, true]));
|
|
44
35
|
if (!dataType) {
|
|
45
36
|
if ((keysMap["y"] || keysMap["y1"] || keysMap["y2"]) && keysMap["x"] && (keysMap["value"] || keysMap["label"]) || hints.fields.horizontalAxes.size > 0 && hints.fields.verticalAxes.size > 0 && hints.fields.valueAxes.size > 0) {
|
|
46
37
|
dataType = "points-cloud";
|
|
47
38
|
} else if (Array.isArray(data) && data.length > 6) {
|
|
48
39
|
dataType = "time-series";
|
|
49
40
|
} else if (Array.isArray(data) && Object.keys(keysMap).length >= 3) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}).filter(function(key2) {
|
|
53
|
-
var allData = data.map(function(row2) {
|
|
54
|
-
return row2[key2];
|
|
55
|
-
});
|
|
41
|
+
const possibleGroupKeys = Object.keys(keysMap).filter((key) => typeof data[0][key] === "string").filter((key) => {
|
|
42
|
+
const allData = data.map((row) => row[key]);
|
|
56
43
|
return new Set(allData).size === allData.length;
|
|
57
44
|
});
|
|
58
45
|
if (possibleGroupKeys.length === 1) {
|
|
@@ -70,250 +57,195 @@ var extractDataInsights = function extractDataInsights2(data, hints, config) {
|
|
|
70
57
|
}
|
|
71
58
|
if (Array.isArray(data)) {
|
|
72
59
|
if (dataType === "time-series") {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
});
|
|
80
|
-
var possibleLabelKeys = ["label", "x"].concat(_toConsumableArray(hints.fields.horizontalAxes));
|
|
81
|
-
var labelsKey = possibleLabelKeys.filter(function(key2) {
|
|
82
|
-
return keysMap[key2];
|
|
83
|
-
})[0];
|
|
60
|
+
const firstRow = data[0];
|
|
61
|
+
const lastRow = data[data.length - 1];
|
|
62
|
+
const possibleValueKeys = ["y", "value", ...hints.fields.verticalAxes];
|
|
63
|
+
const valuesKeys = possibleValueKeys.filter((key) => keysMap[key]);
|
|
64
|
+
const possibleLabelKeys = ["label", "x", ...hints.fields.horizontalAxes];
|
|
65
|
+
const labelsKey = possibleLabelKeys.filter((key) => keysMap[key])[0];
|
|
84
66
|
entitiesCount = Object.keys(valuesKeys).length;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
67
|
+
const fromKey = firstRow[labelsKey];
|
|
68
|
+
const toKey = lastRow[labelsKey];
|
|
69
|
+
const from = ((_b = (_a = hints.titles).getHorizontalAxesTitle) == null ? void 0 : _b.call(_a, fromKey)) ?? hints.titles.horizontalAxes[fromKey] ?? fromKey;
|
|
70
|
+
const to = ((_d = (_c = hints.titles).getHorizontalAxesTitle) == null ? void 0 : _d.call(_c, toKey)) ?? hints.titles.horizontalAxes[toKey] ?? toKey;
|
|
89
71
|
if (entitiesCount > 0) {
|
|
90
|
-
var _hints$axesTitle$vert2;
|
|
91
72
|
dataRange.push({
|
|
92
73
|
from,
|
|
93
74
|
to,
|
|
94
|
-
label:
|
|
75
|
+
label: hints.axesTitle.vertical ?? labelsKey
|
|
95
76
|
});
|
|
96
77
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
78
|
+
for (const valueKey of valuesKeys) {
|
|
79
|
+
const values = data.map((row) => row[valueKey]).filter((value) => typeof value !== "symbol");
|
|
80
|
+
const sum = values.reduce((sum2, value) => sum2 + value, 0);
|
|
81
|
+
const average = sum / values.length;
|
|
82
|
+
const variance = 1 / values.length * values.map((value) => (value - average) ** 2).reduce((sum2, item) => sum2 + item, 0);
|
|
83
|
+
const standardDeviation = Math.sqrt(variance);
|
|
84
|
+
const trendStrengths = ["static", "weak", "medium", "strong"];
|
|
85
|
+
const frameSize = Math.sqrt(values.length);
|
|
86
|
+
const longMovingAverageSize = config.movingAverage.longSize ?? frameSize;
|
|
87
|
+
const shortMovingAverageSize = config.movingAverage.shortSize ?? Math.sqrt(frameSize);
|
|
88
|
+
const longMovingAverage = movingAverage(values, longMovingAverageSize);
|
|
89
|
+
const shortMovingAverage = values.length < 8 ? values : movingAverage(values, shortMovingAverageSize);
|
|
90
|
+
const table = [];
|
|
91
|
+
for (const i in values) {
|
|
92
|
+
table.push({
|
|
93
|
+
value: (values[i] ?? Number.NaN).toFixed(2),
|
|
94
|
+
long: (longMovingAverage[i] ?? Number.NaN).toFixed(2),
|
|
95
|
+
short: (shortMovingAverage[i] ?? Number.NaN).toFixed(2)
|
|
106
96
|
});
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
var shortMovingAverageSize = (_config$movingAverage2 = config.movingAverage.shortSize) !== null && _config$movingAverage2 !== void 0 ? _config$movingAverage2 : Math.sqrt(frameSize);
|
|
121
|
-
var longMovingAverage = movingAverage(values2, longMovingAverageSize);
|
|
122
|
-
var shortMovingAverage = values2.length < 8 ? values2 : movingAverage(values2, shortMovingAverageSize);
|
|
123
|
-
var table = [];
|
|
124
|
-
for (var i2 in values2) {
|
|
125
|
-
var _values$i, _longMovingAverage$i, _shortMovingAverage$i;
|
|
126
|
-
table.push({
|
|
127
|
-
value: ((_values$i = values2[i2]) !== null && _values$i !== void 0 ? _values$i : Number.NaN).toFixed(2),
|
|
128
|
-
"long": ((_longMovingAverage$i = longMovingAverage[i2]) !== null && _longMovingAverage$i !== void 0 ? _longMovingAverage$i : Number.NaN).toFixed(2),
|
|
129
|
-
"short": ((_shortMovingAverage$i = shortMovingAverage[i2]) !== null && _shortMovingAverage$i !== void 0 ? _shortMovingAverage$i : Number.NaN).toFixed(2)
|
|
130
|
-
});
|
|
97
|
+
}
|
|
98
|
+
const strengthsMap = {
|
|
99
|
+
growth: {
|
|
100
|
+
static: "static",
|
|
101
|
+
weak: "weak-growth",
|
|
102
|
+
medium: "growth",
|
|
103
|
+
strong: "strong-growth"
|
|
104
|
+
},
|
|
105
|
+
reduction: {
|
|
106
|
+
static: "static",
|
|
107
|
+
weak: "weak-reduction",
|
|
108
|
+
medium: "reduction",
|
|
109
|
+
strong: "strong-reduction"
|
|
131
110
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
111
|
+
};
|
|
112
|
+
const recordTrend = ({
|
|
113
|
+
value,
|
|
114
|
+
width,
|
|
115
|
+
label,
|
|
116
|
+
type
|
|
117
|
+
}) => {
|
|
118
|
+
var _a2, _b2;
|
|
119
|
+
for (let i = 0; i < trendStrengths.length; i++) {
|
|
120
|
+
const normalizedHeight = Math.abs(value.from - value.to) / (((_a2 = hints.pointsDensity) == null ? void 0 : _a2.verticalAxes) ?? 1);
|
|
121
|
+
const normalizedWidth = width / (((_b2 = hints.pointsDensity) == null ? void 0 : _b2.horizontalAxes) ?? 1);
|
|
122
|
+
const tang = normalizedHeight / normalizedWidth;
|
|
123
|
+
const trendStrength = trendStrengths[i];
|
|
124
|
+
if (tang <= config.trendTangens[trendStrength] || i === trendStrengths.length - 1) {
|
|
125
|
+
const strength = value.to > value.from ? strengthsMap.growth[trendStrength] : strengthsMap.reduction[trendStrength];
|
|
126
|
+
return {
|
|
127
|
+
type,
|
|
128
|
+
priority: i,
|
|
129
|
+
change: {
|
|
130
|
+
from: value.from,
|
|
131
|
+
to: value.to,
|
|
132
|
+
strength
|
|
133
|
+
},
|
|
134
|
+
from: label.from,
|
|
135
|
+
to: label.to,
|
|
136
|
+
dataKey: label.dataKey,
|
|
137
|
+
label: label.displayValue
|
|
138
|
+
};
|
|
144
139
|
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
const generalTrend = recordTrend({
|
|
143
|
+
type: "general-trend",
|
|
144
|
+
value: {
|
|
145
|
+
from: shortMovingAverage[0],
|
|
146
|
+
to: shortMovingAverage[shortMovingAverage.length - 1]
|
|
147
|
+
},
|
|
148
|
+
width: data.length,
|
|
149
|
+
label: {
|
|
150
|
+
from,
|
|
151
|
+
to,
|
|
152
|
+
dataKey: valueKey,
|
|
153
|
+
displayValue: hints.titles.valuesAxes[valueKey]
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
const localTrends = [];
|
|
157
|
+
{
|
|
158
|
+
const notableDiff = config.movingAverage.notableDiff ?? standardDeviation / 10;
|
|
159
|
+
let lastSwitch = 0;
|
|
160
|
+
let lastSwitchValue = shortMovingAverage[lastSwitch];
|
|
161
|
+
let shortWasAbove = shortMovingAverage[0] > longMovingAverage[0];
|
|
162
|
+
for (let i = 1; i < data.length; i++) {
|
|
163
|
+
const shortIsAbove = shortMovingAverage[i] > longMovingAverage[i];
|
|
164
|
+
const diff = Math.abs(shortMovingAverage[i] - longMovingAverage[i]);
|
|
165
|
+
if (shortIsAbove === shortWasAbove) continue;
|
|
166
|
+
if (diff < notableDiff) continue;
|
|
167
|
+
if (i === 0 && lastSwitch === data.length - 1) continue;
|
|
168
|
+
if (i === data.length - 1 && lastSwitch === 0) continue;
|
|
169
|
+
i = Math.min(i, data.length - 1);
|
|
170
|
+
const fromKey2 = data[lastSwitch][labelsKey];
|
|
171
|
+
const toKey2 = data[i][labelsKey];
|
|
172
|
+
const from2 = ((_f = (_e = hints.titles).getHorizontalAxesTitle) == null ? void 0 : _f.call(_e, fromKey2)) ?? hints.titles.horizontalAxes[fromKey2] ?? fromKey2;
|
|
173
|
+
const to2 = ((_h = (_g = hints.titles).getHorizontalAxesTitle) == null ? void 0 : _h.call(_g, toKey2)) ?? hints.titles.horizontalAxes[toKey2] ?? toKey2;
|
|
174
|
+
localTrends.push(recordTrend({
|
|
175
|
+
type: "trend",
|
|
176
|
+
value: {
|
|
177
|
+
from: lastSwitchValue,
|
|
178
|
+
to: shortMovingAverage[i]
|
|
179
|
+
},
|
|
180
|
+
width: i - lastSwitch,
|
|
181
|
+
label: {
|
|
182
|
+
from: from2,
|
|
183
|
+
to: to2,
|
|
184
|
+
dataKey: valueKey,
|
|
185
|
+
displayValue: hints.titles.valuesAxes[valueKey]
|
|
169
186
|
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
label: {
|
|
180
|
-
from,
|
|
181
|
-
to,
|
|
182
|
-
dataKey: valueKey,
|
|
183
|
-
displayValue: hints.titles.valuesAxes[valueKey]
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
var localTrends = [];
|
|
187
|
-
{
|
|
188
|
-
var _config$movingAverage3;
|
|
189
|
-
var notableDiff = (_config$movingAverage3 = config.movingAverage.notableDiff) !== null && _config$movingAverage3 !== void 0 ? _config$movingAverage3 : standardDeviation / 10;
|
|
190
|
-
var lastSwitch = 0;
|
|
191
|
-
var lastSwitchValue = shortMovingAverage[lastSwitch];
|
|
192
|
-
var shortWasAbove = shortMovingAverage[0] > longMovingAverage[0];
|
|
193
|
-
for (var _i2 = 1; _i2 < data.length; _i2++) {
|
|
194
|
-
var _ref5, _hints$titles$getHori5, _hints$titles$getHori6, _hints$titles3, _ref6, _hints$titles$getHori7, _hints$titles$getHori8, _hints$titles4;
|
|
195
|
-
var shortIsAbove = shortMovingAverage[_i2] > longMovingAverage[_i2];
|
|
196
|
-
var diff = Math.abs(shortMovingAverage[_i2] - longMovingAverage[_i2]);
|
|
197
|
-
if (shortIsAbove === shortWasAbove) continue;
|
|
198
|
-
if (diff < notableDiff) continue;
|
|
199
|
-
if (_i2 === 0 && lastSwitch === data.length - 1) continue;
|
|
200
|
-
if (_i2 === data.length - 1 && lastSwitch === 0) continue;
|
|
201
|
-
_i2 = Math.min(_i2, data.length - 1);
|
|
202
|
-
var _fromKey = data[lastSwitch][labelsKey];
|
|
203
|
-
var _toKey = data[_i2][labelsKey];
|
|
204
|
-
var _from = (_ref5 = (_hints$titles$getHori5 = (_hints$titles$getHori6 = (_hints$titles3 = hints.titles).getHorizontalAxesTitle) === null || _hints$titles$getHori6 === void 0 ? void 0 : _hints$titles$getHori6.call(_hints$titles3, _fromKey)) !== null && _hints$titles$getHori5 !== void 0 ? _hints$titles$getHori5 : hints.titles.horizontalAxes[_fromKey]) !== null && _ref5 !== void 0 ? _ref5 : _fromKey;
|
|
205
|
-
var _to = (_ref6 = (_hints$titles$getHori7 = (_hints$titles$getHori8 = (_hints$titles4 = hints.titles).getHorizontalAxesTitle) === null || _hints$titles$getHori8 === void 0 ? void 0 : _hints$titles$getHori8.call(_hints$titles4, _toKey)) !== null && _hints$titles$getHori7 !== void 0 ? _hints$titles$getHori7 : hints.titles.horizontalAxes[_toKey]) !== null && _ref6 !== void 0 ? _ref6 : _toKey;
|
|
187
|
+
}));
|
|
188
|
+
lastSwitch = i;
|
|
189
|
+
lastSwitchValue = shortMovingAverage[lastSwitch];
|
|
190
|
+
shortWasAbove = shortIsAbove;
|
|
191
|
+
}
|
|
192
|
+
if (lastSwitch !== 0) {
|
|
193
|
+
const lastIndex = shortMovingAverage.length - 1;
|
|
194
|
+
const lastValue = shortMovingAverage[lastIndex];
|
|
195
|
+
if (Math.abs(lastSwitchValue - lastValue) > notableDiff) {
|
|
206
196
|
localTrends.push(recordTrend({
|
|
207
197
|
type: "trend",
|
|
208
198
|
value: {
|
|
209
199
|
from: lastSwitchValue,
|
|
210
|
-
to:
|
|
200
|
+
to: lastValue
|
|
211
201
|
},
|
|
212
|
-
width:
|
|
202
|
+
width: lastIndex - lastSwitch,
|
|
213
203
|
label: {
|
|
214
|
-
from:
|
|
215
|
-
to:
|
|
204
|
+
from: data[lastSwitch][labelsKey],
|
|
205
|
+
to: data[lastIndex][labelsKey],
|
|
216
206
|
dataKey: valueKey,
|
|
217
207
|
displayValue: hints.titles.valuesAxes[valueKey]
|
|
218
208
|
}
|
|
219
209
|
}));
|
|
220
|
-
lastSwitch = _i2;
|
|
221
|
-
lastSwitchValue = shortMovingAverage[lastSwitch];
|
|
222
|
-
shortWasAbove = shortIsAbove;
|
|
223
|
-
}
|
|
224
|
-
if (lastSwitch !== 0) {
|
|
225
|
-
var lastIndex = shortMovingAverage.length - 1;
|
|
226
|
-
var lastValue = shortMovingAverage[lastIndex];
|
|
227
|
-
if (Math.abs(lastSwitchValue - lastValue) > notableDiff) {
|
|
228
|
-
localTrends.push(recordTrend({
|
|
229
|
-
type: "trend",
|
|
230
|
-
value: {
|
|
231
|
-
from: lastSwitchValue,
|
|
232
|
-
to: lastValue
|
|
233
|
-
},
|
|
234
|
-
width: lastIndex - lastSwitch,
|
|
235
|
-
label: {
|
|
236
|
-
from: data[lastSwitch][labelsKey],
|
|
237
|
-
to: data[lastIndex][labelsKey],
|
|
238
|
-
dataKey: valueKey,
|
|
239
|
-
displayValue: hints.titles.valuesAxes[valueKey]
|
|
240
|
-
}
|
|
241
|
-
}));
|
|
242
|
-
}
|
|
243
210
|
}
|
|
244
211
|
}
|
|
245
|
-
insights.push(generalTrend);
|
|
246
|
-
(_insights = insights).push.apply(_insights, localTrends);
|
|
247
|
-
};
|
|
248
|
-
for (_iterator.s(); !(_step = _iterator.n()).done; ) {
|
|
249
|
-
_loop();
|
|
250
212
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
} finally {
|
|
254
|
-
_iterator.f();
|
|
213
|
+
insights.push(generalTrend);
|
|
214
|
+
insights.push(...localTrends);
|
|
255
215
|
}
|
|
256
216
|
} else if (dataType === "points-cloud") {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
};
|
|
269
|
-
});
|
|
270
|
-
var gridSize = (_ref7 = (_config$clustersGridS = config.clustersGridSize) !== null && _config$clustersGridS !== void 0 ? _config$clustersGridS : hints.grid.verticalAxes) !== null && _ref7 !== void 0 ? _ref7 : hints.grid.horizontalAxes;
|
|
217
|
+
const guessedXKey = [...hints.fields.horizontalAxes.values(), "x"][0];
|
|
218
|
+
const guessedYKey = [...hints.fields.verticalAxes.values(), "y"][0];
|
|
219
|
+
const guessedValueKey = [...hints.fields.valueAxes.values(), "value"][0];
|
|
220
|
+
const guessedLabelKey = keysMap["label"] ? "label" : guessedValueKey;
|
|
221
|
+
const normalized = data.map((row) => ({
|
|
222
|
+
x: row[guessedXKey],
|
|
223
|
+
y: row[guessedYKey],
|
|
224
|
+
label: row[guessedLabelKey],
|
|
225
|
+
value: row[guessedValueKey]
|
|
226
|
+
}));
|
|
227
|
+
let gridSize = config.clustersGridSize ?? hints.grid.verticalAxes ?? hints.grid.horizontalAxes;
|
|
271
228
|
if (!gridSize) {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
} catch (err) {
|
|
282
|
-
_iterator2.e(err);
|
|
283
|
-
} finally {
|
|
284
|
-
_iterator2.f();
|
|
229
|
+
const usedX = /* @__PURE__ */ new Set();
|
|
230
|
+
const usedY = /* @__PURE__ */ new Set();
|
|
231
|
+
for (const {
|
|
232
|
+
x,
|
|
233
|
+
y
|
|
234
|
+
} of normalized) {
|
|
235
|
+
usedX.add(x);
|
|
236
|
+
usedY.add(y);
|
|
285
237
|
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
});
|
|
298
|
-
var avgDistanceX = distancesX.reduce(function(sum, x2) {
|
|
299
|
-
return sum + x2;
|
|
300
|
-
}, 0) / distancesX.length;
|
|
301
|
-
var avgDistanceY = distancesY.reduce(function(sum, y2) {
|
|
302
|
-
return sum + y2;
|
|
303
|
-
}, 0) / distancesY.length;
|
|
304
|
-
var belowAvgDistancesX = distancesX.filter(function(x2) {
|
|
305
|
-
return x2 < avgDistanceX;
|
|
306
|
-
});
|
|
307
|
-
var belowAvgDistancesY = distancesY.filter(function(y2) {
|
|
308
|
-
return y2 < avgDistanceY;
|
|
309
|
-
});
|
|
310
|
-
var betweenDistanceX = belowAvgDistancesX.reduce(function(sum, x2) {
|
|
311
|
-
return sum + x2;
|
|
312
|
-
}, 0) / belowAvgDistancesX.length;
|
|
313
|
-
var betweenDistanceY = belowAvgDistancesY.reduce(function(sum, y2) {
|
|
314
|
-
return sum + y2;
|
|
315
|
-
}, 0) / belowAvgDistancesY.length;
|
|
316
|
-
var avgDistance = 0;
|
|
238
|
+
const orderedX = [...usedX].sort((a, b) => a - b);
|
|
239
|
+
const orderedY = [...usedY].sort((a, b) => a - b);
|
|
240
|
+
const distancesX = orderedX.slice(0, -1).map((x, index) => orderedX[index + 1] - x);
|
|
241
|
+
const distancesY = orderedY.slice(0, -1).map((y, index) => orderedY[index + 1] - y);
|
|
242
|
+
const avgDistanceX = distancesX.reduce((sum, x) => sum + x, 0) / distancesX.length;
|
|
243
|
+
const avgDistanceY = distancesY.reduce((sum, y) => sum + y, 0) / distancesY.length;
|
|
244
|
+
const belowAvgDistancesX = distancesX.filter((x) => x < avgDistanceX);
|
|
245
|
+
const belowAvgDistancesY = distancesY.filter((y) => y < avgDistanceY);
|
|
246
|
+
const betweenDistanceX = belowAvgDistancesX.reduce((sum, x) => sum + x, 0) / belowAvgDistancesX.length;
|
|
247
|
+
const betweenDistanceY = belowAvgDistancesY.reduce((sum, y) => sum + y, 0) / belowAvgDistancesY.length;
|
|
248
|
+
let avgDistance = 0;
|
|
317
249
|
if (!Number.isNaN(betweenDistanceX) && !Number.isNaN(betweenDistanceY)) {
|
|
318
250
|
avgDistance = (betweenDistanceX + betweenDistanceY) / 2;
|
|
319
251
|
} else if (!Number.isNaN(betweenDistanceX)) {
|
|
@@ -325,90 +257,59 @@ var extractDataInsights = function extractDataInsights2(data, hints, config) {
|
|
|
325
257
|
}
|
|
326
258
|
gridSize = Math.sqrt(Math.sqrt(avgDistance));
|
|
327
259
|
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
for (
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
260
|
+
const grid = {};
|
|
261
|
+
const takenY = /* @__PURE__ */ new Set();
|
|
262
|
+
const takenX = /* @__PURE__ */ new Set();
|
|
263
|
+
for (let i = 0; i < normalized.length; i++) {
|
|
264
|
+
const {
|
|
265
|
+
x,
|
|
266
|
+
y
|
|
267
|
+
} = normalized[i];
|
|
268
|
+
const gridX = Math.round(x / gridSize);
|
|
269
|
+
const gridY = Math.round(y / gridSize);
|
|
270
|
+
takenY.add(y);
|
|
271
|
+
takenX.add(x);
|
|
272
|
+
grid[gridX] = grid[gridX] ?? {};
|
|
273
|
+
grid[gridX][gridY] = grid[gridX][gridY] ?? {
|
|
274
|
+
clusterId: `${gridX}_${gridY}`,
|
|
341
275
|
members: []
|
|
342
276
|
};
|
|
343
277
|
grid[gridX][gridY].members.push(normalized[i]);
|
|
344
278
|
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
var _clusters$grid$_x3$_y, _clusters$grid$_x3$_y2;
|
|
358
|
-
var _y3 = _step4.value;
|
|
359
|
-
var pointHandled = false;
|
|
360
|
-
for (var _i4 = 0, _arr = [_x3 - 1, _x3, _x3 + 1]; _i4 < _arr.length; _i4++) {
|
|
361
|
-
var xNeighbour = _arr[_i4];
|
|
362
|
-
for (var _i5 = 0, _arr2 = [_y3 - 1, _y3, _y3 + 1]; _i5 < _arr2.length; _i5++) {
|
|
363
|
-
var _grid$xNeighbour;
|
|
364
|
-
var yNeighbour = _arr2[_i5];
|
|
365
|
-
if (xNeighbour === void 0 || yNeighbour === void 0) continue;
|
|
366
|
-
if (xNeighbour === _x3 && yNeighbour === _y3) continue;
|
|
367
|
-
if (!((_grid$xNeighbour = grid[xNeighbour]) !== null && _grid$xNeighbour !== void 0 && _grid$xNeighbour[yNeighbour])) continue;
|
|
368
|
-
pointHandled = true;
|
|
369
|
-
grid[_x3][_y3].clusterId = grid[xNeighbour][yNeighbour].clusterId;
|
|
370
|
-
break;
|
|
371
|
-
}
|
|
372
|
-
if (pointHandled) break;
|
|
373
|
-
}
|
|
374
|
-
clusters[grid[_x3][_y3].clusterId] = (_clusters$grid$_x3$_y = clusters[grid[_x3][_y3].clusterId]) !== null && _clusters$grid$_x3$_y !== void 0 ? _clusters$grid$_x3$_y : [];
|
|
375
|
-
(_clusters$grid$_x3$_y2 = clusters[grid[_x3][_y3].clusterId]).push.apply(_clusters$grid$_x3$_y2, _toConsumableArray(grid[_x3][_y3].members));
|
|
279
|
+
const clusters = {};
|
|
280
|
+
for (const x of Object.keys(grid).map((x2) => Number.parseInt(x2, 10))) {
|
|
281
|
+
for (const y of Object.keys(grid[x]).map((y2) => Number.parseInt(y2, 10))) {
|
|
282
|
+
let pointHandled = false;
|
|
283
|
+
for (const xNeighbour of [x - 1, x, x + 1]) {
|
|
284
|
+
for (const yNeighbour of [y - 1, y, y + 1]) {
|
|
285
|
+
if (xNeighbour === void 0 || yNeighbour === void 0) continue;
|
|
286
|
+
if (xNeighbour === x && yNeighbour === y) continue;
|
|
287
|
+
if (!((_i = grid[xNeighbour]) == null ? void 0 : _i[yNeighbour])) continue;
|
|
288
|
+
pointHandled = true;
|
|
289
|
+
grid[x][y].clusterId = grid[xNeighbour][yNeighbour].clusterId;
|
|
290
|
+
break;
|
|
376
291
|
}
|
|
377
|
-
|
|
378
|
-
_iterator4.e(err);
|
|
379
|
-
} finally {
|
|
380
|
-
_iterator4.f();
|
|
292
|
+
if (pointHandled) break;
|
|
381
293
|
}
|
|
294
|
+
clusters[grid[x][y].clusterId] = clusters[grid[x][y].clusterId] ?? [];
|
|
295
|
+
clusters[grid[x][y].clusterId].push(...grid[x][y].members);
|
|
382
296
|
}
|
|
383
|
-
} catch (err) {
|
|
384
|
-
_iterator3.e(err);
|
|
385
|
-
} finally {
|
|
386
|
-
_iterator3.f();
|
|
387
297
|
}
|
|
388
|
-
|
|
389
|
-
for (
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
});
|
|
403
|
-
var uniqueLabels = _toConsumableArray(new Set(labels));
|
|
404
|
-
var _x2 = clusters[clusterId].reduce(function(sum, _ref0) {
|
|
405
|
-
var x2 = _ref0.x;
|
|
406
|
-
return sum + x2;
|
|
407
|
-
}, 0) / clusters[clusterId].length;
|
|
408
|
-
var _y2 = clusters[clusterId].reduce(function(sum, _ref1) {
|
|
409
|
-
var y2 = _ref1.y;
|
|
410
|
-
return sum + y2;
|
|
411
|
-
}, 0) / clusters[clusterId].length;
|
|
298
|
+
const clustersInsights = [];
|
|
299
|
+
for (const clusterId in clusters) {
|
|
300
|
+
const size = clusters[clusterId].reduce((sum, {
|
|
301
|
+
value
|
|
302
|
+
}) => sum + (value ?? 1), 0);
|
|
303
|
+
const labels = [...clusters[clusterId]].sort((a, b) => b.value - a.value).map(({
|
|
304
|
+
label
|
|
305
|
+
}) => label).filter((label) => label !== void 0);
|
|
306
|
+
const uniqueLabels = [...new Set(labels)];
|
|
307
|
+
const x = clusters[clusterId].reduce((sum, {
|
|
308
|
+
x: x2
|
|
309
|
+
}) => sum + x2, 0) / clusters[clusterId].length;
|
|
310
|
+
const y = clusters[clusterId].reduce((sum, {
|
|
311
|
+
y: y2
|
|
312
|
+
}) => sum + y2, 0) / clusters[clusterId].length;
|
|
412
313
|
clustersInsights.push({
|
|
413
314
|
type: "cluster",
|
|
414
315
|
priority: 1,
|
|
@@ -416,62 +317,58 @@ var extractDataInsights = function extractDataInsights2(data, hints, config) {
|
|
|
416
317
|
labels: uniqueLabels,
|
|
417
318
|
relativeSize: "average",
|
|
418
319
|
center: {
|
|
419
|
-
x
|
|
420
|
-
y
|
|
421
|
-
xLabel:
|
|
422
|
-
yLabel:
|
|
320
|
+
x,
|
|
321
|
+
y,
|
|
322
|
+
xLabel: hints.axesTitle.horizontal ?? guessedXKey,
|
|
323
|
+
yLabel: hints.axesTitle.vertical ?? guessedYKey
|
|
423
324
|
}
|
|
424
325
|
});
|
|
425
326
|
}
|
|
426
327
|
entitiesCount = Object.keys(clusters).length;
|
|
427
|
-
clustersInsights.sort(
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
var normalizingSize = averageSize * 2;
|
|
468
|
-
var averageSizeNormalized = averageSize / normalizingSize;
|
|
469
|
-
var smallerSizeNormalized = smallerSize / normalizingSize;
|
|
470
|
-
var biggerSizeNormalized = biggerSize / normalizingSize;
|
|
328
|
+
clustersInsights.sort((a, b) => b.size - a.size);
|
|
329
|
+
const relativeSizeDistrivution = {
|
|
330
|
+
["significantly-bigger"]: {
|
|
331
|
+
max: Number.POSITIVE_INFINITY,
|
|
332
|
+
min: 0.85
|
|
333
|
+
},
|
|
334
|
+
["bigger"]: {
|
|
335
|
+
min: 0.7,
|
|
336
|
+
max: 0.85
|
|
337
|
+
},
|
|
338
|
+
["slightly-bigger"]: {
|
|
339
|
+
min: 0.6,
|
|
340
|
+
max: 0.7
|
|
341
|
+
},
|
|
342
|
+
["average"]: {
|
|
343
|
+
min: 0.4,
|
|
344
|
+
max: 0.6
|
|
345
|
+
},
|
|
346
|
+
["slightly-smaller"]: {
|
|
347
|
+
max: 0.4,
|
|
348
|
+
min: 0.3
|
|
349
|
+
},
|
|
350
|
+
["smaller"]: {
|
|
351
|
+
min: 0.15,
|
|
352
|
+
max: 0.3
|
|
353
|
+
},
|
|
354
|
+
["significantly-smaller"]: {
|
|
355
|
+
min: Number.NEGATIVE_INFINITY,
|
|
356
|
+
max: 0.15
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
const averageSize = clustersInsights.reduce((sum, cluster) => sum + cluster.size, 0) / clustersInsights.length;
|
|
360
|
+
const smallerClusters = clustersInsights.filter((cluster) => cluster.size < averageSize);
|
|
361
|
+
const smallerSize = smallerClusters.reduce((sum, cluster) => sum + cluster.size, 0) / smallerClusters.length;
|
|
362
|
+
const biggerClusters = clustersInsights.filter((cluster) => cluster.size > averageSize);
|
|
363
|
+
const biggerSize = biggerClusters.reduce((sum, cluster) => sum + cluster.size, 0) / biggerClusters.length;
|
|
364
|
+
const normalizingSize = averageSize * 2;
|
|
365
|
+
let averageSizeNormalized = averageSize / normalizingSize;
|
|
366
|
+
let smallerSizeNormalized = smallerSize / normalizingSize;
|
|
367
|
+
let biggerSizeNormalized = biggerSize / normalizingSize;
|
|
471
368
|
smallerSizeNormalized = !Number.isNaN(smallerSizeNormalized) ? smallerSizeNormalized : 0.25;
|
|
472
369
|
averageSizeNormalized = !Number.isNaN(averageSizeNormalized) ? averageSizeNormalized : 0.5;
|
|
473
370
|
biggerSizeNormalized = !Number.isNaN(biggerSizeNormalized) ? biggerSizeNormalized : 0.75;
|
|
474
|
-
|
|
371
|
+
const sizeMapBezier = makeBezier([{
|
|
475
372
|
x: 0,
|
|
476
373
|
y: 0
|
|
477
374
|
}, {
|
|
@@ -491,23 +388,25 @@ var extractDataInsights = function extractDataInsights2(data, hints, config) {
|
|
|
491
388
|
}], {
|
|
492
389
|
width: 1
|
|
493
390
|
});
|
|
494
|
-
for (
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
391
|
+
for (const clustersInsight of clustersInsights) {
|
|
392
|
+
const {
|
|
393
|
+
size
|
|
394
|
+
} = clustersInsight;
|
|
395
|
+
const mappedSize = sizeMapBezier(size / normalizingSize);
|
|
396
|
+
for (const relativeSize in relativeSizeDistrivution) {
|
|
397
|
+
const {
|
|
398
|
+
min,
|
|
399
|
+
max
|
|
400
|
+
} = relativeSizeDistrivution[relativeSize];
|
|
500
401
|
if (mappedSize > min && mappedSize <= max) {
|
|
501
402
|
clustersInsight.relativeSize = relativeSize;
|
|
502
403
|
break;
|
|
503
404
|
}
|
|
504
405
|
}
|
|
505
406
|
}
|
|
506
|
-
|
|
407
|
+
insights.push(...clustersInsights);
|
|
507
408
|
if (hints.axesTitle.horizontal) {
|
|
508
|
-
|
|
509
|
-
return a - b;
|
|
510
|
-
});
|
|
409
|
+
const sortedX = [...takenX].sort((a, b) => a - b);
|
|
511
410
|
dataRange.push({
|
|
512
411
|
from: sortedX[0],
|
|
513
412
|
to: sortedX[sortedX.length - 1],
|
|
@@ -515,9 +414,7 @@ var extractDataInsights = function extractDataInsights2(data, hints, config) {
|
|
|
515
414
|
});
|
|
516
415
|
}
|
|
517
416
|
if (hints.axesTitle.vertical) {
|
|
518
|
-
|
|
519
|
-
return a - b;
|
|
520
|
-
});
|
|
417
|
+
const sortedY = [...takenY].sort((a, b) => a - b);
|
|
521
418
|
dataRange.push({
|
|
522
419
|
from: sortedY[0],
|
|
523
420
|
to: sortedY[sortedY.length - 1],
|
|
@@ -525,108 +422,76 @@ var extractDataInsights = function extractDataInsights2(data, hints, config) {
|
|
|
525
422
|
});
|
|
526
423
|
}
|
|
527
424
|
} else if (dataType === "grouped-values") {
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
var _groupedValues$key, _hints$titles$getHori9, _hints$titles$getHori0, _hints$titles5;
|
|
538
|
-
var row = data[_i6];
|
|
539
|
-
var key = allRowsIds[_i6];
|
|
540
|
-
var groupKeyValue = getPropByPath(row, groupKeys[0]);
|
|
541
|
-
groupedValues[key] = (_groupedValues$key = groupedValues[key]) !== null && _groupedValues$key !== void 0 ? _groupedValues$key : {
|
|
542
|
-
groupName: (_hints$titles$getHori9 = (_hints$titles$getHori0 = (_hints$titles5 = hints.titles).getHorizontalAxesTitle) === null || _hints$titles$getHori0 === void 0 ? void 0 : _hints$titles$getHori0.call(_hints$titles5, groupKeyValue)) !== null && _hints$titles$getHori9 !== void 0 ? _hints$titles$getHori9 : groupKeyValue,
|
|
425
|
+
const makeRowKey = (row) => groupKeys.map((key, index) => `${index}-${getPropByPath(row, key)}`).join("-");
|
|
426
|
+
const allRowsIds = data.map(makeRowKey);
|
|
427
|
+
const groupedValues = {};
|
|
428
|
+
for (let i = 0; i < data.length; i++) {
|
|
429
|
+
const row = data[i];
|
|
430
|
+
const key = allRowsIds[i];
|
|
431
|
+
const groupKeyValue = getPropByPath(row, groupKeys[0]);
|
|
432
|
+
groupedValues[key] = groupedValues[key] ?? {
|
|
433
|
+
groupName: ((_k = (_j = hints.titles).getHorizontalAxesTitle) == null ? void 0 : _k.call(_j, groupKeyValue)) ?? groupKeyValue,
|
|
543
434
|
rows: []
|
|
544
435
|
};
|
|
545
436
|
groupedValues[key].rows.push(row);
|
|
546
437
|
}
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
return [key2, true];
|
|
550
|
-
}));
|
|
438
|
+
let fields = [...hints.fields.values];
|
|
439
|
+
const grouppingKeys = Object.fromEntries(groupKeys.map((key) => [key, true]));
|
|
551
440
|
if (fields.length === 0) {
|
|
552
|
-
|
|
553
|
-
(_fields = fields).push.apply(_fields, _toConsumableArray(Object.keys(keysMap)));
|
|
441
|
+
fields.push(...Object.keys(keysMap));
|
|
554
442
|
}
|
|
555
|
-
fields = fields.filter(
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
var _row = _step5.value;
|
|
566
|
-
var _iterator6 = _createForOfIteratorHelper(fields), _step6;
|
|
567
|
-
try {
|
|
568
|
-
for (_iterator6.s(); !(_step6 = _iterator6.n()).done; ) {
|
|
569
|
-
var _ref13, _hints$titles$valuesA, _hints$titles$getVert, _hints$titles6;
|
|
570
|
-
var field = _step6.value;
|
|
571
|
-
values2.push({
|
|
572
|
-
label: (_ref13 = (_hints$titles$valuesA = hints.titles.valuesAxes[field]) !== null && _hints$titles$valuesA !== void 0 ? _hints$titles$valuesA : (_hints$titles$getVert = (_hints$titles6 = hints.titles).getVerticalAxesTitle) === null || _hints$titles$getVert === void 0 ? void 0 : _hints$titles$getVert.call(_hints$titles6, field)) !== null && _ref13 !== void 0 ? _ref13 : field,
|
|
573
|
-
value: getPropByPath(_row, field)
|
|
574
|
-
});
|
|
575
|
-
}
|
|
576
|
-
} catch (err) {
|
|
577
|
-
_iterator6.e(err);
|
|
578
|
-
} finally {
|
|
579
|
-
_iterator6.f();
|
|
580
|
-
}
|
|
443
|
+
fields = fields.filter((key) => !grouppingKeys[key]);
|
|
444
|
+
const groups = Object.entries(groupedValues).map(([groupKey, group]) => {
|
|
445
|
+
var _a2, _b2;
|
|
446
|
+
const values = [];
|
|
447
|
+
for (const row of group.rows) {
|
|
448
|
+
for (const field of fields) {
|
|
449
|
+
values.push({
|
|
450
|
+
label: hints.titles.valuesAxes[field] ?? ((_b2 = (_a2 = hints.titles).getVerticalAxesTitle) == null ? void 0 : _b2.call(_a2, field)) ?? field,
|
|
451
|
+
value: getPropByPath(row, field)
|
|
452
|
+
});
|
|
581
453
|
}
|
|
582
|
-
} catch (err) {
|
|
583
|
-
_iterator5.e(err);
|
|
584
|
-
} finally {
|
|
585
|
-
_iterator5.f();
|
|
586
454
|
}
|
|
587
|
-
|
|
455
|
+
values.sort((a, b) => {
|
|
588
456
|
if (typeof a.value !== "number" || typeof b.value !== "number") return 0;
|
|
589
457
|
return b.value - a.value;
|
|
590
458
|
});
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
}, 0) / values2.length;
|
|
459
|
+
const averageValue = values.reduce((sum, {
|
|
460
|
+
value
|
|
461
|
+
}) => sum + value, 0) / values.length;
|
|
595
462
|
return {
|
|
596
|
-
label:
|
|
597
|
-
values
|
|
463
|
+
label: group.groupName ?? groupKey,
|
|
464
|
+
values,
|
|
598
465
|
averageValue: !Number.isNaN(averageValue) ? averageValue : void 0
|
|
599
466
|
};
|
|
600
467
|
});
|
|
601
|
-
groups.sort(
|
|
468
|
+
groups.sort((a, b) => {
|
|
602
469
|
if (typeof a.averageValue !== "number" || typeof b.averageValue !== "number") return 0;
|
|
603
470
|
return b.averageValue - a.averageValue;
|
|
604
471
|
});
|
|
605
472
|
entitiesCount = groups.length;
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
priority: 1
|
|
612
|
-
};
|
|
473
|
+
insights.push(...groups.map((group) => ({
|
|
474
|
+
type: "comparison",
|
|
475
|
+
label: group.label,
|
|
476
|
+
values: group.values,
|
|
477
|
+
priority: 1
|
|
613
478
|
})));
|
|
614
479
|
}
|
|
615
480
|
}
|
|
616
481
|
if (dataType === "values-set") {
|
|
617
|
-
|
|
618
|
-
if (
|
|
619
|
-
|
|
482
|
+
const fields = [...hints.fields.values];
|
|
483
|
+
if (fields.length === 0) {
|
|
484
|
+
fields.push(...Object.keys(keysMap));
|
|
620
485
|
}
|
|
621
|
-
|
|
622
|
-
var
|
|
486
|
+
const values = fields.map((field) => {
|
|
487
|
+
var _a2, _b2;
|
|
623
488
|
return {
|
|
624
|
-
label:
|
|
489
|
+
label: hints.titles.valuesAxes[field] ?? ((_b2 = (_a2 = hints.titles).getValueAxesTitle) == null ? void 0 : _b2.call(_a2, field)) ?? field,
|
|
625
490
|
value: getPropByPath(data, field)
|
|
626
491
|
};
|
|
627
492
|
});
|
|
628
493
|
entitiesCount = values.length;
|
|
629
|
-
values.sort(
|
|
494
|
+
values.sort((a, b) => {
|
|
630
495
|
if (typeof a.value !== "number" || typeof b.value !== "number") return 0;
|
|
631
496
|
return b.value - a.value;
|
|
632
497
|
});
|
|
@@ -637,52 +502,39 @@ var extractDataInsights = function extractDataInsights2(data, hints, config) {
|
|
|
637
502
|
});
|
|
638
503
|
}
|
|
639
504
|
if (dataType === "indexed-groups") {
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
return {
|
|
647
|
-
label: getPropByPath(hints.titles.valuesAxes, String(fieldPath).substring(String(groupKey).length + 1)),
|
|
648
|
-
value: getPropByPath(data, String(fieldPath))
|
|
649
|
-
};
|
|
650
|
-
});
|
|
651
|
-
values2.sort(function(a, b) {
|
|
505
|
+
const groups = [...hints.groups].map((groupKey) => {
|
|
506
|
+
const values = [...hints.fields.values].filter((fieldPath) => String(fieldPath).startsWith(`${groupKey}.`)).map((fieldPath) => ({
|
|
507
|
+
label: getPropByPath(hints.titles.valuesAxes, String(fieldPath).substring(String(groupKey).length + 1)),
|
|
508
|
+
value: getPropByPath(data, String(fieldPath))
|
|
509
|
+
}));
|
|
510
|
+
values.sort((a, b) => {
|
|
652
511
|
if (typeof a.value !== "number" || typeof b.value !== "number") return 0;
|
|
653
512
|
return b.value - a.value;
|
|
654
513
|
});
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
}, 0) / values2.length;
|
|
514
|
+
const averageValue = values.reduce((sum, {
|
|
515
|
+
value
|
|
516
|
+
}) => sum + value, 0) / values.length;
|
|
659
517
|
return {
|
|
660
|
-
label:
|
|
661
|
-
values
|
|
518
|
+
label: getPropByPath(hints.titles.valuesAxes, String(groupKey)) ?? groupKey,
|
|
519
|
+
values,
|
|
662
520
|
averageValue: !Number.isNaN(averageValue) ? averageValue : void 0
|
|
663
521
|
};
|
|
664
522
|
});
|
|
665
|
-
|
|
523
|
+
groups.sort((a, b) => {
|
|
666
524
|
if (typeof a.averageValue !== "number" || typeof b.averageValue !== "number") return 0;
|
|
667
525
|
return b.averageValue - a.averageValue;
|
|
668
526
|
});
|
|
669
|
-
entitiesCount =
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
priority: 1
|
|
676
|
-
};
|
|
527
|
+
entitiesCount = groups.length;
|
|
528
|
+
insights.push(...groups.map((group) => ({
|
|
529
|
+
type: "comparison",
|
|
530
|
+
label: group.label,
|
|
531
|
+
values: group.values,
|
|
532
|
+
priority: 1
|
|
677
533
|
})));
|
|
678
534
|
}
|
|
679
|
-
|
|
680
|
-
return insight.priority > 0;
|
|
681
|
-
});
|
|
535
|
+
const hasHighPriorityInsights = insights.some((insight) => insight.priority > 0);
|
|
682
536
|
if (hasHighPriorityInsights) {
|
|
683
|
-
insights = insights.filter(
|
|
684
|
-
return insight.priority > 0;
|
|
685
|
-
});
|
|
537
|
+
insights = insights.filter((insight) => insight.priority > 0);
|
|
686
538
|
} else {
|
|
687
539
|
insights = insights.slice(0, 1);
|
|
688
540
|
}
|