Skip to content

Commit

Permalink
v5.3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
novykh committed Sep 27, 2024
1 parent 8fa1ef8 commit ececee8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
15 changes: 14 additions & 1 deletion src/sdk/makeChart/makeDimensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit ececee8

Please sign in to comment.