diff --git a/package.json b/package.json index 8b7e0e9f..7a73a9a4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@netdata/charts", - "version": "5.3.10", + "version": "5.3.11", "description": "Netdata frontend SDK and chart utilities", "main": "dist/index.js", "module": "dist/es6/index.js", diff --git a/src/sdk/makeChart/makeDimensions.js b/src/sdk/makeChart/makeDimensions.js index 361af2ec..052c41a3 100644 --- a/src/sdk/makeChart/makeDimensions.js +++ b/src/sdk/makeChart/makeDimensions.js @@ -114,6 +114,15 @@ export default (chart, sdk) => { }, } + const alwaysSort = { + valueDesc: true, + valueAsc: true, + anomalyDesc: true, + anomalyAsc: true, + annotationsDesc: true, + annotationsAsc: true, + } + const updateVisibleDimensions = () => { const selectedLegendDimensions = chart.getAttribute("selectedLegendDimensions") @@ -136,6 +145,7 @@ export default (chart, sdk) => { const dimensionsSort = chart.getAttribute("dimensionsSort") const sort = bySortMethod[dimensionsSort] || bySortMethod.default sortedDimensionIds = sort() + updateVisibleDimensions() if (!sortedDimensionIds) return @@ -167,7 +177,10 @@ export default (chart, sdk) => { chart.updateDimensions = () => { const dimensionIds = chart.getPayloadDimensionIds() - if (deepEqual(prevDimensionIds, dimensionIds)) return + if (deepEqual(prevDimensionIds, dimensionIds)) { + if (alwaysSort[chart.getAttribute("dimensionsSort")]) chart.sortDimensions() + return + } prevDimensionIds = dimensionIds