@undp/data-viz 2.0.7 → 2.0.9
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/dist/ChoroplethMap.cjs +1 -1
- package/dist/ChoroplethMap.js +1 -1
- package/dist/DataCards.cjs +1 -1
- package/dist/DataCards.js +1 -1
- package/dist/GriddedGraphs.cjs +1 -1
- package/dist/GriddedGraphs.cjs.map +1 -1
- package/dist/GriddedGraphs.d.ts +1 -0
- package/dist/GriddedGraphs.js +152 -140
- package/dist/GriddedGraphs.js.map +1 -1
- package/dist/GriddedGraphsFromConfig.d.ts +1 -0
- package/dist/HybridMap.cjs +1 -1
- package/dist/HybridMap.js +1 -1
- package/dist/MultiGraphDashboard.cjs +1 -1
- package/dist/MultiGraphDashboard.cjs.map +1 -1
- package/dist/MultiGraphDashboard.d.ts +1 -0
- package/dist/MultiGraphDashboard.js +88 -83
- package/dist/MultiGraphDashboard.js.map +1 -1
- package/dist/MultiGraphDashboardFromConfig.d.ts +1 -0
- package/dist/PerformanceIntensiveMultiGraphDashboard.cjs +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboard.cjs.map +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboard.d.ts +1 -0
- package/dist/PerformanceIntensiveMultiGraphDashboard.js +74 -70
- package/dist/PerformanceIntensiveMultiGraphDashboard.js.map +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.d.ts +1 -0
- package/dist/SingleGraphDashboard.cjs +1 -1
- package/dist/SingleGraphDashboard.cjs.map +1 -1
- package/dist/SingleGraphDashboard.d.ts +1 -0
- package/dist/SingleGraphDashboard.js +122 -119
- package/dist/SingleGraphDashboard.js.map +1 -1
- package/dist/SingleGraphDashboardFromConfig.d.ts +1 -0
- package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
- package/dist/SingleGraphDashboardThreeDGraphs.cjs.map +1 -1
- package/dist/SingleGraphDashboardThreeDGraphs.d.ts +1 -0
- package/dist/SingleGraphDashboardThreeDGraphs.js +126 -122
- package/dist/SingleGraphDashboardThreeDGraphs.js.map +1 -1
- package/dist/SingleGraphDashboardThreeDGraphsFromConfig.d.ts +1 -0
- package/dist/ThreeDGlobe.cjs +1 -1
- package/dist/ThreeDGlobe.js +1 -1
- package/dist/Types.d.ts +1 -0
- package/dist/{getGraphList-gf02xgT2.cjs → getGraphList-CA17dvFB.cjs} +2 -2
- package/dist/getGraphList-CA17dvFB.cjs.map +1 -0
- package/dist/{getGraphList-BpEWn1Tk.js → getGraphList-Dxwo9TDb.js} +7 -1
- package/dist/{getGraphList-BpEWn1Tk.js.map → getGraphList-Dxwo9TDb.js.map} +1 -1
- package/dist/getSchema.cjs +1 -1
- package/dist/getSchema.js +1 -1
- package/dist/getUniqValue-DsqSii6M.js +11 -0
- package/dist/getUniqValue-DsqSii6M.js.map +1 -0
- package/dist/getUniqValue-NX8DgwND.cjs +2 -0
- package/dist/getUniqValue-NX8DgwND.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -4
- package/dist/transformData.cjs +1 -1
- package/dist/transformData.js +2 -2
- package/dist/{transformDataForAggregation-CjwEAUOR.js → transformDataForAggregation-DEU__LUl.js} +2 -2
- package/dist/{transformDataForAggregation-CjwEAUOR.js.map → transformDataForAggregation-DEU__LUl.js.map} +1 -1
- package/dist/{transformDataForAggregation-DAGK2BZy.cjs → transformDataForAggregation-XNg0OGYE.cjs} +2 -2
- package/dist/{transformDataForAggregation-DAGK2BZy.cjs.map → transformDataForAggregation-XNg0OGYE.cjs.map} +1 -1
- package/dist/{transformDataForGraphFromFile-D5TMQYYd.js → transformDataForGraphFromFile-CSG24iF6.js} +2 -2
- package/dist/{transformDataForGraphFromFile-D5TMQYYd.js.map → transformDataForGraphFromFile-CSG24iF6.js.map} +1 -1
- package/dist/{transformDataForGraphFromFile-B1zJSPRP.cjs → transformDataForGraphFromFile-CzepNVGZ.cjs} +2 -2
- package/dist/{transformDataForGraphFromFile-B1zJSPRP.cjs.map → transformDataForGraphFromFile-CzepNVGZ.cjs.map} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +2 -2
- package/dist/validateSchema.cjs +1 -1
- package/dist/validateSchema.js +1 -1
- package/package.json +1 -1
- package/dist/getGraphList-gf02xgT2.cjs.map +0 -1
- package/dist/getUniqValue-BKHCm3zE.js +0 -11
- package/dist/getUniqValue-BKHCm3zE.js.map +0 -1
- package/dist/getUniqValue-RViz8tTw.cjs +0 -2
- package/dist/getUniqValue-RViz8tTw.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformDataForAggregation-DAGK2BZy.cjs","sources":["../src/Utils/transformData/graphConfig.ts","../src/Utils/checkDataValidity.ts","../src/Utils/transformData/transformDataForGraph.ts","../src/Utils/transformData/transformDataForAggregation.ts"],"sourcesContent":["import { GraphType, ThreeDGraphType } from '@/Types';\r\n\r\nexport const ChartConfiguration: {\r\n chartID: GraphType | ThreeDGraphType;\r\n configuration: { id: string; required: boolean; multiple: boolean }[];\r\n}[] = [\r\n {\r\n chartID: 'barChart',\r\n configuration: [\r\n {\r\n id: 'label',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'size',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'color',\r\n required: false,\r\n multiple: false,\r\n },\r\n {\r\n id: 'date',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'bulletChart',\r\n configuration: [\r\n {\r\n id: 'label',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'size',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'target',\r\n required: false,\r\n multiple: false,\r\n },\r\n {\r\n id: 'qualitativeRange',\r\n required: false,\r\n multiple: true,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'radarChart',\r\n configuration: [\r\n {\r\n id: 'label',\r\n required: false,\r\n multiple: false,\r\n },\r\n {\r\n id: 'values',\r\n required: true,\r\n multiple: true,\r\n },\r\n {\r\n id: 'color',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'stackedBarChart',\r\n configuration: [\r\n {\r\n id: 'label',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'size',\r\n multiple: true,\r\n required: true,\r\n },\r\n {\r\n id: 'date',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'groupedBarChart',\r\n configuration: [\r\n {\r\n id: 'label',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'size',\r\n multiple: true,\r\n required: true,\r\n },\r\n {\r\n id: 'date',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'lineChart',\r\n configuration: [\r\n {\r\n id: 'date',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'y',\r\n required: true,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'dualAxisLineChart',\r\n configuration: [\r\n {\r\n id: 'date',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'y1',\r\n multiple: false,\r\n required: true,\r\n },\r\n {\r\n id: 'y2',\r\n multiple: false,\r\n required: true,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'differenceLineChart',\r\n configuration: [\r\n {\r\n id: 'date',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'y1',\r\n multiple: false,\r\n required: true,\r\n },\r\n {\r\n id: 'y2',\r\n multiple: false,\r\n required: true,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'multiLineChart',\r\n configuration: [\r\n {\r\n id: 'date',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'y',\r\n multiple: true,\r\n required: true,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'multiLineAltChart',\r\n configuration: [\r\n {\r\n id: 'date',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'y',\r\n multiple: false,\r\n required: true,\r\n },\r\n {\r\n id: 'label',\r\n multiple: false,\r\n required: true,\r\n },\r\n {\r\n id: 'color',\r\n multiple: false,\r\n required: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'stackedAreaChart',\r\n configuration: [\r\n {\r\n id: 'date',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'y',\r\n multiple: true,\r\n required: true,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'threeDGlobe',\r\n configuration: [\r\n {\r\n id: 'id',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'x',\r\n required: true,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'choroplethMap',\r\n configuration: [\r\n {\r\n id: 'id',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'x',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'date',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'biVariateChoroplethMap',\r\n configuration: [\r\n {\r\n id: 'id',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'x',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'y',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'date',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'dotDensityMap',\r\n configuration: [\r\n {\r\n id: 'lat',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'long',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'label',\r\n multiple: false,\r\n required: false,\r\n },\r\n {\r\n id: 'color',\r\n multiple: false,\r\n required: false,\r\n },\r\n {\r\n id: 'radius',\r\n required: false,\r\n multiple: false,\r\n },\r\n {\r\n id: 'date',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'hybridMap',\r\n configuration: [\r\n {\r\n id: 'id',\r\n required: false,\r\n multiple: false,\r\n },\r\n {\r\n id: 'x',\r\n required: false,\r\n multiple: false,\r\n },\r\n {\r\n id: 'lat',\r\n required: false,\r\n multiple: false,\r\n },\r\n {\r\n id: 'long',\r\n required: false,\r\n multiple: false,\r\n },\r\n {\r\n id: 'label',\r\n multiple: false,\r\n required: false,\r\n },\r\n {\r\n id: 'radius',\r\n required: false,\r\n multiple: false,\r\n },\r\n {\r\n id: 'date',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'donutChart',\r\n configuration: [\r\n {\r\n id: 'label',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'size',\r\n required: true,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'slopeChart',\r\n configuration: [\r\n {\r\n id: 'label',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'y1',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'y2',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'color',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'scatterPlot',\r\n configuration: [\r\n {\r\n id: 'x',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'y',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'radius',\r\n required: false,\r\n multiple: false,\r\n },\r\n {\r\n id: 'color',\r\n required: false,\r\n multiple: false,\r\n },\r\n {\r\n id: 'label',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'date',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'dumbbellChart',\r\n configuration: [\r\n {\r\n id: 'label',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'x',\r\n multiple: true,\r\n required: true,\r\n },\r\n {\r\n id: 'date',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'treeMap',\r\n configuration: [\r\n {\r\n id: 'label',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'size',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'color',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'circlePacking',\r\n configuration: [\r\n {\r\n id: 'label',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'size',\r\n required: false,\r\n multiple: false,\r\n },\r\n {\r\n id: 'color',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'sankeyChart',\r\n configuration: [\r\n {\r\n id: 'source',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'target',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'value',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'heatMap',\r\n configuration: [\r\n {\r\n id: 'row',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'column',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'value',\r\n required: true,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'stripChart',\r\n configuration: [\r\n {\r\n id: 'label',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'position',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'color',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'statCard',\r\n configuration: [\r\n {\r\n id: 'value',\r\n required: true,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'beeSwarmChart',\r\n configuration: [\r\n {\r\n id: 'label',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'position',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'radius',\r\n required: false,\r\n multiple: false,\r\n },\r\n {\r\n id: 'color',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'butterflyChart',\r\n configuration: [\r\n {\r\n id: 'label',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'leftBar',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'rightBar',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'date',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'lineChartWithConfidenceInterval',\r\n configuration: [\r\n {\r\n id: 'date',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'y',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'yMin',\r\n required: false,\r\n multiple: false,\r\n },\r\n {\r\n id: 'yMax',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'histogram',\r\n configuration: [\r\n {\r\n id: 'value',\r\n required: true,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'sparkLine',\r\n configuration: [\r\n {\r\n id: 'dale',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'y',\r\n required: true,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'paretoChart',\r\n configuration: [\r\n {\r\n id: 'label',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'bar',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'line',\r\n required: true,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'unitChart',\r\n configuration: [\r\n {\r\n id: 'label',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'value',\r\n required: true,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n];\r\n","import flattenDeep from 'lodash.flattendeep';\r\n\r\nimport { ChartConfiguration } from './transformData/graphConfig';\r\n\r\nimport { GraphConfigurationDataType, GraphType, ThreeDGraphType } from '@/Types';\r\n\r\nfunction missingValuesInArray(superset: string[], subset: string[]): string[] {\r\n return subset.filter(value => !superset.includes(value));\r\n}\r\n\r\nexport function checkDataConfigValidity(\r\n dataConfig: GraphConfigurationDataType[],\r\n graph: GraphType | ThreeDGraphType,\r\n dataKeys: string[],\r\n) {\r\n const dataKeyFromDataConfig = flattenDeep(dataConfig.map(d => d.columnId));\r\n const checkDataKeys = missingValuesInArray(dataKeys, dataKeyFromDataConfig);\r\n if (checkDataKeys.length !== 0)\r\n return {\r\n isValid: false,\r\n err: `Key(s) in configuration that don't match keys in the data: ${checkDataKeys.join(\r\n ', ',\r\n )}. Possible reason: If you are using 'dataTransform' then the allowed keys (columns) are only the one present in 'aggregationColumnsSetting' array in 'dataTransform' object plus an additional key called 'count'.`,\r\n };\r\n const ids = dataConfig.map(el => el.chartConfigId);\r\n const requiredIds = ChartConfiguration[\r\n ChartConfiguration.findIndex(el => el.chartID === graph)\r\n ].configuration\r\n .filter(el => el.required)\r\n .map(el => el.id);\r\n const ifRequiredIdsPresent = missingValuesInArray(ids, requiredIds);\r\n return {\r\n isValid: ifRequiredIdsPresent.length === 0,\r\n err:\r\n ifRequiredIdsPresent.length === 0\r\n ? undefined\r\n : `Missing required ID(s) in configuration: ${ifRequiredIdsPresent.join(', ')}`,\r\n };\r\n}\r\n","import { checkDataConfigValidity } from '../checkDataValidity';\r\nimport { checkIfNullOrUndefined } from '../checkIfNullOrUndefined';\r\nimport { graphList } from '../getGraphList';\r\n\r\nimport { ChartConfiguration } from './graphConfig';\r\n\r\nimport { GraphConfigurationDataType, GraphType, ThreeDGraphType } from '@/Types';\r\n/**\r\n * Transforms the input data into a format suitable for graph visualization based on the given graph type and configuration.\r\n *\r\n * The function formats the data according to the specified graph configuration and checks the validity of the configuration.\r\n * It also handles cases for graphs like \"dataTable\" and \"dataCards\" without additional processing, and it processes\r\n * more complex graphs (e.g., charts) with a specific configuration.\r\n *\r\n * @param data - The data to be transformed, typically an array of objects representing rows of data.\r\n * @param graph - The type of graph to transform the data for (e.g., lineChart, barChart, etc.).\r\n * @param config - An optional array of configuration objects that define how the data should be mapped to the graph.\r\n * Each object in the array should define column mappings and how data should be grouped or aggregated.\r\n *\r\n * @returns The transformed data in the format required by the graph. If no valid configuration is provided, or if\r\n * data is invalid, an error message is returned.\r\n * - If the graph type is \"dataTable\" or \"dataCards\", the original data is returned unchanged.\r\n * - If data is invalid, an error message will be returned.\r\n *\r\n * @throws {string} If the configuration is invalid or the data can't be processed, an error message is logged and\r\n * returned.\r\n *\r\n * @example\r\n * const graphData = [\r\n * { category: 'A', value: 10 },\r\n * { category: 'B', value: 15 },\r\n * ];\r\n * const graph = 'barChart';\r\n * const config = [\r\n * { columnId: 'category', chartConfigId: 'label' },\r\n * { columnId: 'value', chartConfigId: 'size' },\r\n * ];\r\n * const transformedData = transformDataForGraph(graphData, graph, config);\r\n * console.log(transformedData);\r\n */\r\nexport function transformDataForGraph(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n data: any,\r\n graph: GraphType | ThreeDGraphType,\r\n config?: GraphConfigurationDataType[],\r\n) {\r\n if (\r\n graphList\r\n .filter(el => el.geoHubMapPresentation)\r\n .map(el => el.graphID)\r\n .indexOf(graph) !== -1\r\n )\r\n return data;\r\n if (!data) return 'Cannot fetch data';\r\n if (graph === 'dataTable' || graph === 'dataCards' || data.length === 0) return data;\r\n if (!config) {\r\n console.error('Your data configuration is not accurate');\r\n return 'No graph configuration is provided';\r\n }\r\n const dataConfigValidity = checkDataConfigValidity(config, graph, Object.keys(data[0]));\r\n if (dataConfigValidity.isValid) {\r\n const chartConfig =\r\n ChartConfiguration[ChartConfiguration.findIndex(d => d.chartID === graph)].configuration;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const dataFormatted = data.map((d: any) => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const obj: any = {};\r\n config\r\n .filter(el => el.columnId)\r\n .forEach(el => {\r\n if (chartConfig[chartConfig.findIndex(k => k.id === el.chartConfigId)].multiple) {\r\n obj[chartConfig[chartConfig.findIndex(k => k.id === el.chartConfigId)].id] = [];\r\n (el.columnId as string[]).forEach(l => {\r\n obj[chartConfig[chartConfig.findIndex(k => k.id === el.chartConfigId)].id].push(\r\n checkIfNullOrUndefined(d[l]) ? null : d[l],\r\n );\r\n });\r\n } else {\r\n obj[chartConfig[chartConfig.findIndex(k => k.id === el.chartConfigId)].id] =\r\n checkIfNullOrUndefined(d[el.columnId as string]) ? null : d[el.columnId as string];\r\n }\r\n obj[`${el.chartConfigId}Columns`] = el.columnId;\r\n });\r\n obj.data = d;\r\n return obj;\r\n });\r\n return dataFormatted;\r\n }\r\n console.error(dataConfigValidity.err);\r\n return dataConfigValidity.err;\r\n}\r\n","import sum from 'lodash.sum';\r\nimport flattenDeep from 'lodash.flattendeep';\r\n\r\nimport { uniqBy } from '../uniqBy';\r\n\r\nimport { AggregationSettingsDataType } from '@/Types';\r\n/**\r\n * Transforms the data for aggregation based on a key column and specified aggregation settings.\r\n * It groups the data by unique values in the key column and applies the aggregation methods to each group.\r\n *\r\n * @param data - The input data to be aggregated. Can be an array of objects, where each object represents a data row.\r\n * @param keyColumn - The name of the column to group the data by (key column).\r\n * @param aggregationSettings - Optional settings for the aggregation, specifying the column and aggregation method (e.g., 'average', 'max', 'min', 'sum').\r\n * Each setting can define a column and a corresponding aggregation method to apply to that column.\r\n *\r\n * @returns An array of objects where each object contains the aggregated values for each unique value in the key column.\r\n * Each object includes the key column value, count of occurrences, and the aggregated values for each specified column.\r\n *\r\n * @example\r\n * const data = [\r\n * { category: 'A', value: 10, amount: 5 },\r\n * { category: 'A', value: 20, amount: 10 },\r\n * { category: 'B', value: 15, amount: 7 },\r\n * ];\r\n * const aggregationSettings = [\r\n * { column: 'value', aggregationMethod: 'average' },\r\n * { column: 'amount', aggregationMethod: 'sum' },\r\n * ];\r\n * const transformedData = transformDataForAggregation(data, 'category', aggregationSettings);\r\n * console.log(transformedData);\r\n * // Output:\r\n * // [\r\n * // { category: 'A', count: 2, value: 15, amount: 15 },\r\n * // { category: 'B', count: 1, value: 15, amount: 7 },\r\n * // ]\r\n */\r\nexport function transformDataForAggregation(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n data: any,\r\n keyColumn: string,\r\n aggregationSettings?: AggregationSettingsDataType[],\r\n) {\r\n if (data.length === 0) return [];\r\n if (typeof data[0][keyColumn] !== 'object') {\r\n const uniqValues = uniqBy(data, keyColumn).map(d => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const dataObj: any = {};\r\n dataObj[keyColumn] = d;\r\n const filteredData = data.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (j: any) => j[keyColumn] === d,\r\n );\r\n dataObj.count = filteredData.length;\r\n dataObj.rollUpData = filteredData;\r\n aggregationSettings?.forEach(el => {\r\n dataObj[el.column] =\r\n el.aggregationMethod === 'average'\r\n ? parseFloat(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (sum(filteredData.map((j: any) => j[el.column])) / filteredData.length).toFixed(2),\r\n )\r\n : el.aggregationMethod === 'max'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n Math.max(...filteredData.map((j: any) => j[el.column]))\r\n : el.aggregationMethod === 'min'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n Math.min(...filteredData.map((j: any) => j[el.column]))\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n sum(filteredData.map((j: any) => j[el.column]));\r\n });\r\n return dataObj;\r\n });\r\n return uniqValues;\r\n }\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const values = [...new Set(flattenDeep(data.map((d: any) => d[keyColumn])))];\r\n const uniqValues = values.map(d => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const dataObj: any = {};\r\n dataObj[keyColumn] = d;\r\n const filteredData = data.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (j: any) => j[keyColumn].indexOf(d) !== -1,\r\n );\r\n dataObj.rollUpData = filteredData;\r\n dataObj.count = filteredData.length;\r\n aggregationSettings?.forEach(el => {\r\n dataObj[el.column] =\r\n el.aggregationMethod === 'average'\r\n ? parseFloat(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (sum(filteredData.map((j: any) => j[el.column])) / filteredData.length).toFixed(2),\r\n )\r\n : el.aggregationMethod === 'max'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n Math.max(...filteredData.map((j: any) => j[el.column]))\r\n : el.aggregationMethod === 'min'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n Math.min(...filteredData.map((j: any) => j[el.column]))\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n sum(filteredData.map((j: any) => j[el.column]));\r\n });\r\n return dataObj;\r\n });\r\n return uniqValues;\r\n}\r\n"],"names":["ChartConfiguration","chartID","configuration","id","required","multiple","missingValuesInArray","superset","subset","filter","value","includes","checkDataConfigValidity","dataConfig","graph","dataKeys","dataKeyFromDataConfig","flattenDeep","map","d","columnId","checkDataKeys","length","isValid","err","join","ids","el","chartConfigId","requiredIds","findIndex","ifRequiredIdsPresent","undefined","transformDataForGraph","data","config","graphList","geoHubMapPresentation","graphID","indexOf","console","error","dataConfigValidity","Object","keys","chartConfig","obj","forEach","k","l","push","checkIfNullOrUndefined","transformDataForAggregation","keyColumn","aggregationSettings","uniqBy","dataObj","filteredData","j","count","rollUpData","column","aggregationMethod","parseFloat","sum","toFixed","Math","max","min","Set"],"mappings":"sNAEaA,EAGP,CACJ,CACEC,QAAS,WACTC,cAAe,CACb,CACEC,GAAI,QACJC,SAAU,GACVC,SAAU,EAAA,EAEZ,CACEF,GAAI,OACJC,SAAU,GACVC,SAAU,EAAA,EAEZ,CACEF,GAAI,QACJC,SAAU,GACVC,SAAU,EAAA,EAEZ,CACEF,GAAI,OACJC,SAAU,GACVC,SAAU,EAAA,CACX,CAEL,EACA,CACEJ,QAAS,cACTC,cAAe,CACb,CACEC,GAA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,MAAM,CAAC,CAAC,EAAIJ,EAAanC,QAAQ2C,QAAQ,CAAC,CAAA,EAEnFtC,EAAGmC,oBAAsB,MAEvBI,KAAKC,IAAI,GAAGV,EAAavC,IAAKwC,GAAWA,EAAE/B,EAAGkC,MAAM,CAAC,CAAC,EACtDlC,EAAGmC,oBAAsB,MAEvBI,KAAKE,IAAI,GAAGX,EAAavC,IAAKwC,GAAWA,EAAE/B,EAAGkC,MAAM,CAAC,CAAC,EAEtDG,EAAAA,IAAIP,EAAavC,IAAKwC,GAAWA,EAAE/B,EAAGkC,MAAM,CAAC,CAAC,CAC1D,CAAC,EACML,CACT,CAAC,CAEH"}
|
|
1
|
+
{"version":3,"file":"transformDataForAggregation-XNg0OGYE.cjs","sources":["../src/Utils/transformData/graphConfig.ts","../src/Utils/checkDataValidity.ts","../src/Utils/transformData/transformDataForGraph.ts","../src/Utils/transformData/transformDataForAggregation.ts"],"sourcesContent":["import { GraphType, ThreeDGraphType } from '@/Types';\r\n\r\nexport const ChartConfiguration: {\r\n chartID: GraphType | ThreeDGraphType;\r\n configuration: { id: string; required: boolean; multiple: boolean }[];\r\n}[] = [\r\n {\r\n chartID: 'barChart',\r\n configuration: [\r\n {\r\n id: 'label',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'size',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'color',\r\n required: false,\r\n multiple: false,\r\n },\r\n {\r\n id: 'date',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'bulletChart',\r\n configuration: [\r\n {\r\n id: 'label',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'size',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'target',\r\n required: false,\r\n multiple: false,\r\n },\r\n {\r\n id: 'qualitativeRange',\r\n required: false,\r\n multiple: true,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'radarChart',\r\n configuration: [\r\n {\r\n id: 'label',\r\n required: false,\r\n multiple: false,\r\n },\r\n {\r\n id: 'values',\r\n required: true,\r\n multiple: true,\r\n },\r\n {\r\n id: 'color',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'stackedBarChart',\r\n configuration: [\r\n {\r\n id: 'label',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'size',\r\n multiple: true,\r\n required: true,\r\n },\r\n {\r\n id: 'date',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'groupedBarChart',\r\n configuration: [\r\n {\r\n id: 'label',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'size',\r\n multiple: true,\r\n required: true,\r\n },\r\n {\r\n id: 'date',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'lineChart',\r\n configuration: [\r\n {\r\n id: 'date',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'y',\r\n required: true,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'dualAxisLineChart',\r\n configuration: [\r\n {\r\n id: 'date',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'y1',\r\n multiple: false,\r\n required: true,\r\n },\r\n {\r\n id: 'y2',\r\n multiple: false,\r\n required: true,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'differenceLineChart',\r\n configuration: [\r\n {\r\n id: 'date',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'y1',\r\n multiple: false,\r\n required: true,\r\n },\r\n {\r\n id: 'y2',\r\n multiple: false,\r\n required: true,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'multiLineChart',\r\n configuration: [\r\n {\r\n id: 'date',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'y',\r\n multiple: true,\r\n required: true,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'multiLineAltChart',\r\n configuration: [\r\n {\r\n id: 'date',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'y',\r\n multiple: false,\r\n required: true,\r\n },\r\n {\r\n id: 'label',\r\n multiple: false,\r\n required: true,\r\n },\r\n {\r\n id: 'color',\r\n multiple: false,\r\n required: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'stackedAreaChart',\r\n configuration: [\r\n {\r\n id: 'date',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'y',\r\n multiple: true,\r\n required: true,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'threeDGlobe',\r\n configuration: [\r\n {\r\n id: 'id',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'x',\r\n required: true,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'choroplethMap',\r\n configuration: [\r\n {\r\n id: 'id',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'x',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'date',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'biVariateChoroplethMap',\r\n configuration: [\r\n {\r\n id: 'id',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'x',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'y',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'date',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'dotDensityMap',\r\n configuration: [\r\n {\r\n id: 'lat',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'long',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'label',\r\n multiple: false,\r\n required: false,\r\n },\r\n {\r\n id: 'color',\r\n multiple: false,\r\n required: false,\r\n },\r\n {\r\n id: 'radius',\r\n required: false,\r\n multiple: false,\r\n },\r\n {\r\n id: 'date',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'hybridMap',\r\n configuration: [\r\n {\r\n id: 'id',\r\n required: false,\r\n multiple: false,\r\n },\r\n {\r\n id: 'x',\r\n required: false,\r\n multiple: false,\r\n },\r\n {\r\n id: 'lat',\r\n required: false,\r\n multiple: false,\r\n },\r\n {\r\n id: 'long',\r\n required: false,\r\n multiple: false,\r\n },\r\n {\r\n id: 'label',\r\n multiple: false,\r\n required: false,\r\n },\r\n {\r\n id: 'radius',\r\n required: false,\r\n multiple: false,\r\n },\r\n {\r\n id: 'date',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'donutChart',\r\n configuration: [\r\n {\r\n id: 'label',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'size',\r\n required: true,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'slopeChart',\r\n configuration: [\r\n {\r\n id: 'label',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'y1',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'y2',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'color',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'scatterPlot',\r\n configuration: [\r\n {\r\n id: 'x',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'y',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'radius',\r\n required: false,\r\n multiple: false,\r\n },\r\n {\r\n id: 'color',\r\n required: false,\r\n multiple: false,\r\n },\r\n {\r\n id: 'label',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'date',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'dumbbellChart',\r\n configuration: [\r\n {\r\n id: 'label',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'x',\r\n multiple: true,\r\n required: true,\r\n },\r\n {\r\n id: 'date',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'treeMap',\r\n configuration: [\r\n {\r\n id: 'label',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'size',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'color',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'circlePacking',\r\n configuration: [\r\n {\r\n id: 'label',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'size',\r\n required: false,\r\n multiple: false,\r\n },\r\n {\r\n id: 'color',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'sankeyChart',\r\n configuration: [\r\n {\r\n id: 'source',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'target',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'value',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'heatMap',\r\n configuration: [\r\n {\r\n id: 'row',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'column',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'value',\r\n required: true,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'stripChart',\r\n configuration: [\r\n {\r\n id: 'label',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'position',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'color',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'statCard',\r\n configuration: [\r\n {\r\n id: 'value',\r\n required: true,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'beeSwarmChart',\r\n configuration: [\r\n {\r\n id: 'label',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'position',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'radius',\r\n required: false,\r\n multiple: false,\r\n },\r\n {\r\n id: 'color',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'butterflyChart',\r\n configuration: [\r\n {\r\n id: 'label',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'leftBar',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'rightBar',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'date',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'lineChartWithConfidenceInterval',\r\n configuration: [\r\n {\r\n id: 'date',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'y',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'yMin',\r\n required: false,\r\n multiple: false,\r\n },\r\n {\r\n id: 'yMax',\r\n required: false,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'histogram',\r\n configuration: [\r\n {\r\n id: 'value',\r\n required: true,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'sparkLine',\r\n configuration: [\r\n {\r\n id: 'dale',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'y',\r\n required: true,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'paretoChart',\r\n configuration: [\r\n {\r\n id: 'label',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'bar',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'line',\r\n required: true,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n {\r\n chartID: 'unitChart',\r\n configuration: [\r\n {\r\n id: 'label',\r\n required: true,\r\n multiple: false,\r\n },\r\n {\r\n id: 'value',\r\n required: true,\r\n multiple: false,\r\n },\r\n ],\r\n },\r\n];\r\n","import flattenDeep from 'lodash.flattendeep';\r\n\r\nimport { ChartConfiguration } from './transformData/graphConfig';\r\n\r\nimport { GraphConfigurationDataType, GraphType, ThreeDGraphType } from '@/Types';\r\n\r\nfunction missingValuesInArray(superset: string[], subset: string[]): string[] {\r\n return subset.filter(value => !superset.includes(value));\r\n}\r\n\r\nexport function checkDataConfigValidity(\r\n dataConfig: GraphConfigurationDataType[],\r\n graph: GraphType | ThreeDGraphType,\r\n dataKeys: string[],\r\n) {\r\n const dataKeyFromDataConfig = flattenDeep(dataConfig.map(d => d.columnId));\r\n const checkDataKeys = missingValuesInArray(dataKeys, dataKeyFromDataConfig);\r\n if (checkDataKeys.length !== 0)\r\n return {\r\n isValid: false,\r\n err: `Key(s) in configuration that don't match keys in the data: ${checkDataKeys.join(\r\n ', ',\r\n )}. Possible reason: If you are using 'dataTransform' then the allowed keys (columns) are only the one present in 'aggregationColumnsSetting' array in 'dataTransform' object plus an additional key called 'count'.`,\r\n };\r\n const ids = dataConfig.map(el => el.chartConfigId);\r\n const requiredIds = ChartConfiguration[\r\n ChartConfiguration.findIndex(el => el.chartID === graph)\r\n ].configuration\r\n .filter(el => el.required)\r\n .map(el => el.id);\r\n const ifRequiredIdsPresent = missingValuesInArray(ids, requiredIds);\r\n return {\r\n isValid: ifRequiredIdsPresent.length === 0,\r\n err:\r\n ifRequiredIdsPresent.length === 0\r\n ? undefined\r\n : `Missing required ID(s) in configuration: ${ifRequiredIdsPresent.join(', ')}`,\r\n };\r\n}\r\n","import { checkDataConfigValidity } from '../checkDataValidity';\r\nimport { checkIfNullOrUndefined } from '../checkIfNullOrUndefined';\r\nimport { graphList } from '../getGraphList';\r\n\r\nimport { ChartConfiguration } from './graphConfig';\r\n\r\nimport { GraphConfigurationDataType, GraphType, ThreeDGraphType } from '@/Types';\r\n/**\r\n * Transforms the input data into a format suitable for graph visualization based on the given graph type and configuration.\r\n *\r\n * The function formats the data according to the specified graph configuration and checks the validity of the configuration.\r\n * It also handles cases for graphs like \"dataTable\" and \"dataCards\" without additional processing, and it processes\r\n * more complex graphs (e.g., charts) with a specific configuration.\r\n *\r\n * @param data - The data to be transformed, typically an array of objects representing rows of data.\r\n * @param graph - The type of graph to transform the data for (e.g., lineChart, barChart, etc.).\r\n * @param config - An optional array of configuration objects that define how the data should be mapped to the graph.\r\n * Each object in the array should define column mappings and how data should be grouped or aggregated.\r\n *\r\n * @returns The transformed data in the format required by the graph. If no valid configuration is provided, or if\r\n * data is invalid, an error message is returned.\r\n * - If the graph type is \"dataTable\" or \"dataCards\", the original data is returned unchanged.\r\n * - If data is invalid, an error message will be returned.\r\n *\r\n * @throws {string} If the configuration is invalid or the data can't be processed, an error message is logged and\r\n * returned.\r\n *\r\n * @example\r\n * const graphData = [\r\n * { category: 'A', value: 10 },\r\n * { category: 'B', value: 15 },\r\n * ];\r\n * const graph = 'barChart';\r\n * const config = [\r\n * { columnId: 'category', chartConfigId: 'label' },\r\n * { columnId: 'value', chartConfigId: 'size' },\r\n * ];\r\n * const transformedData = transformDataForGraph(graphData, graph, config);\r\n * console.log(transformedData);\r\n */\r\nexport function transformDataForGraph(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n data: any,\r\n graph: GraphType | ThreeDGraphType,\r\n config?: GraphConfigurationDataType[],\r\n) {\r\n if (\r\n graphList\r\n .filter(el => el.geoHubMapPresentation)\r\n .map(el => el.graphID)\r\n .indexOf(graph) !== -1\r\n )\r\n return data;\r\n if (!data) return 'Cannot fetch data';\r\n if (graph === 'dataTable' || graph === 'dataCards' || data.length === 0) return data;\r\n if (!config) {\r\n console.error('Your data configuration is not accurate');\r\n return 'No graph configuration is provided';\r\n }\r\n const dataConfigValidity = checkDataConfigValidity(config, graph, Object.keys(data[0]));\r\n if (dataConfigValidity.isValid) {\r\n const chartConfig =\r\n ChartConfiguration[ChartConfiguration.findIndex(d => d.chartID === graph)].configuration;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const dataFormatted = data.map((d: any) => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const obj: any = {};\r\n config\r\n .filter(el => el.columnId)\r\n .forEach(el => {\r\n if (chartConfig[chartConfig.findIndex(k => k.id === el.chartConfigId)].multiple) {\r\n obj[chartConfig[chartConfig.findIndex(k => k.id === el.chartConfigId)].id] = [];\r\n (el.columnId as string[]).forEach(l => {\r\n obj[chartConfig[chartConfig.findIndex(k => k.id === el.chartConfigId)].id].push(\r\n checkIfNullOrUndefined(d[l]) ? null : d[l],\r\n );\r\n });\r\n } else {\r\n obj[chartConfig[chartConfig.findIndex(k => k.id === el.chartConfigId)].id] =\r\n checkIfNullOrUndefined(d[el.columnId as string]) ? null : d[el.columnId as string];\r\n }\r\n obj[`${el.chartConfigId}Columns`] = el.columnId;\r\n });\r\n obj.data = d;\r\n return obj;\r\n });\r\n return dataFormatted;\r\n }\r\n console.error(dataConfigValidity.err);\r\n return dataConfigValidity.err;\r\n}\r\n","import sum from 'lodash.sum';\r\nimport flattenDeep from 'lodash.flattendeep';\r\n\r\nimport { uniqBy } from '../uniqBy';\r\n\r\nimport { AggregationSettingsDataType } from '@/Types';\r\n/**\r\n * Transforms the data for aggregation based on a key column and specified aggregation settings.\r\n * It groups the data by unique values in the key column and applies the aggregation methods to each group.\r\n *\r\n * @param data - The input data to be aggregated. Can be an array of objects, where each object represents a data row.\r\n * @param keyColumn - The name of the column to group the data by (key column).\r\n * @param aggregationSettings - Optional settings for the aggregation, specifying the column and aggregation method (e.g., 'average', 'max', 'min', 'sum').\r\n * Each setting can define a column and a corresponding aggregation method to apply to that column.\r\n *\r\n * @returns An array of objects where each object contains the aggregated values for each unique value in the key column.\r\n * Each object includes the key column value, count of occurrences, and the aggregated values for each specified column.\r\n *\r\n * @example\r\n * const data = [\r\n * { category: 'A', value: 10, amount: 5 },\r\n * { category: 'A', value: 20, amount: 10 },\r\n * { category: 'B', value: 15, amount: 7 },\r\n * ];\r\n * const aggregationSettings = [\r\n * { column: 'value', aggregationMethod: 'average' },\r\n * { column: 'amount', aggregationMethod: 'sum' },\r\n * ];\r\n * const transformedData = transformDataForAggregation(data, 'category', aggregationSettings);\r\n * console.log(transformedData);\r\n * // Output:\r\n * // [\r\n * // { category: 'A', count: 2, value: 15, amount: 15 },\r\n * // { category: 'B', count: 1, value: 15, amount: 7 },\r\n * // ]\r\n */\r\nexport function transformDataForAggregation(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n data: any,\r\n keyColumn: string,\r\n aggregationSettings?: AggregationSettingsDataType[],\r\n) {\r\n if (data.length === 0) return [];\r\n if (typeof data[0][keyColumn] !== 'object') {\r\n const uniqValues = uniqBy(data, keyColumn).map(d => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const dataObj: any = {};\r\n dataObj[keyColumn] = d;\r\n const filteredData = data.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (j: any) => j[keyColumn] === d,\r\n );\r\n dataObj.count = filteredData.length;\r\n dataObj.rollUpData = filteredData;\r\n aggregationSettings?.forEach(el => {\r\n dataObj[el.column] =\r\n el.aggregationMethod === 'average'\r\n ? parseFloat(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (sum(filteredData.map((j: any) => j[el.column])) / filteredData.length).toFixed(2),\r\n )\r\n : el.aggregationMethod === 'max'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n Math.max(...filteredData.map((j: any) => j[el.column]))\r\n : el.aggregationMethod === 'min'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n Math.min(...filteredData.map((j: any) => j[el.column]))\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n sum(filteredData.map((j: any) => j[el.column]));\r\n });\r\n return dataObj;\r\n });\r\n return uniqValues;\r\n }\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const values = [...new Set(flattenDeep(data.map((d: any) => d[keyColumn])))];\r\n const uniqValues = values.map(d => {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const dataObj: any = {};\r\n dataObj[keyColumn] = d;\r\n const filteredData = data.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (j: any) => j[keyColumn].indexOf(d) !== -1,\r\n );\r\n dataObj.rollUpData = filteredData;\r\n dataObj.count = filteredData.length;\r\n aggregationSettings?.forEach(el => {\r\n dataObj[el.column] =\r\n el.aggregationMethod === 'average'\r\n ? parseFloat(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (sum(filteredData.map((j: any) => j[el.column])) / filteredData.length).toFixed(2),\r\n )\r\n : el.aggregationMethod === 'max'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n Math.max(...filteredData.map((j: any) => j[el.column]))\r\n : el.aggregationMethod === 'min'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n Math.min(...filteredData.map((j: any) => j[el.column]))\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n sum(filteredData.map((j: any) => j[el.column]));\r\n });\r\n return dataObj;\r\n });\r\n return uniqValues;\r\n}\r\n"],"names":["ChartConfiguration","chartID","configuration","id","required","multiple","missingValuesInArray","superset","subset","filter","value","includes","checkDataConfigValidity","dataConfig","graph","dataKeys","dataKeyFromDataConfig","flattenDeep","map","d","columnId","checkDataKeys","length","isValid","err","join","ids","el","chartConfigId","requiredIds","findIndex","ifRequiredIdsPresent","undefined","transformDataForGraph","data","config","graphList","geoHubMapPresentation","graphID","indexOf","console","error","dataConfigValidity","Object","keys","chartConfig","obj","forEach","k","l","push","checkIfNullOrUndefined","transformDataForAggregation","keyColumn","aggregationSettings","uniqBy","dataObj","filteredData","j","count","rollUpData","column","aggregationMethod","parseFloat","sum","toFixed","Math","max","min","Set"],"mappings":"sNAEaA,EAGP,CACJ,CACEC,QAAS,WACTC,cAAe,CACb,CACEC,GAAI,QACJC,SAAU,GACVC,SAAU,EAAA,EAEZ,CACEF,GAAI,OACJC,SAAU,GACVC,SAAU,EAAA,EAEZ,CACEF,GAAI,QACJC,SAAU,GACVC,SAAU,EAAA,EAEZ,CACEF,GAAI,OACJC,SAAU,GACVC,SAAU,EAAA,CACX,CAEL,EACA,CACEJ,QAAS,cACT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GAAWA,EAAE/B,EAAGkC,MAAM,CAAC,CAAC,EAAIJ,EAAanC,QAAQ2C,QAAQ,CAAC,CAAA,EAEnFtC,EAAGmC,oBAAsB,MAEvBI,KAAKC,IAAI,GAAGV,EAAavC,IAAKwC,GAAWA,EAAE/B,EAAGkC,MAAM,CAAC,CAAC,EACtDlC,EAAGmC,oBAAsB,MAEvBI,KAAKE,IAAI,GAAGX,EAAavC,IAAKwC,GAAWA,EAAE/B,EAAGkC,MAAM,CAAC,CAAC,EAEtDG,EAAAA,IAAIP,EAAavC,IAAKwC,GAAWA,EAAE/B,EAAGkC,MAAM,CAAC,CAAC,CAC1D,CAAC,EACML,CACT,CAAC,CAEH"}
|
package/dist/{transformDataForGraphFromFile-D5TMQYYd.js → transformDataForGraphFromFile-CSG24iF6.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { f as p, a as i, b as m, c as D } from "./fetchAndParseData-BpqkBPQL.js";
|
|
2
|
-
import { a as l } from "./transformDataForAggregation-
|
|
2
|
+
import { a as l } from "./transformDataForAggregation-DEU__LUl.js";
|
|
3
3
|
async function g(r, o, f, s, c, t, n, e, h) {
|
|
4
4
|
try {
|
|
5
5
|
const a = await (typeof r == "string" ? s === "json" ? p(r, t, e, !1) : s === "api" ? i(r, n, t, e, !1) : m(r, e, t, !1, c, !0) : D(r, h));
|
|
@@ -11,4 +11,4 @@ async function g(r, o, f, s, c, t, n, e, h) {
|
|
|
11
11
|
export {
|
|
12
12
|
g as t
|
|
13
13
|
};
|
|
14
|
-
//# sourceMappingURL=transformDataForGraphFromFile-
|
|
14
|
+
//# sourceMappingURL=transformDataForGraphFromFile-CSG24iF6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformDataForGraphFromFile-
|
|
1
|
+
{"version":3,"file":"transformDataForGraphFromFile-CSG24iF6.js","sources":["../src/Utils/transformData/transformDataForGraphFromFile.ts"],"sourcesContent":["import {\r\n fetchAndParseJSON,\r\n fetchAndParseCSV,\r\n fetchAndTransformDataFromAPI,\r\n fetchAndParseMultipleDataSources,\r\n} from '../fetchAndParseData';\r\n\r\nimport { transformDataForGraph } from './transformDataForGraph';\r\n\r\nimport {\r\n ColumnConfigurationDataType,\r\n FileSettingsDataType,\r\n GraphConfigurationDataType,\r\n GraphType,\r\n} from '@/Types';\r\n/**\r\n * Fetches data from a given URL or multiple data sources, processes it according to the specified graph configuration,\r\n * and formats it for use in a graph.\r\n *\r\n * This function supports different file types (CSV, JSON, and API), and can handle multiple data sources. It applies\r\n * any necessary data transformations and column formatting, then prepares the data for visualization in the specified graph.\r\n *\r\n * @param dataURL - The URL or array of data sources to fetch data from. If it's a string, it represents the URL to fetch data from.\r\n * If it's an array, it represents multiple data sources with different types (CSV, JSON, API).\r\n * @param dataConfiguration - The graph configuration data used to determine how the data should be formatted for the graph.\r\n * @param graph - The type of graph to be used (e.g., lineChart, barChart).\r\n * @param fileType - The type of the file being fetched. Can be 'csv', 'json', or 'api'. This parameter is ignored if `dataURL` is an array.\r\n * @param delimiter - The delimiter used in CSV files (default is ',' if not provided).\r\n * @param columnsToArray - Configuration for columns that need to be transformed into arrays (optional).\r\n * @param apiHeaders - Headers for the API request (optional).\r\n * @param dataTransformation - A Handlebars template used for transforming the data (optional).\r\n * @param idColumnTitle - The title of the ID column when merging multiple data sources (optional).\r\n *\r\n * @returns A Promise that resolves to the transformed data ready for the graph, or null if an error occurs.\r\n *\r\n * @throws {Error} Throws an error if the data fetching or processing fails.\r\n *\r\n * @example\r\n * const dataURL = 'https://example.com/data.json';\r\n * const dataConfiguration = [\r\n * { column: 'value', chartConfigId: 'size' },\r\n * { column: 'category', chartConfigId: 'label' },\r\n * ];\r\n * const graph = 'barChart';\r\n * transformDataForGraphFromFile(dataURL, dataConfiguration, graph, 'json')\r\n * .then(data => {\r\n * console.log('Formatted Data:', data);\r\n * })\r\n * .catch(error => {\r\n * console.error('Error:', error);\r\n * });\r\n */\r\nexport async function transformDataForGraphFromFile(\r\n dataURL: string | FileSettingsDataType[],\r\n dataConfiguration: GraphConfigurationDataType[],\r\n graph: GraphType,\r\n fileType?: 'csv' | 'json' | 'api',\r\n delimiter?: string,\r\n columnsToArray?: ColumnConfigurationDataType[],\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n apiHeaders?: any,\r\n dataTransformation?: string,\r\n idColumnTitle?: string,\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n): Promise<any> {\r\n // Ensure the function returns a Promise\r\n try {\r\n const fetchedData = await (typeof dataURL === 'string'\r\n ? fileType === 'json'\r\n ? fetchAndParseJSON(dataURL, columnsToArray, dataTransformation, false)\r\n : fileType === 'api'\r\n ? fetchAndTransformDataFromAPI(\r\n dataURL,\r\n apiHeaders,\r\n columnsToArray,\r\n dataTransformation,\r\n false,\r\n )\r\n : fetchAndParseCSV(dataURL, dataTransformation, columnsToArray, false, delimiter, true)\r\n : fetchAndParseMultipleDataSources(dataURL, idColumnTitle));\r\n\r\n const formattedData = transformDataForGraph(\r\n fetchedData,\r\n graph,\r\n dataConfiguration as GraphConfigurationDataType[],\r\n );\r\n return formattedData;\r\n } catch (error) {\r\n console.error('Error fetching or processing data', error);\r\n return null; // Return null in case of any errors\r\n }\r\n}\r\n"],"names":["transformDataForGraphFromFile","dataURL","dataConfiguration","graph","fileType","delimiter","columnsToArray","apiHeaders","dataTransformation","idColumnTitle","fetchedData","fetchAndParseJSON","fetchAndTransformDataFromAPI","fetchAndParseCSV","fetchAndParseMultipleDataSources","transformDataForGraph","error","console"],"mappings":";;AAoDA,eAAsBA,EACpBC,GACAC,GACAC,GACAC,GACAC,GACAC,GAEAC,GACAC,GACAC,GAEc;AAEd,MAAI;AACF,UAAMC,IAAc,OAAO,OAAOT,KAAY,WAC1CG,MAAa,SACXO,EAAkBV,GAASK,GAAgBE,GAAoB,EAAK,IACpEJ,MAAa,QACXQ,EACEX,GACAM,GACAD,GACAE,GACA,EACF,IACAK,EAAiBZ,GAASO,GAAoBF,GAAgB,IAAOD,GAAW,EAAI,IACxFS,EAAiCb,GAASQ,CAAa;AAO3D,WALsBM,EACpBL,GACAP,GACAD,CACF;AAAA,EAEF,SAASc,GAAO;AACdC,mBAAQD,MAAM,qCAAqCA,CAAK,GACjD;AAAA,EACT;AACF;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const t=require("./fetchAndParseData-l5HGMAEs.cjs"),D=require("./transformDataForAggregation-
|
|
2
|
-
//# sourceMappingURL=transformDataForGraphFromFile-
|
|
1
|
+
"use strict";const t=require("./fetchAndParseData-l5HGMAEs.cjs"),D=require("./transformDataForAggregation-XNg0OGYE.cjs");async function F(r,n,c,s,f,e,h,a,i){try{const o=await(typeof r=="string"?s==="json"?t.fetchAndParseJSON(r,e,a,!1):s==="api"?t.fetchAndTransformDataFromAPI(r,h,e,a,!1):t.fetchAndParseCSV(r,a,e,!1,f,!0):t.fetchAndParseMultipleDataSources(r,i));return D.transformDataForGraph(o,c,n)}catch(o){return console.error("Error fetching or processing data",o),null}}exports.transformDataForGraphFromFile=F;
|
|
2
|
+
//# sourceMappingURL=transformDataForGraphFromFile-CzepNVGZ.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformDataForGraphFromFile-
|
|
1
|
+
{"version":3,"file":"transformDataForGraphFromFile-CzepNVGZ.cjs","sources":["../src/Utils/transformData/transformDataForGraphFromFile.ts"],"sourcesContent":["import {\r\n fetchAndParseJSON,\r\n fetchAndParseCSV,\r\n fetchAndTransformDataFromAPI,\r\n fetchAndParseMultipleDataSources,\r\n} from '../fetchAndParseData';\r\n\r\nimport { transformDataForGraph } from './transformDataForGraph';\r\n\r\nimport {\r\n ColumnConfigurationDataType,\r\n FileSettingsDataType,\r\n GraphConfigurationDataType,\r\n GraphType,\r\n} from '@/Types';\r\n/**\r\n * Fetches data from a given URL or multiple data sources, processes it according to the specified graph configuration,\r\n * and formats it for use in a graph.\r\n *\r\n * This function supports different file types (CSV, JSON, and API), and can handle multiple data sources. It applies\r\n * any necessary data transformations and column formatting, then prepares the data for visualization in the specified graph.\r\n *\r\n * @param dataURL - The URL or array of data sources to fetch data from. If it's a string, it represents the URL to fetch data from.\r\n * If it's an array, it represents multiple data sources with different types (CSV, JSON, API).\r\n * @param dataConfiguration - The graph configuration data used to determine how the data should be formatted for the graph.\r\n * @param graph - The type of graph to be used (e.g., lineChart, barChart).\r\n * @param fileType - The type of the file being fetched. Can be 'csv', 'json', or 'api'. This parameter is ignored if `dataURL` is an array.\r\n * @param delimiter - The delimiter used in CSV files (default is ',' if not provided).\r\n * @param columnsToArray - Configuration for columns that need to be transformed into arrays (optional).\r\n * @param apiHeaders - Headers for the API request (optional).\r\n * @param dataTransformation - A Handlebars template used for transforming the data (optional).\r\n * @param idColumnTitle - The title of the ID column when merging multiple data sources (optional).\r\n *\r\n * @returns A Promise that resolves to the transformed data ready for the graph, or null if an error occurs.\r\n *\r\n * @throws {Error} Throws an error if the data fetching or processing fails.\r\n *\r\n * @example\r\n * const dataURL = 'https://example.com/data.json';\r\n * const dataConfiguration = [\r\n * { column: 'value', chartConfigId: 'size' },\r\n * { column: 'category', chartConfigId: 'label' },\r\n * ];\r\n * const graph = 'barChart';\r\n * transformDataForGraphFromFile(dataURL, dataConfiguration, graph, 'json')\r\n * .then(data => {\r\n * console.log('Formatted Data:', data);\r\n * })\r\n * .catch(error => {\r\n * console.error('Error:', error);\r\n * });\r\n */\r\nexport async function transformDataForGraphFromFile(\r\n dataURL: string | FileSettingsDataType[],\r\n dataConfiguration: GraphConfigurationDataType[],\r\n graph: GraphType,\r\n fileType?: 'csv' | 'json' | 'api',\r\n delimiter?: string,\r\n columnsToArray?: ColumnConfigurationDataType[],\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n apiHeaders?: any,\r\n dataTransformation?: string,\r\n idColumnTitle?: string,\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n): Promise<any> {\r\n // Ensure the function returns a Promise\r\n try {\r\n const fetchedData = await (typeof dataURL === 'string'\r\n ? fileType === 'json'\r\n ? fetchAndParseJSON(dataURL, columnsToArray, dataTransformation, false)\r\n : fileType === 'api'\r\n ? fetchAndTransformDataFromAPI(\r\n dataURL,\r\n apiHeaders,\r\n columnsToArray,\r\n dataTransformation,\r\n false,\r\n )\r\n : fetchAndParseCSV(dataURL, dataTransformation, columnsToArray, false, delimiter, true)\r\n : fetchAndParseMultipleDataSources(dataURL, idColumnTitle));\r\n\r\n const formattedData = transformDataForGraph(\r\n fetchedData,\r\n graph,\r\n dataConfiguration as GraphConfigurationDataType[],\r\n );\r\n return formattedData;\r\n } catch (error) {\r\n console.error('Error fetching or processing data', error);\r\n return null; // Return null in case of any errors\r\n }\r\n}\r\n"],"names":["transformDataForGraphFromFile","dataURL","dataConfiguration","graph","fileType","delimiter","columnsToArray","apiHeaders","dataTransformation","idColumnTitle","fetchedData","fetchAndParseJSON","fetchAndTransformDataFromAPI","fetchAndParseCSV","fetchAndParseMultipleDataSources","transformDataForGraph","error","console"],"mappings":"yHAoDA,eAAsBA,EACpBC,EACAC,EACAC,EACAC,EACAC,EACAC,EAEAC,EACAC,EACAC,EAEc,CAEd,GAAI,CACF,MAAMC,EAAc,MAAO,OAAOT,GAAY,SAC1CG,IAAa,OACXO,EAAAA,kBAAkBV,EAASK,EAAgBE,EAAoB,EAAK,EACpEJ,IAAa,MACXQ,+BACEX,EACAM,EACAD,EACAE,EACA,EACF,EACAK,EAAAA,iBAAiBZ,EAASO,EAAoBF,EAAgB,GAAOD,EAAW,EAAI,EACxFS,EAAAA,iCAAiCb,EAASQ,CAAa,GAO3D,OALsBM,EAAAA,sBACpBL,EACAP,EACAD,CACF,CAEF,OAASc,EAAO,CACdC,eAAQD,MAAM,oCAAqCA,CAAK,EACjD,IACT,CACF"}
|
package/dist/utils.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),e=require("./removeOutliers-WELHHqiI.cjs"),o=require("./numberFormattingFunction-02t-wJta.cjs"),n=require("./getTextColorBasedOnBgColor-nqY-bsM_.cjs"),t=require("./getJenks-GYmdwBqm.cjs"),i=require("./imageDownload-NYXbvKob.cjs"),a=require("./svgDownload-D9zEGjTF.cjs"),g=require("./excelDownload-BQpsCa62.cjs"),l=require("./getUniqValue-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),e=require("./removeOutliers-WELHHqiI.cjs"),o=require("./numberFormattingFunction-02t-wJta.cjs"),n=require("./getTextColorBasedOnBgColor-nqY-bsM_.cjs"),t=require("./getJenks-GYmdwBqm.cjs"),i=require("./imageDownload-NYXbvKob.cjs"),a=require("./svgDownload-D9zEGjTF.cjs"),g=require("./excelDownload-BQpsCa62.cjs"),l=require("./getUniqValue-NX8DgwND.cjs"),s=require("./getGraphList-CA17dvFB.cjs"),u=require("./getCentroidCoordinates-Dng1HVjO.cjs");exports.checkIfNullOrUndefined=r.checkIfNullOrUndefined;exports.generateEmbedLink=e.generateEmbedLink;exports.generateIframeCode=e.generateIframeCode;exports.getPercentileValue=e.getPercentileValue;exports.getQueryParamsFromLink=e.getQueryParamsFromLink;exports.removeOutliers=e.removeOutliers;exports.numberFormattingFunction=o.numberFormattingFunction;exports.getTextColorBasedOnBgColor=n.getTextColorBasedOnBgColor;exports.getJenks=t.getJenks;exports.imageDownload=i.imageDownload;exports.svgDownload=a.svgDownload;exports.excelDownload=g.excelDownload;exports.getUniqValue=l.getUniqValue;exports.graphList=s.graphList;exports.getCentroidCoordinates=u.getCentroidCoordinates;
|
|
2
2
|
//# sourceMappingURL=utils.cjs.map
|
package/dist/utils.js
CHANGED
|
@@ -6,8 +6,8 @@ import { g as d } from "./getJenks-BbngDoBQ.js";
|
|
|
6
6
|
import { i as u } from "./imageDownload-BU4qnxJP.js";
|
|
7
7
|
import { s as k } from "./svgDownload-BAoarWNt.js";
|
|
8
8
|
import { e as w } from "./excelDownload-BEC1AyQW.js";
|
|
9
|
-
import { g as F } from "./getUniqValue-
|
|
10
|
-
import { g as O } from "./getGraphList-
|
|
9
|
+
import { g as F } from "./getUniqValue-DsqSii6M.js";
|
|
10
|
+
import { g as O } from "./getGraphList-Dxwo9TDb.js";
|
|
11
11
|
import { g as v } from "./getCentroidCoordinates-D7r34N4w.js";
|
|
12
12
|
export {
|
|
13
13
|
r as checkIfNullOrUndefined,
|
package/dist/validateSchema.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var u=Object.create;var c=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var v=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty;var f=(e,a,i,o)=>{if(a&&typeof a=="object"||typeof a=="function")for(let r of m(a))!p.call(e,r)&&r!==i&&c(e,r,{get:()=>a[r],enumerable:!(o=h(a,r))||o.enumerable});return e};var n=(e,a,i)=>(i=e!=null?u(v(e)):{},f(a||!e||!e.__esModule?c(i,"default",{value:e,enumerable:!0}):i,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("./getGraphList-
|
|
1
|
+
"use strict";var u=Object.create;var c=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var v=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty;var f=(e,a,i,o)=>{if(a&&typeof a=="object"||typeof a=="function")for(let r of m(a))!p.call(e,r)&&r!==i&&c(e,r,{get:()=>a[r],enumerable:!(o=h(a,r))||o.enumerable});return e};var n=(e,a,i)=>(i=e!=null?u(v(e)):{},f(a||!e||!e.__esModule?c(i,"default",{value:e,enumerable:!0}):i,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("./getGraphList-CA17dvFB.cjs"),l=require("./getSchema.cjs");async function g(e,a){let i;try{i=(await import("ajv")).default}catch(t){throw console.error(t),new Error("AJV is not installed. Please install it to use runtime validation.")}const o=new i({allErrors:!0,allowUnionTypes:!0});if(S.graphList.filter(t=>t.geoHubMapPresentation).map(t=>t.graphID).indexOf(a)!==-1)return{isValid:!0,err:void 0};if(!e)return{isValid:!1,err:"No data provided"};if(a==="dataTable"||a==="dataCards"||e.length===0)return{isValid:!0,err:void 0};const r=await l.getDataSchema(a);if(!r)return{isValid:!1,err:`Invalid chart type: ${a}`};const s=o.compile(r);return s(e)?{isValid:!0,err:void 0}:(console.error(s.errors),{isValid:!1,err:s.errors?.map(t=>`Error at ${t.instancePath}: ${t.message}`).join("; ")})}async function w(e,a){let i;try{i=(await import("ajv")).default}catch(t){throw console.error(t),new Error("AJV is not installed. Please install it to use runtime validation.")}const o=new i({allErrors:!0,allowUnionTypes:!0}),r=await l.getSettingsSchema(a);if(!r)return{isValid:!1,err:`Invalid chart type: ${a}`};const s=o.compile(r);return s(e)?{isValid:!0,err:void 0}:(console.error(s.errors),{isValid:!1,err:s.errors?.map(t=>`Error at ${t.instancePath}: ${t.message}`).join("; ")})}async function y(e,a){let i;try{i=(await import("ajv")).default}catch(t){throw console.error(t),new Error("AJV is not installed. Please install it to use runtime validation.")}const o=new i({allErrors:!0,allowUnionTypes:!0});let r;switch(a){case"griddedGraph":r=l.getGriddedGraphJSONSchema(void 0,e.graphType);break;case"multiGraphDashboard":r=l.getDashboardJSONSchema();break;case"singleGraphDashboard":r=l.getSingleGraphJSONSchema(void 0,e.graphType);break;case"multiGraphDashboardWideToLongFormat":r=l.getDashboardWideToLongFormatJSONSchema();break}if(!r)return{isValid:!1,err:`Invalid chart type: ${a}`};const s=o.compile(r);return s(e)?{isValid:!0,err:void 0}:(console.error(s.errors),{isValid:!1,err:s.errors?.map(t=>`Error at ${t.instancePath}: ${t.message}`).join("; ")})}exports.validateConfigSchema=y;exports.validateDataSchema=g;exports.validateSettingsSchema=w;
|
|
2
2
|
//# sourceMappingURL=validateSchema.cjs.map
|
package/dist/validateSchema.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as n } from "./getGraphList-
|
|
1
|
+
import { g as n } from "./getGraphList-Dxwo9TDb.js";
|
|
2
2
|
import { getDataSchema as d, getSettingsSchema as c, getDashboardWideToLongFormatJSONSchema as u, getSingleGraphJSONSchema as m, getDashboardJSONSchema as h, getGriddedGraphJSONSchema as v } from "./getSchema.js";
|
|
3
3
|
async function w(i, a) {
|
|
4
4
|
let o;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getGraphList-gf02xgT2.cjs","sources":["../src/Utils/getGraphList.ts"],"sourcesContent":["export const graphList = [\r\n {\r\n graphName: 'Bar graph',\r\n graphID: 'barChart',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: true,\r\n },\r\n {\r\n graphName: 'Stacked bar graph',\r\n graphID: 'stackedBarChart',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'Grouped bar graph',\r\n graphID: 'groupedBarChart',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'Bee swarm chart',\r\n graphID: 'beeSwarmChart',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'Butterfly chart',\r\n graphID: 'butterflyChart',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'Bullet chart',\r\n graphID: 'bulletChart',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'Circle packing',\r\n graphID: 'circlePacking',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: true,\r\n },\r\n {\r\n graphName: 'Data table',\r\n graphID: 'dataTable',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'Pie/donut chart',\r\n graphID: 'donutChart',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: true,\r\n },\r\n {\r\n graphName: 'Dumbbell chart',\r\n graphID: 'dumbbellChart',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'Heat map',\r\n graphID: 'heatMap',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'Histogram',\r\n graphID: 'histogram',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'Line chart',\r\n graphID: 'lineChart',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'Multi-line chart',\r\n graphID: 'multiLineChart',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'Multi-line chart alternative',\r\n graphID: 'multiLineAltChart',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'Difference line chart',\r\n graphID: 'differenceLineChart',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'Dual-axes line chart',\r\n graphID: 'dualAxisLineChart',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'Line chart with interval',\r\n graphID: 'lineChartWithConfidenceInterval',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'Spark line',\r\n graphID: 'sparkLine',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'Choropleth map',\r\n graphID: 'choroplethMap',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'Three-D globe',\r\n graphID: 'threeDGlobe',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'Bi-variate choropleth map',\r\n graphID: 'biVariateChoroplethMap',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'Dot density map',\r\n graphID: 'dotDensityMap',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'GeoHub map with comparison',\r\n graphID: 'geoHubCompareMap',\r\n availableInGriddedGraph: false,\r\n geoHubMapPresentation: true,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'GeoHub map',\r\n graphID: 'geoHubMap',\r\n availableInGriddedGraph: false,\r\n geoHubMapPresentation: true,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'GeoHub map with layer selection',\r\n graphID: 'geoHubMapWithLayerSelection',\r\n availableInGriddedGraph: false,\r\n geoHubMapPresentation: true,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'Pareto chart',\r\n graphID: 'paretoChart',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'Scatter plot',\r\n graphID: 'scatterPlot',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'Slope chart',\r\n graphID: 'slopeChart',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'Stacked area chart/area chart',\r\n graphID: 'stackedAreaChart',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'Statistic card',\r\n graphID: 'statCard',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'Strip chart',\r\n graphID: 'stripChart',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'Tree map',\r\n graphID: 'treeMap',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: true,\r\n },\r\n {\r\n graphName: 'Unit chart',\r\n graphID: 'unitChart',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: true,\r\n },\r\n {\r\n graphName: 'Sankey chart',\r\n graphID: 'sankeyChart',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'Data cards list',\r\n graphID: 'dataCards',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: false,\r\n },\r\n {\r\n graphName: 'Radar chart',\r\n graphID: 'radarChart',\r\n availableInGriddedGraph: true,\r\n geoHubMapPresentation: false,\r\n availableInWideToLongFormat: false,\r\n },\r\n];\r\n"],"names":["graphList","graphName","graphID","availableInGriddedGraph","geoHubMapPresentation","availableInWideToLongFormat"],"mappings":"aAAO,MAAMA,EAAY,CACvB,CACEC,UAAW,YACXC,QAAS,WACTC,wBAAyB,GACzBC,sBAAuB,GACvBC,4BAA6B,EAC/B,EACA,CACEJ,UAAW,oBACXC,QAAS,kBAC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zBC,sBAAuB,GACvBC,4BAA6B,EAC/B,EACA,CACEJ,UAAW,cACXC,QAAS,aACTC,wBAAyB,GACzBC,sBAAuB,GACvBC,4BAA6B,EAC/B,EACA,CACEJ,UAAW,WACXC,QAAS,UACTC,wBAAyB,GACzBC,sBAAuB,GACvBC,4BAA6B,EAC/B,EACA,CACEJ,UAAW,aACXC,QAAS,YACTC,wBAAyB,GACzBC,sBAAuB,GACvBC,4BAA6B,EAC/B,EACA,CACEJ,UAAW,eACXC,QAAS,cACTC,wBAAyB,GACzBC,sBAAuB,GACvBC,4BAA6B,EAC/B,EACA,CACEJ,UAAW,kBACXC,QAAS,YACTC,wBAAyB,GACzBC,sBAAuB,GACvBC,4BAA6B,EAC/B,EACA,CACEJ,UAAW,cACXC,QAAS,aACTC,wBAAyB,GACzBC,sBAAuB,GACvBC,4BAA6B,EAC/B,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { f as o } from "./index-EArKRVKg.js";
|
|
2
|
-
function s(n, r) {
|
|
3
|
-
return n.length === 0 ? [] : typeof n[0][r] != "object" ? [...new Set(n.map((e) => e[r]))].sort((e, u) => e < u ? -1 : e > u ? 1 : 0) : [...new Set(o(n.map((t) => t[r])))].sort(
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
|
-
(t, e) => t < e ? -1 : t > e ? 1 : 0
|
|
6
|
-
);
|
|
7
|
-
}
|
|
8
|
-
export {
|
|
9
|
-
s as g
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=getUniqValue-BKHCm3zE.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getUniqValue-BKHCm3zE.js","sources":["../src/Utils/getUniqValue.ts"],"sourcesContent":["import flattenDeep from 'lodash.flattendeep';\r\n\r\n/**\r\n * Extracts unique values from a specified column in a CSV dataset.\r\n *\r\n * If the column contains non-object values, it extracts the unique values from that column, sorts them, and returns them.\r\n * If the column contains object values (e.g., arrays), it flattens the values before extracting and returning the unique values.\r\n *\r\n * @param csvData - The CSV dataset, represented as an array of objects.\r\n * @param column - The column name from which to extract unique values.\r\n *\r\n * @returns An array of unique values from the specified column, sorted in ascending order.\r\n *\r\n * @example\r\n * const csvData = [{ name: 'Alice' }, { name: 'Bob' }, { name: 'Alice' }];\r\n * getUniqValue(csvData, 'name'); // Returns: ['Alice', 'Bob']\r\n */\r\nexport function getUniqValue(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n csvData: any,\r\n column: string,\r\n) {\r\n if (csvData.length === 0) return [];\r\n if (typeof csvData[0][column] !== 'object') {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const uniqValues = [...new Set(csvData.map((d: any) => d[column]))].sort((a: any, b: any) =>\r\n a < b ? -1 : a > b ? 1 : 0,\r\n );\r\n return uniqValues as (string | number)[];\r\n }\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const values = [...new Set(flattenDeep(csvData.map((d: any) => d[column])))].sort(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (a: any, b: any) => (a < b ? -1 : a > b ? 1 : 0),\r\n );\r\n return values as (string | number)[];\r\n}\r\n"],"names":["getUniqValue","csvData","column","length","Set","map","d","sort","a","b","flattenDeep"],"mappings":";AAiBO,SAASA,EAEdC,GACAC,GACA;AACA,SAAID,EAAQE,WAAW,IAAU,CAAA,IAC7B,OAAOF,EAAQ,CAAC,EAAEC,CAAM,KAAM,WAEb,CAAC,GAAG,IAAIE,IAAIH,EAAQI,IAAI,CAACC,MAAWA,EAAEJ,CAAM,CAAC,CAAC,CAAC,EAAEK,KAAK,CAACC,GAAQC,MAChFD,IAAIC,IAAI,KAAKD,IAAIC,IAAI,IAAI,CAC3B,IAIa,CAAC,GAAG,IAAIL,IAAIM,EAAYT,EAAQI,IAAI,CAACC,MAAWA,EAAEJ,CAAM,CAAC,CAAC,CAAC,CAAC,EAAEK;AAAAA;AAAAA,IAE3E,CAACC,GAAQC,MAAYD,IAAIC,IAAI,KAAKD,IAAIC,IAAI,IAAI;AAAA,EAAA;AAGlD;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const i=require("./index-BS2TADPj.cjs");function s(n,u){return n.length===0?[]:typeof n[0][u]!="object"?[...new Set(n.map(e=>e[u]))].sort((e,r)=>e<r?-1:e>r?1:0):[...new Set(i.flattenDeep(n.map(t=>t[u])))].sort((t,e)=>t<e?-1:t>e?1:0)}exports.getUniqValue=s;
|
|
2
|
-
//# sourceMappingURL=getUniqValue-RViz8tTw.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getUniqValue-RViz8tTw.cjs","sources":["../src/Utils/getUniqValue.ts"],"sourcesContent":["import flattenDeep from 'lodash.flattendeep';\r\n\r\n/**\r\n * Extracts unique values from a specified column in a CSV dataset.\r\n *\r\n * If the column contains non-object values, it extracts the unique values from that column, sorts them, and returns them.\r\n * If the column contains object values (e.g., arrays), it flattens the values before extracting and returning the unique values.\r\n *\r\n * @param csvData - The CSV dataset, represented as an array of objects.\r\n * @param column - The column name from which to extract unique values.\r\n *\r\n * @returns An array of unique values from the specified column, sorted in ascending order.\r\n *\r\n * @example\r\n * const csvData = [{ name: 'Alice' }, { name: 'Bob' }, { name: 'Alice' }];\r\n * getUniqValue(csvData, 'name'); // Returns: ['Alice', 'Bob']\r\n */\r\nexport function getUniqValue(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n csvData: any,\r\n column: string,\r\n) {\r\n if (csvData.length === 0) return [];\r\n if (typeof csvData[0][column] !== 'object') {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const uniqValues = [...new Set(csvData.map((d: any) => d[column]))].sort((a: any, b: any) =>\r\n a < b ? -1 : a > b ? 1 : 0,\r\n );\r\n return uniqValues as (string | number)[];\r\n }\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const values = [...new Set(flattenDeep(csvData.map((d: any) => d[column])))].sort(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (a: any, b: any) => (a < b ? -1 : a > b ? 1 : 0),\r\n );\r\n return values as (string | number)[];\r\n}\r\n"],"names":["getUniqValue","csvData","column","length","Set","map","d","sort","a","b","flattenDeep"],"mappings":"qDAiBO,SAASA,EAEdC,EACAC,EACA,CACA,OAAID,EAAQE,SAAW,EAAU,CAAA,EAC7B,OAAOF,EAAQ,CAAC,EAAEC,CAAM,GAAM,SAEb,CAAC,GAAG,IAAIE,IAAIH,EAAQI,IAAKC,GAAWA,EAAEJ,CAAM,CAAC,CAAC,CAAC,EAAEK,KAAK,CAACC,EAAQC,IAChFD,EAAIC,EAAI,GAAKD,EAAIC,EAAI,EAAI,CAC3B,EAIa,CAAC,GAAG,IAAIL,IAAIM,EAAAA,YAAYT,EAAQI,IAAKC,GAAWA,EAAEJ,CAAM,CAAC,CAAC,CAAC,CAAC,EAAEK,KAE3E,CAACC,EAAQC,IAAYD,EAAIC,EAAI,GAAKD,EAAIC,EAAI,EAAI,CAAA,CAGlD"}
|