|
@@ -17,7 +17,7 @@ import { appEvents, coreModule, updateLegendValues } from 'app/core/core';
|
|
|
import GraphTooltip from './graph_tooltip';
|
|
import GraphTooltip from './graph_tooltip';
|
|
|
import { ThresholdManager } from './threshold_manager';
|
|
import { ThresholdManager } from './threshold_manager';
|
|
|
import { EventManager } from 'app/features/annotations/all';
|
|
import { EventManager } from 'app/features/annotations/all';
|
|
|
-import { convertValuesToHistogram, getSeriesValues } from './histogram';
|
|
|
|
|
|
|
+import { convertToHistogramData } from './histogram';
|
|
|
import config from 'app/core/config';
|
|
import config from 'app/core/config';
|
|
|
|
|
|
|
|
/** @ngInject **/
|
|
/** @ngInject **/
|
|
@@ -236,15 +236,15 @@ function graphDirective(timeSrv, popoverSrv, contextSrv) {
|
|
|
}
|
|
}
|
|
|
case 'histogram': {
|
|
case 'histogram': {
|
|
|
let bucketSize: number;
|
|
let bucketSize: number;
|
|
|
- let values = getSeriesValues(data);
|
|
|
|
|
|
|
|
|
|
- if (data.length && values.length) {
|
|
|
|
|
|
|
+ if (data.length) {
|
|
|
let histMin = _.min(_.map(data, s => s.stats.min));
|
|
let histMin = _.min(_.map(data, s => s.stats.min));
|
|
|
let histMax = _.max(_.map(data, s => s.stats.max));
|
|
let histMax = _.max(_.map(data, s => s.stats.max));
|
|
|
let ticks = panel.xaxis.buckets || panelWidth / 50;
|
|
let ticks = panel.xaxis.buckets || panelWidth / 50;
|
|
|
bucketSize = tickStep(histMin, histMax, ticks);
|
|
bucketSize = tickStep(histMin, histMax, ticks);
|
|
|
- let histogram = convertValuesToHistogram(values, bucketSize);
|
|
|
|
|
- data[0].data = histogram;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ data = convertToHistogramData(data, bucketSize, ctrl.hiddenSeries, panel.stack, histMin, histMax);
|
|
|
|
|
+
|
|
|
options.series.bars.barWidth = bucketSize * 0.8;
|
|
options.series.bars.barWidth = bucketSize * 0.8;
|
|
|
} else {
|
|
} else {
|
|
|
bucketSize = 0;
|
|
bucketSize = 0;
|
|
@@ -413,7 +413,13 @@ function graphDirective(timeSrv, popoverSrv, contextSrv) {
|
|
|
let defaultTicks = panelWidth / 50;
|
|
let defaultTicks = panelWidth / 50;
|
|
|
|
|
|
|
|
if (data.length && bucketSize) {
|
|
if (data.length && bucketSize) {
|
|
|
- ticks = _.map(data[0].data, point => point[0]);
|
|
|
|
|
|
|
+ let tick_values = [];
|
|
|
|
|
+ for (let d of data) {
|
|
|
|
|
+ for (let point of d.data) {
|
|
|
|
|
+ tick_values[point[0]] = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ ticks = Object.keys(tick_values).map(v => Number(v));
|
|
|
min = _.min(ticks);
|
|
min = _.min(ticks);
|
|
|
max = _.max(ticks);
|
|
max = _.max(ticks);
|
|
|
|
|
|