@semcore/d3-chart 2.13.3 → 2.13.5
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 +12 -0
- package/lib/cjs/Area.js +59 -97
- package/lib/cjs/Area.js.map +1 -1
- package/lib/cjs/Axis.js +76 -143
- package/lib/cjs/Axis.js.map +1 -1
- package/lib/cjs/Bar.js +49 -96
- package/lib/cjs/Bar.js.map +1 -1
- package/lib/cjs/Bubble.js +39 -81
- package/lib/cjs/Bubble.js.map +1 -1
- package/lib/cjs/ClipPath.js +9 -35
- package/lib/cjs/ClipPath.js.map +1 -1
- package/lib/cjs/Donut.js +77 -152
- package/lib/cjs/Donut.js.map +1 -1
- package/lib/cjs/Dots.js +29 -57
- package/lib/cjs/Dots.js.map +1 -1
- package/lib/cjs/GroupBar.js +5 -26
- package/lib/cjs/GroupBar.js.map +1 -1
- package/lib/cjs/HorizontalBar.js +43 -84
- package/lib/cjs/HorizontalBar.js.map +1 -1
- package/lib/cjs/Hover.js +33 -88
- package/lib/cjs/Hover.js.map +1 -1
- package/lib/cjs/Line.js +42 -78
- package/lib/cjs/Line.js.map +1 -1
- package/lib/cjs/Plot.js +27 -73
- package/lib/cjs/Plot.js.map +1 -1
- package/lib/cjs/Radar.js +152 -277
- package/lib/cjs/Radar.js.map +1 -1
- package/lib/cjs/RadialTree.js +105 -211
- package/lib/cjs/RadialTree.js.map +1 -1
- package/lib/cjs/ReferenceLine.js +45 -87
- package/lib/cjs/ReferenceLine.js.map +1 -1
- package/lib/cjs/ResponsiveContainer.js +9 -38
- package/lib/cjs/ResponsiveContainer.js.map +1 -1
- package/lib/cjs/ScatterPlot.js +34 -74
- package/lib/cjs/ScatterPlot.js.map +1 -1
- package/lib/cjs/StackBar.js +9 -38
- package/lib/cjs/StackBar.js.map +1 -1
- package/lib/cjs/StackedArea.js +5 -29
- package/lib/cjs/StackedArea.js.map +1 -1
- package/lib/cjs/Tooltip.js +27 -76
- package/lib/cjs/Tooltip.js.map +1 -1
- package/lib/cjs/Venn.js +32 -75
- package/lib/cjs/Venn.js.map +1 -1
- package/lib/cjs/a11y/PlotA11yModule.js +18 -71
- package/lib/cjs/a11y/PlotA11yModule.js.map +1 -1
- package/lib/cjs/a11y/PlotA11yView.js +19 -83
- package/lib/cjs/a11y/PlotA11yView.js.map +1 -1
- package/lib/cjs/a11y/bezier.js +0 -7
- package/lib/cjs/a11y/bezier.js.map +1 -1
- package/lib/cjs/a11y/focus.js +2 -11
- package/lib/cjs/a11y/focus.js.map +1 -1
- package/lib/cjs/a11y/hints.js +0 -13
- package/lib/cjs/a11y/hints.js.map +1 -1
- package/lib/cjs/a11y/insights.js +21 -132
- package/lib/cjs/a11y/insights.js.map +1 -1
- package/lib/cjs/a11y/intl.js +0 -6
- package/lib/cjs/a11y/intl.js.map +1 -1
- package/lib/cjs/a11y/locale.js +4 -22
- package/lib/cjs/a11y/locale.js.map +1 -1
- package/lib/cjs/a11y/serialize.js +23 -83
- package/lib/cjs/a11y/serialize.js.map +1 -1
- package/lib/cjs/a11y/summarize.js +0 -4
- package/lib/cjs/a11y/summarize.js.map +1 -1
- package/lib/cjs/a11y/translations/module/__intergalactic-dynamic-locales.js +0 -13
- package/lib/cjs/a11y/translations/module/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/cjs/a11y/translations/view/__intergalactic-dynamic-locales.js +0 -13
- package/lib/cjs/a11y/translations/view/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/cjs/color.js +0 -3
- package/lib/cjs/color.js.map +1 -1
- package/lib/cjs/createElement.js +18 -47
- package/lib/cjs/createElement.js.map +1 -1
- package/lib/cjs/index.js +0 -23
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/types/Plot.d.js.map +1 -1
- package/lib/cjs/types/index.d.js +0 -39
- package/lib/cjs/types/index.d.js.map +1 -1
- package/lib/cjs/utils.js +7 -59
- package/lib/cjs/utils.js.map +1 -1
- package/lib/es6/Area.js +59 -86
- package/lib/es6/Area.js.map +1 -1
- package/lib/es6/Axis.js +76 -135
- package/lib/es6/Axis.js.map +1 -1
- package/lib/es6/Bar.js +49 -86
- package/lib/es6/Bar.js.map +1 -1
- package/lib/es6/Bubble.js +39 -70
- package/lib/es6/Bubble.js.map +1 -1
- package/lib/es6/ClipPath.js +9 -23
- package/lib/es6/ClipPath.js.map +1 -1
- package/lib/es6/Donut.js +77 -141
- package/lib/es6/Donut.js.map +1 -1
- package/lib/es6/Dots.js +29 -46
- package/lib/es6/Dots.js.map +1 -1
- package/lib/es6/GroupBar.js +5 -15
- package/lib/es6/GroupBar.js.map +1 -1
- package/lib/es6/HorizontalBar.js +43 -75
- package/lib/es6/HorizontalBar.js.map +1 -1
- package/lib/es6/Hover.js +33 -85
- package/lib/es6/Hover.js.map +1 -1
- package/lib/es6/Line.js +42 -67
- package/lib/es6/Line.js.map +1 -1
- package/lib/es6/Plot.js +27 -66
- package/lib/es6/Plot.js.map +1 -1
- package/lib/es6/Radar.js +152 -281
- package/lib/es6/Radar.js.map +1 -1
- package/lib/es6/RadialTree.js +105 -203
- package/lib/es6/RadialTree.js.map +1 -1
- package/lib/es6/ReferenceLine.js +45 -79
- package/lib/es6/ReferenceLine.js.map +1 -1
- package/lib/es6/ResponsiveContainer.js +9 -28
- package/lib/es6/ResponsiveContainer.js.map +1 -1
- package/lib/es6/ScatterPlot.js +34 -65
- package/lib/es6/ScatterPlot.js.map +1 -1
- package/lib/es6/StackBar.js +9 -26
- package/lib/es6/StackBar.js.map +1 -1
- package/lib/es6/StackedArea.js +5 -18
- package/lib/es6/StackedArea.js.map +1 -1
- package/lib/es6/Tooltip.js +27 -63
- package/lib/es6/Tooltip.js.map +1 -1
- package/lib/es6/Venn.js +32 -64
- package/lib/es6/Venn.js.map +1 -1
- package/lib/es6/a11y/PlotA11yModule.js +18 -52
- package/lib/es6/a11y/PlotA11yModule.js.map +1 -1
- package/lib/es6/a11y/PlotA11yView.js +19 -53
- package/lib/es6/a11y/PlotA11yView.js.map +1 -1
- package/lib/es6/a11y/bezier.js +0 -5
- package/lib/es6/a11y/bezier.js.map +1 -1
- package/lib/es6/a11y/focus.js +2 -9
- package/lib/es6/a11y/focus.js.map +1 -1
- package/lib/es6/a11y/hints.js +0 -3
- package/lib/es6/a11y/hints.js.map +1 -1
- package/lib/es6/a11y/insights.js +21 -133
- package/lib/es6/a11y/insights.js.map +1 -1
- package/lib/es6/a11y/intl.js +0 -1
- package/lib/es6/a11y/intl.js.map +1 -1
- package/lib/es6/a11y/locale.js +4 -18
- package/lib/es6/a11y/locale.js.map +1 -1
- package/lib/es6/a11y/serialize.js +23 -74
- 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.map +1 -1
- package/lib/es6/a11y/translations/view/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/color.js +0 -1
- package/lib/es6/color.js.map +1 -1
- package/lib/es6/createElement.js +18 -34
- package/lib/es6/createElement.js.map +1 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/types/Plot.d.js.map +1 -1
- package/lib/es6/types/index.d.js +5 -3
- package/lib/es6/types/index.d.js.map +1 -1
- package/lib/es6/utils.js +7 -28
- package/lib/es6/utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hints.js","names":["makeDataHintsContainer","fields","verticalAxes","Set","horizontalAxes","valueAxes","values","groups","axesTitle","vertical","horizontal","titles","getVerticalAxesTitle","getHorizontalAxesTitle","valuesAxes","getValueAxesTitle","grid","dataType","pointsDensity","makeDataHintsHandlers","mutableContainer","handler","specifyDataRowFields","x","y","value","add","setupGrid","direction","size","establishDataType","describeValueEntity","dataKey","readableName","labelKey","describeGroupedValues","groupKey","axes","label","addKeyLabelGetter","getter","setTitle","describedDataAxes","title","Date","String","setPointsDensity","makeDataSummarizationConfig","config","clustersGridSize","undefined","maxListSymbols","datesWithTime","clustersLimit","valuesLimit","groupsLimit","disable","override","trendTangens","weak","medium","strong","Infinity","movingAverage","longSize","shortSize","notableDiff","additionalFields"],"sources":["../../../src/a11y/hints.ts"],"sourcesContent":["import { SerializableDataType } from './insights';\n\ntype DeepPartial<T> = T extends object\n ? {\n [P in keyof T]?: DeepPartial<T[P]>;\n }\n : T;\n\nexport type DataStructureHints = {\n fields: {\n verticalAxes: Set<string | number>;\n horizontalAxes: Set<string | number>;\n valueAxes: Set<string | number>;\n values: Set<string | number>;\n };\n groups: Set<string | number>;\n axesTitle: {\n vertical: string | null;\n horizontal: string | null;\n };\n titles: {\n verticalAxes: {\n [dataKey: string | number]: string;\n };\n getVerticalAxesTitle: null | ((dataKey: string | number) => string);\n horizontalAxes: {\n [dataKey: string | number]: string;\n };\n getHorizontalAxesTitle: null | ((dataKey: string | number) => string);\n valuesAxes: {\n [dataKey: string | number]: string;\n };\n getValueAxesTitle: null | ((dataKey: string | number) => string);\n };\n grid: {\n verticalAxes: number | null;\n horizontalAxes: number | null;\n };\n pointsDensity: {\n verticalAxes: number;\n horizontalAxes: number;\n } | null;\n dataType: SerializableDataType | null;\n};\nexport type DataSummarizationConfig = {\n trendTangens: {\n static: number;\n weak: number;\n medium: number;\n strong: number;\n };\n movingAverage: {\n longSize: number | undefined;\n shortSize: number | undefined;\n notableDiff: number | undefined;\n };\n dataType: SerializableDataType | undefined;\n clustersGridSize: number | undefined;\n maxListSymbols: number;\n datesWithTime: boolean | undefined;\n clustersLimit: number;\n valuesLimit: number;\n groupsLimit: number;\n disable: boolean;\n override: string | undefined;\n additionalFields: string[];\n};\nexport type PartialDataSummarizationConfig = DeepPartial<DataSummarizationConfig>;\n\nexport const makeDataHintsContainer = (): DataStructureHints => ({\n fields: {\n verticalAxes: new Set(),\n horizontalAxes: new Set(),\n valueAxes: new Set(),\n values: new Set(),\n },\n groups: new Set(),\n axesTitle: {\n vertical: null,\n horizontal: null,\n },\n titles: {\n verticalAxes: {},\n getVerticalAxesTitle: null,\n horizontalAxes: {},\n getHorizontalAxesTitle: null,\n valuesAxes: {},\n getValueAxesTitle: null,\n },\n grid: {\n verticalAxes: null,\n horizontalAxes: null,\n },\n dataType: null,\n pointsDensity: null,\n});\n\nexport const makeDataHintsHandlers = (mutableContainer: DataStructureHints) => {\n const handler = {\n specifyDataRowFields: (x?: string, y?: string, value?: string) => {\n if (y) mutableContainer.fields.verticalAxes.add(y);\n if (x) mutableContainer.fields.horizontalAxes.add(x);\n if (value) mutableContainer.fields.valueAxes.add(value);\n },\n setupGrid: (direction: 'vertical' | 'horizontal', size: number) => {\n if (direction === 'horizontal') {\n mutableContainer.grid.horizontalAxes = size;\n } else if (direction === 'vertical') {\n mutableContainer.grid.verticalAxes = size;\n }\n },\n establishDataType: (dataType: SerializableDataType) => {\n mutableContainer.dataType = dataType;\n },\n describeValueEntity: (dataKey: string | number, readableName: string) => {\n mutableContainer.fields.values.add(dataKey);\n handler.labelKey('value', dataKey, readableName);\n },\n describeGroupedValues: (groupKey: string | number, dataKey: string | number) => {\n mutableContainer.groups.add(groupKey);\n mutableContainer.fields.values.add(dataKey);\n },\n labelKey: (\n axes: 'vertical' | 'horizontal' | 'value',\n dataKey: string | number,\n label: string,\n ) => {\n if (axes === 'vertical') mutableContainer.titles.verticalAxes[dataKey] = label;\n if (axes === 'horizontal') mutableContainer.titles.horizontalAxes[dataKey] = label;\n if (axes === 'value') mutableContainer.titles.valuesAxes[dataKey] = label;\n },\n addKeyLabelGetter: (\n axes: 'vertical' | 'horizontal' | 'value',\n getter: (dataKey: string | number) => string,\n ) => {\n if (axes === 'vertical') mutableContainer.titles.getVerticalAxesTitle = getter;\n if (axes === 'horizontal') mutableContainer.titles.getHorizontalAxesTitle = getter;\n if (axes === 'value') mutableContainer.titles.getValueAxesTitle = getter;\n },\n setTitle: (describedDataAxes: 'vertical' | 'horizontal', title: string) => {\n if (\n typeof title === 'number' ||\n typeof title === 'bigint' ||\n (typeof title === 'object' && (title as any) instanceof Date)\n ) {\n title = String(title);\n }\n if (typeof title !== 'string') {\n return;\n }\n if (describedDataAxes === 'horizontal') {\n mutableContainer.axesTitle.horizontal = title;\n } else if (describedDataAxes === 'vertical') {\n mutableContainer.axesTitle.vertical = title;\n }\n },\n setPointsDensity: (horizontalAxes: number, verticalAxes: number) => {\n mutableContainer.pointsDensity = { verticalAxes, horizontalAxes };\n },\n };\n return handler;\n};\n\nexport type DataHintsHandler = ReturnType<typeof makeDataHintsHandlers>;\n\nexport const makeDataSummarizationConfig = (\n config?: PartialDataSummarizationConfig,\n): DataSummarizationConfig => ({\n clustersGridSize: undefined,\n maxListSymbols: 100,\n datesWithTime: undefined,\n clustersLimit: 5,\n valuesLimit: 5,\n groupsLimit: 5,\n dataType: undefined,\n disable: false,\n override: undefined,\n ...(config ?? {}),\n trendTangens: {\n static: 1 / 15,\n weak: 1 / 10,\n medium: 1 / 5,\n strong: Infinity,\n ...(config?.trendTangens ?? {}),\n },\n movingAverage: {\n longSize: undefined,\n shortSize: undefined,\n notableDiff: undefined,\n ...(config?.movingAverage ?? {}),\n },\n additionalFields: [...config?.additionalFields ?? []]\n});\n"],"mappings":";;;AAqEA,OAAO,IAAMA,sBAAsB,GAAG,SAAzBA,sBAAyB;EAAA,OAA2B;IAC/DC,MAAM,EAAE;MACNC,YAAY,EAAE,IAAIC,GAAJ,EADR;MAENC,cAAc,EAAE,IAAID,GAAJ,EAFV;MAGNE,SAAS,EAAE,IAAIF,GAAJ,EAHL;MAING,MAAM,EAAE,IAAIH,GAAJ;IAJF,CADuD;IAO/DI,MAAM,EAAE,IAAIJ,GAAJ,EAPuD;IAQ/DK,SAAS,EAAE;MACTC,QAAQ,EAAE,IADD;MAETC,UAAU,EAAE;IAFH,CARoD;IAY/DC,MAAM,EAAE;MACNT,YAAY,EAAE,EADR;MAENU,oBAAoB,EAAE,IAFhB;MAGNR,cAAc,EAAE,EAHV;MAINS,sBAAsB,EAAE,IAJlB;MAKNC,UAAU,EAAE,EALN;MAMNC,iBAAiB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MAJO,aAIPA,MAJO,uBAIPA,MAAM,CAAEe,aAJD,yEAIkB,EAJlB,CApB4B;IA0BzCI,gBAAgB,8CAAMnB,MAAN,aAAMA,MAAN,uBAAMA,MAAM,CAAEmB,gBAAd,yEAAkC,EAAlC;EA1ByB;AAAA,CAApC"}
|
|
1
|
+
{"version":3,"file":"hints.js","names":["makeDataHintsContainer","fields","verticalAxes","Set","horizontalAxes","valueAxes","values","groups","axesTitle","vertical","horizontal","titles","getVerticalAxesTitle","getHorizontalAxesTitle","valuesAxes","getValueAxesTitle","grid","dataType","pointsDensity","makeDataHintsHandlers","mutableContainer","handler","specifyDataRowFields","x","y","value","add","setupGrid","direction","size","establishDataType","describeValueEntity","dataKey","readableName","labelKey","describeGroupedValues","groupKey","axes","label","addKeyLabelGetter","getter","setTitle","describedDataAxes","title","_typeof","Date","String","setPointsDensity","makeDataSummarizationConfig","config","_config$trendTangens","_config$movingAverage","_config$additionalFie","_objectSpread","clustersGridSize","undefined","maxListSymbols","datesWithTime","clustersLimit","valuesLimit","groupsLimit","disable","override","trendTangens","weak","medium","strong","Infinity","movingAverage","longSize","shortSize","notableDiff","additionalFields","_toConsumableArray"],"sources":["../../../src/a11y/hints.ts"],"sourcesContent":["import { SerializableDataType } from './insights';\n\ntype DeepPartial<T> = T extends object\n ? {\n [P in keyof T]?: DeepPartial<T[P]>;\n }\n : T;\n\nexport type DataStructureHints = {\n fields: {\n verticalAxes: Set<string | number>;\n horizontalAxes: Set<string | number>;\n valueAxes: Set<string | number>;\n values: Set<string | number>;\n };\n groups: Set<string | number>;\n axesTitle: {\n vertical: string | null;\n horizontal: string | null;\n };\n titles: {\n verticalAxes: {\n [dataKey: string | number]: string;\n };\n getVerticalAxesTitle: null | ((dataKey: string | number) => string);\n horizontalAxes: {\n [dataKey: string | number]: string;\n };\n getHorizontalAxesTitle: null | ((dataKey: string | number) => string);\n valuesAxes: {\n [dataKey: string | number]: string;\n };\n getValueAxesTitle: null | ((dataKey: string | number) => string);\n };\n grid: {\n verticalAxes: number | null;\n horizontalAxes: number | null;\n };\n pointsDensity: {\n verticalAxes: number;\n horizontalAxes: number;\n } | null;\n dataType: SerializableDataType | null;\n};\nexport type DataSummarizationConfig = {\n trendTangens: {\n static: number;\n weak: number;\n medium: number;\n strong: number;\n };\n movingAverage: {\n longSize: number | undefined;\n shortSize: number | undefined;\n notableDiff: number | undefined;\n };\n dataType: SerializableDataType | undefined;\n clustersGridSize: number | undefined;\n maxListSymbols: number;\n datesWithTime: boolean | undefined;\n clustersLimit: number;\n valuesLimit: number;\n groupsLimit: number;\n disable: boolean;\n override: string | undefined;\n additionalFields: string[];\n};\nexport type PartialDataSummarizationConfig = DeepPartial<DataSummarizationConfig>;\n\nexport const makeDataHintsContainer = (): DataStructureHints => ({\n fields: {\n verticalAxes: new Set(),\n horizontalAxes: new Set(),\n valueAxes: new Set(),\n values: new Set(),\n },\n groups: new Set(),\n axesTitle: {\n vertical: null,\n horizontal: null,\n },\n titles: {\n verticalAxes: {},\n getVerticalAxesTitle: null,\n horizontalAxes: {},\n getHorizontalAxesTitle: null,\n valuesAxes: {},\n getValueAxesTitle: null,\n },\n grid: {\n verticalAxes: null,\n horizontalAxes: null,\n },\n dataType: null,\n pointsDensity: null,\n});\n\nexport const makeDataHintsHandlers = (mutableContainer: DataStructureHints) => {\n const handler = {\n specifyDataRowFields: (x?: string, y?: string, value?: string) => {\n if (y) mutableContainer.fields.verticalAxes.add(y);\n if (x) mutableContainer.fields.horizontalAxes.add(x);\n if (value) mutableContainer.fields.valueAxes.add(value);\n },\n setupGrid: (direction: 'vertical' | 'horizontal', size: number) => {\n if (direction === 'horizontal') {\n mutableContainer.grid.horizontalAxes = size;\n } else if (direction === 'vertical') {\n mutableContainer.grid.verticalAxes = size;\n }\n },\n establishDataType: (dataType: SerializableDataType) => {\n mutableContainer.dataType = dataType;\n },\n describeValueEntity: (dataKey: string | number, readableName: string) => {\n mutableContainer.fields.values.add(dataKey);\n handler.labelKey('value', dataKey, readableName);\n },\n describeGroupedValues: (groupKey: string | number, dataKey: string | number) => {\n mutableContainer.groups.add(groupKey);\n mutableContainer.fields.values.add(dataKey);\n },\n labelKey: (\n axes: 'vertical' | 'horizontal' | 'value',\n dataKey: string | number,\n label: string,\n ) => {\n if (axes === 'vertical') mutableContainer.titles.verticalAxes[dataKey] = label;\n if (axes === 'horizontal') mutableContainer.titles.horizontalAxes[dataKey] = label;\n if (axes === 'value') mutableContainer.titles.valuesAxes[dataKey] = label;\n },\n addKeyLabelGetter: (\n axes: 'vertical' | 'horizontal' | 'value',\n getter: (dataKey: string | number) => string,\n ) => {\n if (axes === 'vertical') mutableContainer.titles.getVerticalAxesTitle = getter;\n if (axes === 'horizontal') mutableContainer.titles.getHorizontalAxesTitle = getter;\n if (axes === 'value') mutableContainer.titles.getValueAxesTitle = getter;\n },\n setTitle: (describedDataAxes: 'vertical' | 'horizontal', title: string) => {\n if (\n typeof title === 'number' ||\n typeof title === 'bigint' ||\n (typeof title === 'object' && (title as any) instanceof Date)\n ) {\n title = String(title);\n }\n if (typeof title !== 'string') {\n return;\n }\n if (describedDataAxes === 'horizontal') {\n mutableContainer.axesTitle.horizontal = title;\n } else if (describedDataAxes === 'vertical') {\n mutableContainer.axesTitle.vertical = title;\n }\n },\n setPointsDensity: (horizontalAxes: number, verticalAxes: number) => {\n mutableContainer.pointsDensity = { verticalAxes, horizontalAxes };\n },\n };\n return handler;\n};\n\nexport type DataHintsHandler = ReturnType<typeof makeDataHintsHandlers>;\n\nexport const makeDataSummarizationConfig = (\n config?: PartialDataSummarizationConfig,\n): DataSummarizationConfig => ({\n clustersGridSize: undefined,\n maxListSymbols: 100,\n datesWithTime: undefined,\n clustersLimit: 5,\n valuesLimit: 5,\n groupsLimit: 5,\n dataType: undefined,\n disable: false,\n override: undefined,\n ...(config ?? {}),\n trendTangens: {\n static: 1 / 15,\n weak: 1 / 10,\n medium: 1 / 5,\n strong: Infinity,\n ...(config?.trendTangens ?? {}),\n },\n movingAverage: {\n longSize: undefined,\n shortSize: undefined,\n notableDiff: undefined,\n ...(config?.movingAverage ?? {}),\n },\n additionalFields: [...config?.additionalFields ?? []]\n});\n"],"mappings":";;;AAqEA,OAAO,IAAMA,sBAAsB,GAAG,SAAzBA,sBAAsBA,CAAA;EAAA,OAA8B;IAC/DC,MAAM,EAAE;MACNC,YAAY,EAAE,IAAIC,GAAG,EAAE;MACvBC,cAAc,EAAE,IAAID,GAAG,EAAE;MACzBE,SAAS,EAAE,IAAIF,GAAG,EAAE;MACpBG,MAAM,EAAE,IAAIH,GAAG;IACjB,CAAC;IACDI,MAAM,EAAE,IAAIJ,GAAG,EAAE;IACjBK,SAAS,EAAE;MACTC,QAAQ,EAAE,IAAI;MACdC,UAAU,EAAE;IACd,CAAC;IACDC,MAAM,EAAE;MACNT,YAAY,EAAE,CAAC,CAAC;MAChBU,oBAAoB,EAAE,IAAI;MAC1BR,cAAc,EAAE,CAAC,CAAC;MAClBS,sBAAsB,EAAE,IAAI;MAC5BC,UAAU,EAAE,CAAC,CAAC;MACdC,iBAAiB,EAAE;IACrB,CAAC;IACDC,IAAI,EAAE;MACJd,YAAY,EAAE,IAAI;MAClBE,cAAc,EAAE;IAClB,CAAC;IACDa,QAAQ,EAAE,IAAI;IACdC,aAAa,EAAE;EACjB,CAAC;AAAA,CAAC;AAEF,OAAO,IAAMC,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAIC,gBAAoC,EAAK;EAC7E,IAAMC,OAAO,GAAG;IACdC,oBAAoB,EAAE,SAAAA,qBAACC,CAAU,EAAEC,CAAU,EAAEC,KAAc,EAAK;MAChE,IAAID,CAAC,EAAEJ,gBAAgB,CAACnB,MAAM,CAACC,YAAY,CAACwB,GAAG,CAACF,CAAC,CAAC;MAClD,IAAID,CAAC,EAAEH,gBAAgB,CAACnB,MAAM,CAACG,cAAc,CAACsB,GAAG,CAACH,CAAC,CAAC;MACpD,IAAIE,KAAK,EAAEL,gBAAgB,CAACnB,MAAM,CAACI,SAAS,CAACqB,G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AA,aAAA;IAEvCC,gBAAgB,EAAEC,SAAS;IAC3BC,cAAc,EAAE,GAAG;IACnBC,aAAa,EAAEF,SAAS;IACxBG,aAAa,EAAE,CAAC;IAChBC,WAAW,EAAE,CAAC;IACdC,WAAW,EAAE,CAAC;IACd3C,QAAQ,EAAEsC,SAAS;IACnBM,OAAO,EAAE,KAAK;IACdC,QAAQ,EAAEP;EAAS,GACfN,MAAM,aAANA,MAAM,cAANA,MAAM,GAAI,CAAC,CAAC;IAChBc,YAAY,EAAAV,aAAA;MACV,UAAQ,CAAC,GAAG,EAAE;MACdW,IAAI,EAAE,CAAC,GAAG,EAAE;MACZC,MAAM,EAAE,CAAC,GAAG,CAAC;MACbC,MAAM,EAAEC;IAAQ,IAAAjB,oBAAA,GACZD,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEc,YAAY,cAAAb,oBAAA,cAAAA,oBAAA,GAAI,CAAC,CAAC,CAC/B;IACDkB,aAAa,EAAAf,aAAA;MACXgB,QAAQ,EAAEd,SAAS;MACnBe,SAAS,EAAEf,SAAS;MACpBgB,WAAW,EAAEhB;IAAS,IAAAJ,qBAAA,GAClBF,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEmB,aAAa,cAAAjB,qBAAA,cAAAA,qBAAA,GAAI,CAAC,CAAC,CAChC;IACDqB,gBAAgB,EAAAC,kBAAA,EAAArB,qBAAA,GAAMH,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAEuB,gBAAgB,cAAApB,qBAAA,cAAAA,qBAAA,GAAI,EAAE;EAAC;AAAA,CACrD"}
|
package/lib/es6/a11y/insights.js
CHANGED
|
@@ -4,23 +4,18 @@ import _createForOfIteratorHelper from "@babel/runtime/helpers/createForOfIterat
|
|
|
4
4
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
5
5
|
import _typeof from "@babel/runtime/helpers/typeof";
|
|
6
6
|
import { makeBezier } from './bezier';
|
|
7
|
-
|
|
8
7
|
var getPropByPath = function getPropByPath(obj, path) {
|
|
9
8
|
if (typeof path === 'number') path = String(path);
|
|
10
9
|
if (typeof path === 'string') path = path.split('.');
|
|
11
|
-
|
|
12
10
|
for (var i = 0; i < path.length; i++) {
|
|
13
11
|
if (_typeof(obj) !== 'object' || obj === null) return obj;
|
|
14
12
|
obj = obj[path[i]];
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
return obj;
|
|
18
15
|
};
|
|
19
|
-
|
|
20
16
|
var movingAverage = function movingAverage(data, frame) {
|
|
21
17
|
var result = [];
|
|
22
18
|
frame = Math.floor(frame) % 2 === data.length % 2 ? Math.floor(frame) : Math.ceil(frame);
|
|
23
|
-
|
|
24
19
|
for (var i = 0; i < data.length; i++) {
|
|
25
20
|
var startIndex = Math.max(0, i - Math.floor(frame / 2));
|
|
26
21
|
var endIndex = Math.min(data.length, i + Math.ceil(frame / 2));
|
|
@@ -33,25 +28,19 @@ var movingAverage = function movingAverage(data, frame) {
|
|
|
33
28
|
var value = sum / part.length;
|
|
34
29
|
result.push(value);
|
|
35
30
|
}
|
|
36
|
-
|
|
37
31
|
return result;
|
|
38
32
|
};
|
|
39
|
-
|
|
40
33
|
export var extractDataInsights = function extractDataInsights(data, hints, config) {
|
|
41
34
|
var _config$dataType, _hints$axesTitle$vert, _ref;
|
|
42
|
-
|
|
43
35
|
var insights = [];
|
|
44
36
|
var dataType = (_config$dataType = config.dataType) !== null && _config$dataType !== void 0 ? _config$dataType : hints.dataType;
|
|
45
37
|
var dataRange = [];
|
|
46
|
-
|
|
47
38
|
var groupKeys = _toConsumableArray(hints.groups);
|
|
48
|
-
|
|
49
39
|
var dataTitle = (_hints$axesTitle$vert = hints.axesTitle.vertical) !== null && _hints$axesTitle$vert !== void 0 ? _hints$axesTitle$vert : hints.axesTitle.horizontal;
|
|
50
40
|
var entitiesCount = 0;
|
|
51
41
|
var keysMap = Object.fromEntries(Object.keys((_ref = Array.isArray(data) ? data[0] : data) !== null && _ref !== void 0 ? _ref : {}).map(function (key) {
|
|
52
42
|
return [key, true];
|
|
53
43
|
}));
|
|
54
|
-
|
|
55
44
|
if (!dataType) {
|
|
56
45
|
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) {
|
|
57
46
|
dataType = 'points-cloud';
|
|
@@ -66,7 +55,6 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
66
55
|
});
|
|
67
56
|
return new Set(allData).size === allData.length;
|
|
68
57
|
});
|
|
69
|
-
|
|
70
58
|
if (possibleGroupKeys.length === 1) {
|
|
71
59
|
groupKeys = possibleGroupKeys;
|
|
72
60
|
dataType = 'grouped-values';
|
|
@@ -77,15 +65,12 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
77
65
|
dataType = 'values-set';
|
|
78
66
|
}
|
|
79
67
|
}
|
|
80
|
-
|
|
81
68
|
if (dataType === 'grouped-values' && groupKeys.length === 0) {
|
|
82
69
|
dataType = 'values-set';
|
|
83
70
|
}
|
|
84
|
-
|
|
85
71
|
if (Array.isArray(data)) {
|
|
86
72
|
if (dataType === 'time-series') {
|
|
87
73
|
var _ref2, _hints$titles$getHori, _hints$titles$getHori2, _hints$titles, _ref3, _hints$titles$getHori3, _hints$titles$getHori4, _hints$titles2;
|
|
88
|
-
|
|
89
74
|
var firstRow = data[0];
|
|
90
75
|
var lastRow = data[data.length - 1];
|
|
91
76
|
var possibleValueKeys = ['y', 'value'].concat(_toConsumableArray(hints.fields.verticalAxes));
|
|
@@ -101,24 +86,19 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
101
86
|
var toKey = lastRow[labelsKey];
|
|
102
87
|
var from = (_ref2 = (_hints$titles$getHori = (_hints$titles$getHori2 = (_hints$titles = hints.titles).getHorizontalAxesTitle) === null || _hints$titles$getHori2 === void 0 ? void 0 : _hints$titles$getHori2.call(_hints$titles, fromKey)) !== null && _hints$titles$getHori !== void 0 ? _hints$titles$getHori : hints.titles.horizontalAxes[fromKey]) !== null && _ref2 !== void 0 ? _ref2 : fromKey;
|
|
103
88
|
var to = (_ref3 = (_hints$titles$getHori3 = (_hints$titles$getHori4 = (_hints$titles2 = hints.titles).getHorizontalAxesTitle) === null || _hints$titles$getHori4 === void 0 ? void 0 : _hints$titles$getHori4.call(_hints$titles2, toKey)) !== null && _hints$titles$getHori3 !== void 0 ? _hints$titles$getHori3 : hints.titles.horizontalAxes[toKey]) !== null && _ref3 !== void 0 ? _ref3 : toKey;
|
|
104
|
-
|
|
105
89
|
if (entitiesCount > 0) {
|
|
106
90
|
var _hints$axesTitle$vert2;
|
|
107
|
-
|
|
108
91
|
dataRange.push({
|
|
109
92
|
from: from,
|
|
110
93
|
to: to,
|
|
111
94
|
label: (_hints$axesTitle$vert2 = hints.axesTitle.vertical) !== null && _hints$axesTitle$vert2 !== void 0 ? _hints$axesTitle$vert2 : labelsKey
|
|
112
95
|
});
|
|
113
96
|
}
|
|
114
|
-
|
|
115
97
|
var _iterator = _createForOfIteratorHelper(valuesKeys),
|
|
116
|
-
|
|
117
|
-
|
|
98
|
+
_step;
|
|
118
99
|
try {
|
|
119
100
|
var _loop = function _loop() {
|
|
120
101
|
var _config$movingAverage, _config$movingAverage2, _insights;
|
|
121
|
-
|
|
122
102
|
var valueKey = _step.value;
|
|
123
103
|
var values = data.map(function (row) {
|
|
124
104
|
return row[valueKey];
|
|
@@ -140,17 +120,14 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
140
120
|
var longMovingAverage = movingAverage(values, longMovingAverageSize);
|
|
141
121
|
var shortMovingAverage = values.length < 8 ? values : movingAverage(values, shortMovingAverageSize);
|
|
142
122
|
var table = [];
|
|
143
|
-
|
|
144
123
|
for (var i in values) {
|
|
145
124
|
var _values$i, _longMovingAverage$i, _shortMovingAverage$i;
|
|
146
|
-
|
|
147
125
|
table.push({
|
|
148
126
|
value: ((_values$i = values[i]) !== null && _values$i !== void 0 ? _values$i : NaN).toFixed(2),
|
|
149
127
|
"long": ((_longMovingAverage$i = longMovingAverage[i]) !== null && _longMovingAverage$i !== void 0 ? _longMovingAverage$i : NaN).toFixed(2),
|
|
150
128
|
"short": ((_shortMovingAverage$i = shortMovingAverage[i]) !== null && _shortMovingAverage$i !== void 0 ? _shortMovingAverage$i : NaN).toFixed(2)
|
|
151
129
|
});
|
|
152
130
|
}
|
|
153
|
-
|
|
154
131
|
var strengthsMap = {
|
|
155
132
|
growth: {
|
|
156
133
|
"static": 'static',
|
|
@@ -165,21 +142,17 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
165
142
|
strong: 'strong-reduction'
|
|
166
143
|
}
|
|
167
144
|
};
|
|
168
|
-
|
|
169
145
|
var recordTrend = function recordTrend(_ref4) {
|
|
170
146
|
var value = _ref4.value,
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
147
|
+
width = _ref4.width,
|
|
148
|
+
label = _ref4.label,
|
|
149
|
+
type = _ref4.type;
|
|
175
150
|
for (var _i = 0; _i < trendStrengths.length; _i++) {
|
|
176
151
|
var _hints$pointsDensity$, _hints$pointsDensity, _hints$pointsDensity$2, _hints$pointsDensity2;
|
|
177
|
-
|
|
178
152
|
var normalizedHeight = Math.abs(value.from - value.to) / ((_hints$pointsDensity$ = (_hints$pointsDensity = hints.pointsDensity) === null || _hints$pointsDensity === void 0 ? void 0 : _hints$pointsDensity.verticalAxes) !== null && _hints$pointsDensity$ !== void 0 ? _hints$pointsDensity$ : 1);
|
|
179
153
|
var normalizedWidth = width / ((_hints$pointsDensity$2 = (_hints$pointsDensity2 = hints.pointsDensity) === null || _hints$pointsDensity2 === void 0 ? void 0 : _hints$pointsDensity2.horizontalAxes) !== null && _hints$pointsDensity$2 !== void 0 ? _hints$pointsDensity$2 : 1);
|
|
180
154
|
var tang = normalizedHeight / normalizedWidth;
|
|
181
155
|
var trendStrength = trendStrengths[_i];
|
|
182
|
-
|
|
183
156
|
if (tang <= config.trendTangens[trendStrength] || _i === trendStrengths.length - 1) {
|
|
184
157
|
var strength = value.to > value.from ? strengthsMap.growth[trendStrength] : strengthsMap.reduction[trendStrength];
|
|
185
158
|
return {
|
|
@@ -197,7 +170,6 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
197
170
|
}
|
|
198
171
|
}
|
|
199
172
|
};
|
|
200
|
-
|
|
201
173
|
var generalTrend = recordTrend({
|
|
202
174
|
type: 'general-trend',
|
|
203
175
|
value: {
|
|
@@ -214,15 +186,12 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
214
186
|
var localTrends = [];
|
|
215
187
|
{
|
|
216
188
|
var _config$movingAverage3;
|
|
217
|
-
|
|
218
189
|
var notableDiff = (_config$movingAverage3 = config.movingAverage.notableDiff) !== null && _config$movingAverage3 !== void 0 ? _config$movingAverage3 : standardDeviation / 10;
|
|
219
190
|
var lastSwitch = 0;
|
|
220
191
|
var lastSwitchValue = shortMovingAverage[lastSwitch];
|
|
221
192
|
var shortWasAbove = shortMovingAverage[0] > longMovingAverage[0];
|
|
222
|
-
|
|
223
193
|
for (var _i2 = 1; _i2 < data.length; _i2++) {
|
|
224
194
|
var _ref5, _hints$titles$getHori5, _hints$titles$getHori6, _hints$titles3, _ref6, _hints$titles$getHori7, _hints$titles$getHori8, _hints$titles4;
|
|
225
|
-
|
|
226
195
|
var shortIsAbove = shortMovingAverage[_i2] > longMovingAverage[_i2];
|
|
227
196
|
var diff = Math.abs(shortMovingAverage[_i2] - longMovingAverage[_i2]);
|
|
228
197
|
if (shortIsAbove === shortWasAbove) continue;
|
|
@@ -232,11 +201,8 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
232
201
|
_i2 = Math.min(_i2, data.length - 1);
|
|
233
202
|
var _fromKey = data[lastSwitch][labelsKey];
|
|
234
203
|
var _toKey = data[_i2][labelsKey];
|
|
235
|
-
|
|
236
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;
|
|
237
|
-
|
|
238
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;
|
|
239
|
-
|
|
240
206
|
localTrends.push(recordTrend({
|
|
241
207
|
type: 'trend',
|
|
242
208
|
value: {
|
|
@@ -254,11 +220,9 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
254
220
|
lastSwitchValue = shortMovingAverage[lastSwitch];
|
|
255
221
|
shortWasAbove = shortIsAbove;
|
|
256
222
|
}
|
|
257
|
-
|
|
258
223
|
if (lastSwitch !== 0) {
|
|
259
224
|
var lastIndex = shortMovingAverage.length - 1;
|
|
260
225
|
var lastValue = shortMovingAverage[lastIndex];
|
|
261
|
-
|
|
262
226
|
if (Math.abs(lastSwitchValue - lastValue) > notableDiff) {
|
|
263
227
|
localTrends.push(recordTrend({
|
|
264
228
|
type: 'trend',
|
|
@@ -277,10 +241,8 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
277
241
|
}
|
|
278
242
|
}
|
|
279
243
|
insights.push(generalTrend);
|
|
280
|
-
|
|
281
244
|
(_insights = insights).push.apply(_insights, localTrends);
|
|
282
245
|
};
|
|
283
|
-
|
|
284
246
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
285
247
|
_loop();
|
|
286
248
|
}
|
|
@@ -291,7 +253,6 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
291
253
|
}
|
|
292
254
|
} else if (dataType === 'points-cloud') {
|
|
293
255
|
var _ref7, _config$clustersGridS, _relativeSizeDistrivu, _insights2;
|
|
294
|
-
|
|
295
256
|
var guessedXKey = [].concat(_toConsumableArray(hints.fields.horizontalAxes.values()), ['x'])[0];
|
|
296
257
|
var guessedYKey = [].concat(_toConsumableArray(hints.fields.verticalAxes.values()), ['y'])[0];
|
|
297
258
|
var guessedValueKey = [].concat(_toConsumableArray(hints.fields.valueAxes.values()), ['value'])[0];
|
|
@@ -305,19 +266,16 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
305
266
|
};
|
|
306
267
|
});
|
|
307
268
|
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;
|
|
308
|
-
|
|
309
269
|
if (!gridSize) {
|
|
310
270
|
var usedX = new Set();
|
|
311
271
|
var usedY = new Set();
|
|
312
|
-
|
|
313
272
|
var _iterator2 = _createForOfIteratorHelper(normalized),
|
|
314
|
-
|
|
315
|
-
|
|
273
|
+
_step2;
|
|
316
274
|
try {
|
|
317
275
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
318
276
|
var _step2$value = _step2.value,
|
|
319
|
-
|
|
320
|
-
|
|
277
|
+
_x = _step2$value.x,
|
|
278
|
+
_y = _step2$value.y;
|
|
321
279
|
usedX.add(_x);
|
|
322
280
|
usedY.add(_y);
|
|
323
281
|
}
|
|
@@ -326,15 +284,12 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
326
284
|
} finally {
|
|
327
285
|
_iterator2.f();
|
|
328
286
|
}
|
|
329
|
-
|
|
330
287
|
var orderedX = _toConsumableArray(usedX).sort(function (a, b) {
|
|
331
288
|
return a - b;
|
|
332
289
|
});
|
|
333
|
-
|
|
334
290
|
var orderedY = _toConsumableArray(usedY).sort(function (a, b) {
|
|
335
291
|
return a - b;
|
|
336
292
|
});
|
|
337
|
-
|
|
338
293
|
var distancesX = orderedX.slice(0, -1).map(function (x, index) {
|
|
339
294
|
return orderedX[index + 1] - x;
|
|
340
295
|
});
|
|
@@ -360,7 +315,6 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
360
315
|
return sum + y;
|
|
361
316
|
}, 0) / belowAvgDistancesY.length;
|
|
362
317
|
var avgDistance = 0;
|
|
363
|
-
|
|
364
318
|
if (!Number.isNaN(betweenDistanceX) && !Number.isNaN(betweenDistanceY)) {
|
|
365
319
|
avgDistance = (betweenDistanceX + betweenDistanceY) / 2;
|
|
366
320
|
} else if (!Number.isNaN(betweenDistanceX)) {
|
|
@@ -370,20 +324,16 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
370
324
|
} else {
|
|
371
325
|
avgDistance = (avgDistanceX + avgDistanceY) / 2;
|
|
372
326
|
}
|
|
373
|
-
|
|
374
327
|
gridSize = Math.sqrt(Math.sqrt(avgDistance));
|
|
375
328
|
}
|
|
376
|
-
|
|
377
329
|
var grid = {};
|
|
378
330
|
var takenY = new Set();
|
|
379
331
|
var takenX = new Set();
|
|
380
|
-
|
|
381
332
|
for (var i = 0; i < normalized.length; i++) {
|
|
382
333
|
var _grid$gridX, _grid$gridX$gridY;
|
|
383
|
-
|
|
384
334
|
var _normalized$i = normalized[i],
|
|
385
|
-
|
|
386
|
-
|
|
335
|
+
_x2 = _normalized$i.x,
|
|
336
|
+
_y2 = _normalized$i.y;
|
|
387
337
|
var gridX = Math.round(_x2 / gridSize);
|
|
388
338
|
var gridY = Math.round(_y2 / gridSize);
|
|
389
339
|
takenY.add(_y2);
|
|
@@ -395,36 +345,27 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
395
345
|
};
|
|
396
346
|
grid[gridX][gridY].members.push(normalized[i]);
|
|
397
347
|
}
|
|
398
|
-
|
|
399
348
|
var clusters = {};
|
|
400
|
-
|
|
401
349
|
var _iterator3 = _createForOfIteratorHelper(Object.keys(grid).map(function (x) {
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
350
|
+
return parseInt(x, 10);
|
|
351
|
+
})),
|
|
352
|
+
_step3;
|
|
406
353
|
try {
|
|
407
354
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
408
355
|
var _x4 = _step3.value;
|
|
409
|
-
|
|
410
356
|
var _iterator4 = _createForOfIteratorHelper(Object.keys(grid[_x4]).map(function (y) {
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
357
|
+
return parseInt(y, 10);
|
|
358
|
+
})),
|
|
359
|
+
_step4;
|
|
415
360
|
try {
|
|
416
361
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
417
362
|
var _clusters$grid$_x4$_y, _clusters$grid$_x4$_y2;
|
|
418
|
-
|
|
419
363
|
var _y4 = _step4.value;
|
|
420
364
|
var pointHandled = false;
|
|
421
|
-
|
|
422
365
|
for (var _i4 = 0, _arr = [_x4 - 1, _x4, _x4 + 1]; _i4 < _arr.length; _i4++) {
|
|
423
366
|
var xNeighbour = _arr[_i4];
|
|
424
|
-
|
|
425
367
|
for (var _i5 = 0, _arr2 = [_y4 - 1, _y4, _y4 + 1]; _i5 < _arr2.length; _i5++) {
|
|
426
368
|
var _grid$xNeighbour;
|
|
427
|
-
|
|
428
369
|
var yNeighbour = _arr2[_i5];
|
|
429
370
|
if (xNeighbour === undefined || yNeighbour === undefined) continue;
|
|
430
371
|
if (xNeighbour === _x4 && yNeighbour === _y4) continue;
|
|
@@ -433,12 +374,9 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
433
374
|
grid[_x4][_y4].clusterId = grid[xNeighbour][yNeighbour].clusterId;
|
|
434
375
|
break;
|
|
435
376
|
}
|
|
436
|
-
|
|
437
377
|
if (pointHandled) break;
|
|
438
378
|
}
|
|
439
|
-
|
|
440
379
|
clusters[grid[_x4][_y4].clusterId] = (_clusters$grid$_x4$_y = clusters[grid[_x4][_y4].clusterId]) !== null && _clusters$grid$_x4$_y !== void 0 ? _clusters$grid$_x4$_y : [];
|
|
441
|
-
|
|
442
380
|
(_clusters$grid$_x4$_y2 = clusters[grid[_x4][_y4].clusterId]).push.apply(_clusters$grid$_x4$_y2, _toConsumableArray(grid[_x4][_y4].members));
|
|
443
381
|
}
|
|
444
382
|
} catch (err) {
|
|
@@ -452,17 +390,13 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
452
390
|
} finally {
|
|
453
391
|
_iterator3.f();
|
|
454
392
|
}
|
|
455
|
-
|
|
456
393
|
var clustersInsights = [];
|
|
457
|
-
|
|
458
394
|
for (var _clusterId in clusters) {
|
|
459
395
|
var _hints$axesTitle$hori, _hints$axesTitle$vert3;
|
|
460
|
-
|
|
461
396
|
var size = clusters[_clusterId].reduce(function (sum, _ref8) {
|
|
462
397
|
var value = _ref8.value;
|
|
463
398
|
return sum + (value !== null && value !== void 0 ? value : 1);
|
|
464
399
|
}, 0);
|
|
465
|
-
|
|
466
400
|
var labels = _toConsumableArray(clusters[_clusterId]).sort(function (a, b) {
|
|
467
401
|
return b.value - a.value;
|
|
468
402
|
}).map(function (_ref9) {
|
|
@@ -471,19 +405,15 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
471
405
|
}).filter(function (label) {
|
|
472
406
|
return label !== undefined;
|
|
473
407
|
});
|
|
474
|
-
|
|
475
408
|
var uniqueLabels = _toConsumableArray(new Set(labels));
|
|
476
|
-
|
|
477
409
|
var _x3 = clusters[_clusterId].reduce(function (sum, _ref10) {
|
|
478
410
|
var x = _ref10.x;
|
|
479
411
|
return sum + x;
|
|
480
412
|
}, 0) / clusters[_clusterId].length;
|
|
481
|
-
|
|
482
413
|
var _y3 = clusters[_clusterId].reduce(function (sum, _ref11) {
|
|
483
414
|
var y = _ref11.y;
|
|
484
415
|
return sum + y;
|
|
485
416
|
}, 0) / clusters[_clusterId].length;
|
|
486
|
-
|
|
487
417
|
clustersInsights.push({
|
|
488
418
|
type: 'cluster',
|
|
489
419
|
priority: 1,
|
|
@@ -498,7 +428,6 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
498
428
|
}
|
|
499
429
|
});
|
|
500
430
|
}
|
|
501
|
-
|
|
502
431
|
entitiesCount = Object.keys(clusters).length;
|
|
503
432
|
clustersInsights.sort(function (a, b) {
|
|
504
433
|
return b.size - a.size;
|
|
@@ -568,43 +497,35 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
568
497
|
width: 1,
|
|
569
498
|
height: 1
|
|
570
499
|
});
|
|
571
|
-
|
|
572
500
|
for (var _i3 = 0, _clustersInsights = clustersInsights; _i3 < _clustersInsights.length; _i3++) {
|
|
573
501
|
var clustersInsight = _clustersInsights[_i3];
|
|
574
502
|
var _size = clustersInsight.size;
|
|
575
503
|
var mappedSize = sizeMapBezier(_size / normalizingSize);
|
|
576
|
-
|
|
577
504
|
for (var relativeSize in relativeSizeDistrivution) {
|
|
578
505
|
var _relativeSizeDistrivu2 = relativeSizeDistrivution[relativeSize],
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
506
|
+
min = _relativeSizeDistrivu2.min,
|
|
507
|
+
max = _relativeSizeDistrivu2.max;
|
|
582
508
|
if (mappedSize > min && mappedSize <= max) {
|
|
583
509
|
clustersInsight.relativeSize = relativeSize;
|
|
584
510
|
break;
|
|
585
511
|
}
|
|
586
512
|
}
|
|
587
513
|
}
|
|
588
|
-
|
|
589
514
|
(_insights2 = insights).push.apply(_insights2, clustersInsights);
|
|
590
|
-
|
|
591
515
|
if (hints.axesTitle.horizontal) {
|
|
592
516
|
var sortedX = _toConsumableArray(takenX).sort(function (a, b) {
|
|
593
517
|
return a - b;
|
|
594
518
|
});
|
|
595
|
-
|
|
596
519
|
dataRange.push({
|
|
597
520
|
from: sortedX[0],
|
|
598
521
|
to: sortedX[sortedX.length - 1],
|
|
599
522
|
label: hints.axesTitle.horizontal
|
|
600
523
|
});
|
|
601
524
|
}
|
|
602
|
-
|
|
603
525
|
if (hints.axesTitle.vertical) {
|
|
604
526
|
var sortedY = _toConsumableArray(takenY).sort(function (a, b) {
|
|
605
527
|
return a - b;
|
|
606
528
|
});
|
|
607
|
-
|
|
608
529
|
dataRange.push({
|
|
609
530
|
from: sortedY[0],
|
|
610
531
|
to: sortedY[sortedY.length - 1],
|
|
@@ -613,19 +534,15 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
613
534
|
}
|
|
614
535
|
} else if (dataType === 'grouped-values') {
|
|
615
536
|
var _insights3;
|
|
616
|
-
|
|
617
537
|
var makeRowKey = function makeRowKey(row) {
|
|
618
538
|
return groupKeys.map(function (key, index) {
|
|
619
539
|
return "".concat(index, "-").concat(getPropByPath(row, key));
|
|
620
540
|
}).join('-');
|
|
621
541
|
};
|
|
622
|
-
|
|
623
542
|
var allRowsIds = data.map(makeRowKey);
|
|
624
543
|
var groupedValues = {};
|
|
625
|
-
|
|
626
544
|
for (var _i6 = 0; _i6 < data.length; _i6++) {
|
|
627
545
|
var _groupedValues$key;
|
|
628
|
-
|
|
629
546
|
var row = data[_i6];
|
|
630
547
|
var key = allRowsIds[_i6];
|
|
631
548
|
groupedValues[key] = (_groupedValues$key = groupedValues[key]) !== null && _groupedValues$key !== void 0 ? _groupedValues$key : {
|
|
@@ -634,45 +551,33 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
634
551
|
};
|
|
635
552
|
groupedValues[key].rows.push(row);
|
|
636
553
|
}
|
|
637
|
-
|
|
638
554
|
var fields = _toConsumableArray(hints.fields.values);
|
|
639
|
-
|
|
640
555
|
var grouppingKeys = Object.fromEntries(groupKeys.map(function (key) {
|
|
641
556
|
return [key, true];
|
|
642
557
|
}));
|
|
643
|
-
|
|
644
558
|
if (fields.length === 0) {
|
|
645
559
|
var _fields;
|
|
646
|
-
|
|
647
560
|
(_fields = fields).push.apply(_fields, _toConsumableArray(Object.keys(keysMap)));
|
|
648
561
|
}
|
|
649
|
-
|
|
650
562
|
fields = fields.filter(function (key) {
|
|
651
563
|
return !grouppingKeys[key];
|
|
652
564
|
});
|
|
653
565
|
var groups = Object.entries(groupedValues).map(function (_ref12) {
|
|
654
566
|
var _group$groupName;
|
|
655
|
-
|
|
656
567
|
var _ref13 = _slicedToArray(_ref12, 2),
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
568
|
+
groupKey = _ref13[0],
|
|
569
|
+
group = _ref13[1];
|
|
660
570
|
var values = [];
|
|
661
|
-
|
|
662
571
|
var _iterator5 = _createForOfIteratorHelper(group.rows),
|
|
663
|
-
|
|
664
|
-
|
|
572
|
+
_step5;
|
|
665
573
|
try {
|
|
666
574
|
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
667
575
|
var _row = _step5.value;
|
|
668
|
-
|
|
669
576
|
var _iterator6 = _createForOfIteratorHelper(fields),
|
|
670
|
-
|
|
671
|
-
|
|
577
|
+
_step6;
|
|
672
578
|
try {
|
|
673
579
|
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
674
580
|
var _ref15, _hints$titles$getVert, _hints$titles$getVert2, _hints$titles5;
|
|
675
|
-
|
|
676
581
|
var field = _step6.value;
|
|
677
582
|
values.push({
|
|
678
583
|
label: (_ref15 = (_hints$titles$getVert = (_hints$titles$getVert2 = (_hints$titles5 = hints.titles).getVerticalAxesTitle) === null || _hints$titles$getVert2 === void 0 ? void 0 : _hints$titles$getVert2.call(_hints$titles5, field)) !== null && _hints$titles$getVert !== void 0 ? _hints$titles$getVert : hints.titles.valuesAxes[field]) !== null && _ref15 !== void 0 ? _ref15 : field,
|
|
@@ -690,7 +595,6 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
690
595
|
} finally {
|
|
691
596
|
_iterator5.f();
|
|
692
597
|
}
|
|
693
|
-
|
|
694
598
|
values.sort(function (a, b) {
|
|
695
599
|
if (typeof a.value !== 'number' || typeof b.value !== 'number') return 0;
|
|
696
600
|
return b.value - a.value;
|
|
@@ -710,7 +614,6 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
710
614
|
return b.averageValue - a.averageValue;
|
|
711
615
|
});
|
|
712
616
|
entitiesCount = groups.length;
|
|
713
|
-
|
|
714
617
|
(_insights3 = insights).push.apply(_insights3, _toConsumableArray(groups.map(function (group) {
|
|
715
618
|
return {
|
|
716
619
|
type: 'comparison',
|
|
@@ -721,23 +624,18 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
721
624
|
})));
|
|
722
625
|
}
|
|
723
626
|
}
|
|
724
|
-
|
|
725
627
|
if (dataType === 'values-set') {
|
|
726
628
|
var _fields2 = _toConsumableArray(hints.fields.values);
|
|
727
|
-
|
|
728
629
|
if (_fields2.length === 0) {
|
|
729
630
|
_fields2.push.apply(_fields2, _toConsumableArray(Object.keys(keysMap)));
|
|
730
631
|
}
|
|
731
|
-
|
|
732
632
|
var values = _fields2.map(function (field) {
|
|
733
633
|
var _ref16, _hints$titles$getValu, _hints$titles$getValu2, _hints$titles6;
|
|
734
|
-
|
|
735
634
|
return {
|
|
736
635
|
label: (_ref16 = (_hints$titles$getValu = (_hints$titles$getValu2 = (_hints$titles6 = hints.titles).getValueAxesTitle) === null || _hints$titles$getValu2 === void 0 ? void 0 : _hints$titles$getValu2.call(_hints$titles6, field)) !== null && _hints$titles$getValu !== void 0 ? _hints$titles$getValu : hints.titles.valuesAxes[field]) !== null && _ref16 !== void 0 ? _ref16 : field,
|
|
737
636
|
value: getPropByPath(data, field)
|
|
738
637
|
};
|
|
739
638
|
});
|
|
740
|
-
|
|
741
639
|
entitiesCount = values.length;
|
|
742
640
|
values.sort(function (a, b) {
|
|
743
641
|
if (typeof a.value !== 'number' || typeof b.value !== 'number') return 0;
|
|
@@ -749,13 +647,10 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
749
647
|
priority: 1
|
|
750
648
|
});
|
|
751
649
|
}
|
|
752
|
-
|
|
753
650
|
if (dataType === 'indexed-groups') {
|
|
754
651
|
var _insights4;
|
|
755
|
-
|
|
756
652
|
var _groups = _toConsumableArray(hints.groups).map(function (groupKey) {
|
|
757
653
|
var _getPropByPath;
|
|
758
|
-
|
|
759
654
|
var values = _toConsumableArray(hints.fields.values).filter(function (fieldPath) {
|
|
760
655
|
return String(fieldPath).startsWith("".concat(groupKey, "."));
|
|
761
656
|
}).map(function (fieldPath) {
|
|
@@ -764,7 +659,6 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
764
659
|
value: getPropByPath(data, String(fieldPath))
|
|
765
660
|
};
|
|
766
661
|
});
|
|
767
|
-
|
|
768
662
|
values.sort(function (a, b) {
|
|
769
663
|
if (typeof a.value !== 'number' || typeof b.value !== 'number') return 0;
|
|
770
664
|
return b.value - a.value;
|
|
@@ -779,14 +673,11 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
779
673
|
averageValue: !Number.isNaN(averageValue) ? averageValue : undefined
|
|
780
674
|
};
|
|
781
675
|
});
|
|
782
|
-
|
|
783
676
|
_groups.sort(function (a, b) {
|
|
784
677
|
if (typeof a.averageValue !== 'number' || typeof b.averageValue !== 'number') return 0;
|
|
785
678
|
return b.averageValue - a.averageValue;
|
|
786
679
|
});
|
|
787
|
-
|
|
788
680
|
entitiesCount = _groups.length;
|
|
789
|
-
|
|
790
681
|
(_insights4 = insights).push.apply(_insights4, _toConsumableArray(_groups.map(function (group) {
|
|
791
682
|
return {
|
|
792
683
|
type: 'comparison',
|
|
@@ -796,11 +687,9 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
796
687
|
};
|
|
797
688
|
})));
|
|
798
689
|
}
|
|
799
|
-
|
|
800
690
|
var hasHighPriorityInsights = insights.some(function (insight) {
|
|
801
691
|
return insight.priority > 0;
|
|
802
692
|
});
|
|
803
|
-
|
|
804
693
|
if (hasHighPriorityInsights) {
|
|
805
694
|
insights = insights.filter(function (insight) {
|
|
806
695
|
return insight.priority > 0;
|
|
@@ -808,7 +697,6 @@ export var extractDataInsights = function extractDataInsights(data, hints, confi
|
|
|
808
697
|
} else {
|
|
809
698
|
insights = insights.slice(0, 1);
|
|
810
699
|
}
|
|
811
|
-
|
|
812
700
|
return {
|
|
813
701
|
insights: insights,
|
|
814
702
|
dataType: dataType,
|