mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
using field formatters for heatmap legend (#10529)
* using field formatters for heatmap legend * fixing test
This commit is contained in:
parent
d38e3c260e
commit
7084d5573f
2 changed files with 10 additions and 6 deletions
|
@ -44,13 +44,15 @@ export default function HeatmapChartFactory(Private) {
|
|||
const percentageMode = cfg.get('percentageMode');
|
||||
const colorsNumber = cfg.get('colorsNumber');
|
||||
const colorsRange = cfg.get('colorsRange');
|
||||
const zAxisConfig = this.getValueAxis().axisConfig;
|
||||
const zAxisFormatter = zAxisConfig.get('labels.axisFormatter');
|
||||
const zScale = this.getValueAxis().getScale();
|
||||
const [min, max] = zScale.domain();
|
||||
const labels = [];
|
||||
if (cfg.get('setColorRange')) {
|
||||
colorsRange.forEach(range => {
|
||||
const from = range.from;
|
||||
const to = range.to;
|
||||
const from = isFinite(range.from) ? zAxisFormatter(range.from) : range.from;
|
||||
const to = isFinite(range.to) ? zAxisFormatter(range.to) : range.to;
|
||||
labels.push(`${from} - ${to}`);
|
||||
});
|
||||
} else {
|
||||
|
@ -69,6 +71,8 @@ export default function HeatmapChartFactory(Private) {
|
|||
val = Math.ceil(val);
|
||||
nextVal = Math.ceil(nextVal);
|
||||
}
|
||||
if (isFinite(val)) val = zAxisFormatter(val);
|
||||
if (isFinite(nextVal)) nextVal = zAxisFormatter(nextVal);
|
||||
label = `${val} - ${nextVal}`;
|
||||
}
|
||||
|
||||
|
|
|
@ -74,10 +74,10 @@ bdd.describe('visualize app', function describeIndexTests() {
|
|||
});
|
||||
|
||||
bdd.it('should show correct chart, take screenshot', function () {
|
||||
const expectedChartValues = ['0 - 400', '0 - 400', '400 - 800', '1200 - 1600',
|
||||
'1200 - 1600', '400 - 800', '0 - 400', '0 - 400', '0 - 400', '0 - 400', '400 - 800',
|
||||
'1200 - 1600', '1200 - 1600', '400 - 800', '0 - 400', '0 - 400', '0 - 400', '0 - 400',
|
||||
'400 - 800', '1200 - 1600', '1200 - 1600', '400 - 800', '0 - 400', '0 - 400' ];
|
||||
const expectedChartValues = ['0 - 400', '0 - 400', '400 - 800', '1,200 - 1,600',
|
||||
'1,200 - 1,600', '400 - 800', '0 - 400', '0 - 400', '0 - 400', '0 - 400', '400 - 800',
|
||||
'1,200 - 1,600', '1,200 - 1,600', '400 - 800', '0 - 400', '0 - 400', '0 - 400', '0 - 400',
|
||||
'400 - 800', '1,200 - 1,600', '1,200 - 1,600', '400 - 800', '0 - 400', '0 - 400' ];
|
||||
|
||||
// Most recent failure on Jenkins usually indicates the bar chart is still being drawn?
|
||||
// return arguments[0].getAttribute(arguments[1]);","args":[{"ELEMENT":"592"},"fill"]}] arguments[0].getAttribute is not a function
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue