heatmp: removed series stats option, lacked tests

This commit is contained in:
Torkel Ödegaard
2017-05-05 17:33:54 +02:00
parent ece21b2d95
commit fbf39598b8
4 changed files with 25 additions and 48 deletions

View File

@@ -46,7 +46,6 @@ let panelDefaults = {
yBucketNumber: null, yBucketNumber: null,
tooltip: { tooltip: {
show: true, show: true,
seriesStat: false,
showHistogram: false showHistogram: false
}, },
highlightCards: true highlightCards: true

View File

@@ -60,7 +60,6 @@ function convertToCards(buckets) {
yBounds: yBucket.bounds, yBounds: yBucket.bounds,
values: yBucket.values, values: yBucket.values,
count: yBucket.count, count: yBucket.count,
seriesStat: getSeriesStat(yBucket.points)
}; };
cards.push(card); cards.push(card);
}); });
@@ -145,15 +144,6 @@ function removeZeroBuckets(buckets) {
return buckets; return buckets;
} }
/**
* Count values number for each timeseries in given bucket
* @param {Array} points Bucket's datapoints with series name ([val, ts, series_name])
* @return {Object} seriesStat: {seriesName_1: val_1, seriesName_2: val_2}
*/
function getSeriesStat(points) {
return _.countBy(points, p => p[2]);
}
/** /**
* Convert set of time series into heatmap buckets * Convert set of time series into heatmap buckets
* @return {Object} Heatmap object: * @return {Object} Heatmap object:

View File

@@ -87,7 +87,8 @@ export class HeatmapTooltip {
let tooltipHtml = `<div class="graph-tooltip-time">${time}</div> let tooltipHtml = `<div class="graph-tooltip-time">${time}</div>
<div class="heatmap-histogram"></div>`; <div class="heatmap-histogram"></div>`;
if (yData && yData.bounds) { if (yData) {
if (yData.bounds) {
boundBottom = valueFormatter(yData.bounds.bottom); boundBottom = valueFormatter(yData.bounds.bottom);
boundTop = valueFormatter(yData.bounds.top); boundTop = valueFormatter(yData.bounds.top);
valuesNumber = yData.count; valuesNumber = yData.count;
@@ -95,9 +96,9 @@ export class HeatmapTooltip {
bucket: <b>${boundBottom} - ${boundTop}</b> <br> bucket: <b>${boundBottom} - ${boundTop}</b> <br>
count: <b>${valuesNumber}</b> <br> count: <b>${valuesNumber}</b> <br>
</div>`; </div>`;
} else {
if (this.panel.tooltip.seriesStat && yData.seriesStat) { // currently no bounds for pre bucketed data
tooltipHtml = this.addSeriesStat(tooltipHtml, yData.seriesStat); tooltipHtml += `<div>count: <b>${yData.count}</b><br></div>`;
} }
} else { } else {
if (!this.panel.tooltip.showHistogram) { if (!this.panel.tooltip.showHistogram) {
@@ -159,15 +160,6 @@ export class HeatmapTooltip {
return pos; return pos;
} }
addSeriesStat(tooltipHtml, seriesStat) {
tooltipHtml += "series: <br>";
_.forEach(seriesStat, (values, series) => {
tooltipHtml += `&nbsp;&nbsp;-&nbsp;&nbsp;${series}: <b>${values}</b><br>`;
});
return tooltipHtml;
}
addHistogram(data) { addHistogram(data) {
let xBucket = this.scope.ctrl.data.buckets[data.x]; let xBucket = this.scope.ctrl.data.buckets[data.x];
let yBucketSize = this.scope.ctrl.data.yBucketSize; let yBucketSize = this.scope.ctrl.data.yBucketSize;

View File

@@ -62,10 +62,6 @@
checked="ctrl.panel.tooltip.show" on-change="ctrl.render()"> checked="ctrl.panel.tooltip.show" on-change="ctrl.render()">
</gf-form-switch> </gf-form-switch>
<div ng-if="ctrl.panel.tooltip.show"> <div ng-if="ctrl.panel.tooltip.show">
<gf-form-switch class="gf-form" label-class="width-8"
label="Series stats"
checked="ctrl.panel.tooltip.seriesStat" on-change="ctrl.render()">
</gf-form-switch>
<gf-form-switch class="gf-form" label-class="width-8" <gf-form-switch class="gf-form" label-class="width-8"
label="Histogram" label="Histogram"
checked="ctrl.panel.tooltip.showHistogram" on-change="ctrl.render()"> checked="ctrl.panel.tooltip.showHistogram" on-change="ctrl.render()">