@forter/chart
Advanced tools
Comparing version 5.31.3 to 5.31.4
@@ -6,2 +6,13 @@ # Change Log | ||
## [5.31.4](https://github.com/forter/web-components/compare/@forter/chart@5.31.3...@forter/chart@5.31.4) (2023-02-08) | ||
### Bug Fixes | ||
* **chart:** sankey invalid label and tooltip data ([#1211](https://github.com/forter/web-components/issues/1211)) ([d5117e8](https://github.com/forter/web-components/commit/d5117e8)) | ||
## [5.31.3](https://github.com/forter/web-components/compare/@forter/chart@5.31.2...@forter/chart@5.31.3) (2023-02-06) | ||
@@ -8,0 +19,0 @@ |
@@ -58,3 +58,5 @@ import { merge } from 'lodash-es'; | ||
to: label, | ||
flow: Math.max(value, minVisualNodeVolume) | ||
flow: Math.max(value, minVisualNodeVolume), | ||
yFormatted: formatNumber(value), | ||
rawValue: value | ||
}]; | ||
@@ -142,2 +144,6 @@ }, []); | ||
const rawLabels = data.reduce((result, dataPoint) => { | ||
if (dataPoint.parent) { | ||
return result; | ||
} | ||
return { ...result, | ||
@@ -168,14 +174,17 @@ [dataPoint.label]: dataPoint.value | ||
const createdFlow = createFlow(); | ||
const createLabels = () => { | ||
const otherLabels = others.reduce((result, { | ||
to, | ||
yFormatted: volume | ||
}) => { | ||
return { ...result, | ||
[to]: volume | ||
}; | ||
const combinedNodeValues = createdFlow.reduce((result, dataPoint) => { | ||
const { | ||
to, | ||
rawValue | ||
} = dataPoint; | ||
result[to] = (result[to] || 0) + rawValue; | ||
return result; | ||
}, {}); | ||
return Object.entries({ ...rawLabels, | ||
...otherLabels | ||
}).reduce((result, [key, val]) => { | ||
const nodes = { ...rawLabels, | ||
...combinedNodeValues | ||
}; | ||
return Object.entries(nodes).reduce((result, [key, val]) => { | ||
const formattedKey = isOthersNode(key) ? 'other' : key; | ||
@@ -189,3 +198,3 @@ return { ...result, | ||
return { | ||
flowData: [...accumulator.flowData, ...createFlow()], | ||
flowData: [...accumulator.flowData, ...createdFlow], | ||
flowLabels: { ...accumulator.flowLabels, | ||
@@ -192,0 +201,0 @@ ...createLabels() |
{ | ||
"name": "@forter/chart", | ||
"version": "5.31.3", | ||
"version": "5.31.4", | ||
"description": "chart from Forter Components", | ||
@@ -61,3 +61,3 @@ "author": "Forter Developers", | ||
}, | ||
"gitHead": "cadf120bc638570884fd6a350371eb9575afbf14" | ||
"gitHead": "816d3952865606a12a160e1673ecbc1f37fb24f0" | ||
} |
@@ -55,3 +55,5 @@ import { merge } from 'lodash-es'; | ||
to: label, | ||
flow: Math.max(value, minVisualNodeVolume) | ||
flow: Math.max(value, minVisualNodeVolume), | ||
yFormatted: formatNumber(value), | ||
rawValue: value | ||
}]; | ||
@@ -122,2 +124,5 @@ }, []); | ||
const rawLabels = data.reduce((result, dataPoint) => { | ||
if (dataPoint.parent) { | ||
return result; | ||
} | ||
return { ...result, [dataPoint.label]: dataPoint.value }; | ||
@@ -143,7 +148,14 @@ }, calculateChildParentConnections(data)); | ||
const createdFlow = createFlow(); | ||
const createLabels = () => { | ||
const otherLabels = others.reduce((result, { to, yFormatted: volume }) => { | ||
return { ...result, [to]: volume }; | ||
const combinedNodeValues = createdFlow.reduce((result, dataPoint) => { | ||
const { to, rawValue } = dataPoint; | ||
result[to] = (result[to] || 0) + rawValue; | ||
return result; | ||
}, {}); | ||
return Object.entries({ ...rawLabels, ...otherLabels }).reduce((result, [key, val]) => { | ||
const nodes = { ...rawLabels, ...combinedNodeValues }; | ||
return Object.entries(nodes).reduce((result, [key, val]) => { | ||
const formattedKey = isOthersNode(key) ? 'other' : key; | ||
@@ -155,3 +167,3 @@ return { ...result, [key]: `${formattedKey.toUpperCase()} ${formatNumber(val)}` }; | ||
return { | ||
flowData: [...accumulator.flowData, ...createFlow()], | ||
flowData: [...accumulator.flowData, ...createdFlow], | ||
flowLabels: { ...accumulator.flowLabels, ...createLabels() } | ||
@@ -158,0 +170,0 @@ }; |
Sorry, the diff of this file is not supported yet
335631
5389