Skip to content

Commit b99a854

Browse files
committed
v5.5.2
1 parent a0054bc commit b99a854

File tree

6 files changed

+24
-12
lines changed

6 files changed

+24
-12
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@netdata/charts",
3-
"version": "5.5.1",
3+
"version": "5.5.2",
44
"description": "Netdata frontend SDK and chart utilities",
55
"main": "dist/index.js",
66
"module": "dist/es6/index.js",

src/chartLibraries/dygraph/index.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,10 @@ export default (sdk, chart) => {
244244
}
245245
return chart.getConvertedValue(y) // TODO Pass { dimensionId: context.id } when multiple contexts with different units
246246
},
247-
makeYTicker: () => numericTicker,
247+
makeYTicker:
248+
(options = {}) =>
249+
(a, b, pixels, opts, dygraph, vals) =>
250+
numericTicker(a, b, pixels, opts, dygraph, vals, options),
248251
highlightCircleSize: 4,
249252
}
250253

@@ -286,8 +289,10 @@ export default (sdk, chart) => {
286289
const value = parseFloat(parseFloat(y).toFixed(5))
287290
return isNaN(value) ? y : value
288291
},
289-
makeYTicker: labels => (a, b, pixels, opts, dygraph) =>
290-
heatmapTicker(a, b, pixels, opts, dygraph, labels),
292+
makeYTicker:
293+
(options = {}) =>
294+
(a, b, pixels, opts, dygraph, vals) =>
295+
heatmapTicker(a, b, pixels, opts, dygraph, vals, options),
291296
highlightCircleSize: 0,
292297
},
293298
default: {
@@ -316,7 +321,9 @@ export default (sdk, chart) => {
316321
} = optionsByChartType[chartType] || optionsByChartType.default
317322

318323
const yAxisLabelFormatter = makeYAxisLabelFormatter(labels)
319-
const yTicker = makeYTicker ? makeYTicker(chart.getVisibleDimensionIds()) : null
324+
const yTicker = makeYTicker
325+
? makeYTicker({ labels: chart.getVisibleDimensionIds(), units: chart.getUnits() })
326+
: null
320327

321328
const { selectedLegendDimensions } = chart.getAttributes()
322329
const dimensionIds = chart.getPayloadDimensionIds()

src/chartLibraries/dygraph/tickers/heatmap.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { withoutPrefix } from "@/helpers/heatmap"
22

3-
export default (a, b, pixels, opts, dygraph, vals) => {
4-
const labels = vals.map(withoutPrefix)
3+
export default (a, b, pixels, opts, dygraph, vals, { labels: defaultLabels } = {}) => {
4+
const labels = defaultLabels.map(withoutPrefix)
55

66
const pixelsPerTick = opts("pixelsPerLabel")
77
const maxTicks = Math.floor(pixels / pixelsPerTick)
88

99
const formatLabel = opts("axisLabelFormatter")
1010

11-
const hiddenStep = Math.ceil(vals.length / (maxTicks - 1))
11+
const hiddenStep = Math.ceil(defaultLabels.length / (maxTicks - 1))
1212
const ticks = labels.map((l, i) => ({
1313
v: i,
1414
label: i % hiddenStep === 0 ? formatLabel(labels[i], 0, opts, dygraph) : null,

src/chartLibraries/dygraph/tickers/numeric.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import { isBinary } from "@/helpers/units"
2+
13
const anomalySVG = `<div title="Anomaly detection percent (%)"><svg width="15" height="16" view-box="0 0 15 16" xmlns="http://www.w3.org/2000/svg" fill="#B596F8" fill-opacity="0.4" transform="translate(18, -1) scale(0.6)">
24
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.228 3.29597L8.522 0.578973C8.167 0.373973 7.771 0.271973 7.375 0.271973C6.979 0.271973 6.583 0.373973 6.228 0.578973L1.522 3.29597C0.812 3.70597 0.375 4.46297 0.375 5.28297V10.718C0.375 11.537 0.812 12.295 1.522 12.704L6.228 15.421C6.583 15.626 6.979 15.728 7.375 15.728C7.771 15.728 8.167 15.626 8.522 15.421L13.228 12.704C13.938 12.294 14.375 11.537 14.375 10.718V5.28297C14.375 4.46297 13.938 3.70597 13.228 3.29597ZM7.97949 4.76094L7.37505 3.23265L6.7706 4.76094L4.93313 9.40688H4.37505H1.37505V10.7069H4.37505H5.37505H5.81696L5.97949 10.2959L7.37505 6.76735L8.7706 10.2959L9.26618 11.549L9.93839 10.3811L10.375 9.62253L10.8117 10.3811L10.9992 10.7069H11.375H13.375V9.40688H11.7509L10.9384 7.99531L10.375 7.01662L9.8117 7.99531L9.48391 8.56479L7.97949 4.76094Z" />
35
</svg></div>`
46

5-
export default (a, b, pixels, opts, dygraph, vals) => {
7+
export default (a, b, pixels, opts, dygraph, vals, { units } = {}) => {
68
const pixelsPerTick = opts("pixelsPerLabel")
79
let ticks = []
810
let i, j, tickV, nTicks
@@ -13,8 +15,10 @@ export default (a, b, pixels, opts, dygraph, vals) => {
1315
}
1416
} else {
1517
if (ticks.length === 0) {
16-
const mults = [1, 2, 5, 10, 20, 50, 100]
17-
const base = 10
18+
const mults = isBinary(units[0])
19+
? [1, 2, 4, 8, 16, 32, 64, 128, 256]
20+
: [1, 2, 5, 10, 20, 50, 100]
21+
const base = isBinary(units[0]) ? 1024 : 10
1822

1923
// Get the maximum number of permitted ticks based on the
2024
// graph's pixel size and pixelsPerTick setting.

src/components/filterToolbox/aggregate.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ const Aggregate = ({ labelProps, defaultMinimal, ...rest }) => {
8181
dropTitle={dropTitle}
8282
{...rest}
8383
labelProps={{
84+
chevron: !isMinimal && !defaultMinimal,
8485
secondaryLabel: isMinimal || defaultMinimal ? "" : "the",
8586
label: isMinimal || defaultMinimal ? icon : short,
8687
title: tooltipProps.heading,

src/components/hocs/withTile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export const HeadWrapper = ({ children, customChildren, hasFilters = true, ...re
9494
{hasToolbox && focused && debouncedFocused && (
9595
<Toolbox
9696
position="absolute"
97-
top="-16px"
97+
top="-14px"
9898
right="0"
9999
background="mainChartHeaderBg"
100100
width={{ min: "100%" }}

0 commit comments

Comments
 (0)