mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
parent
15fe58f193
commit
7521d2bba0
@ -2,7 +2,7 @@ import * as d3 from 'd3';
|
|||||||
import $ from 'jquery';
|
import $ from 'jquery';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { getValueBucketBound } from './heatmap_data_converter';
|
import { getValueBucketBound } from './heatmap_data_converter';
|
||||||
import { getValueFormat } from '@grafana/data';
|
import { getValueFormat, formattedValueToString } from '@grafana/data';
|
||||||
|
|
||||||
const TOOLTIP_PADDING_X = 30;
|
const TOOLTIP_PADDING_X = 30;
|
||||||
const TOOLTIP_PADDING_Y = 5;
|
const TOOLTIP_PADDING_Y = 5;
|
||||||
@ -273,9 +273,9 @@ export class HeatmapTooltip {
|
|||||||
}
|
}
|
||||||
|
|
||||||
countValueFormatter(decimals: number, scaledDecimals: any = null) {
|
countValueFormatter(decimals: number, scaledDecimals: any = null) {
|
||||||
const format = 'short';
|
const fmt = getValueFormat('short');
|
||||||
return (value: number) => {
|
return (value: number) => {
|
||||||
return getValueFormat(format)(value, decimals, scaledDecimals);
|
return formattedValueToString(fmt(value, decimals, scaledDecimals));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,14 @@ import * as ticksUtils from 'app/core/utils/ticks';
|
|||||||
import { HeatmapTooltip } from './heatmap_tooltip';
|
import { HeatmapTooltip } from './heatmap_tooltip';
|
||||||
import { mergeZeroBuckets } from './heatmap_data_converter';
|
import { mergeZeroBuckets } from './heatmap_data_converter';
|
||||||
import { getColorScale, getOpacityScale } from './color_scale';
|
import { getColorScale, getOpacityScale } from './color_scale';
|
||||||
import { toUtc, PanelEvents, GrafanaThemeType, getColorFromHexRgbOrName, getValueFormat } from '@grafana/data';
|
import {
|
||||||
|
toUtc,
|
||||||
|
PanelEvents,
|
||||||
|
GrafanaThemeType,
|
||||||
|
getColorFromHexRgbOrName,
|
||||||
|
getValueFormat,
|
||||||
|
formattedValueToString,
|
||||||
|
} from '@grafana/data';
|
||||||
import { CoreEvents } from 'app/types';
|
import { CoreEvents } from 'app/types';
|
||||||
|
|
||||||
const MIN_CARD_SIZE = 1,
|
const MIN_CARD_SIZE = 1,
|
||||||
@ -441,11 +448,14 @@ export class HeatmapRenderer {
|
|||||||
const format = this.panel.yAxis.format;
|
const format = this.panel.yAxis.format;
|
||||||
return (value: any) => {
|
return (value: any) => {
|
||||||
try {
|
try {
|
||||||
return format !== 'none' ? getValueFormat(format)(value, decimals, scaledDecimals) : value;
|
if (format !== 'none') {
|
||||||
|
const v = getValueFormat(format)(value, decimals, scaledDecimals);
|
||||||
|
return formattedValueToString(v);
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err.message || err);
|
console.error(err.message || err);
|
||||||
return value;
|
|
||||||
}
|
}
|
||||||
|
return value;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user