Commit 71eb0f32 by Torkel Ödegaard

fix(graph): fixed issue with bar width when used in series override, fixes #6528

parent 6495ba15
# 4.0-pre (unreleased) # 4.0-beta2 (unrelased)
### Bugfixes
* **Graph Panel**: Bar width if bars was only used in series override, [#6528](https://github.com/grafana/grafana/issues/6528)
# 4.0-beta1 (2016-11-09)
### Enhancements ### Enhancements
* **Login**: Adds option to disable username/password logins, closes [#4674](https://github.com/grafana/grafana/issues/4674) * **Login**: Adds option to disable username/password logins, closes [#4674](https://github.com/grafana/grafana/issues/4674)
...@@ -24,7 +29,7 @@ ...@@ -24,7 +29,7 @@
* **SystemD**: Change systemd description, closes [#5971](https://github.com/grafana/grafana/pull/5971) * **SystemD**: Change systemd description, closes [#5971](https://github.com/grafana/grafana/pull/5971)
* **lodash upgrade**: Upgraded lodash from 2.4.2 to 4.15.0, this contains a number of breaking changes that could effect plugins. closes [#6021](https://github.com/grafana/grafana/pull/6021) * **lodash upgrade**: Upgraded lodash from 2.4.2 to 4.15.0, this contains a number of breaking changes that could effect plugins. closes [#6021](https://github.com/grafana/grafana/pull/6021)
### Bugfixes ### Bug fixes
* **Table Panel**: Fixed problem when switching to Mixed datasource in metrics tab, fixes [#5999](https://github.com/grafana/grafana/pull/5999) * **Table Panel**: Fixed problem when switching to Mixed datasource in metrics tab, fixes [#5999](https://github.com/grafana/grafana/pull/5999)
* **Playlist**: Fixed problem with play order not matching order defined in playlist, fixes [#5467](https://github.com/grafana/grafana/pull/5467) * **Playlist**: Fixed problem with play order not matching order defined in playlist, fixes [#5467](https://github.com/grafana/grafana/pull/5467)
* **Graph panel**: Fixed problem with auto decimals on y axis when datamin=datamax, fixes [#6070](https://github.com/grafana/grafana/pull/6070) * **Graph panel**: Fixed problem with auto decimals on y axis when datamin=datamax, fixes [#6070](https://github.com/grafana/grafana/pull/6070)
......
...@@ -102,6 +102,7 @@ export default class TimeSeries { ...@@ -102,6 +102,7 @@ export default class TimeSeries {
this.stats.min = Number.MAX_VALUE; this.stats.min = Number.MAX_VALUE;
this.stats.avg = null; this.stats.avg = null;
this.stats.current = null; this.stats.current = null;
this.stats.timeStep = Number.MAX_VALUE;
this.allIsNull = true; this.allIsNull = true;
this.allIsZero = true; this.allIsZero = true;
...@@ -110,6 +111,7 @@ export default class TimeSeries { ...@@ -110,6 +111,7 @@ export default class TimeSeries {
var currentTime; var currentTime;
var currentValue; var currentValue;
var nonNulls = 0; var nonNulls = 0;
var previousTime;
for (var i = 0; i < this.datapoints.length; i++) { for (var i = 0; i < this.datapoints.length; i++) {
currentValue = this.datapoints[i][0]; currentValue = this.datapoints[i][0];
...@@ -117,12 +119,13 @@ export default class TimeSeries { ...@@ -117,12 +119,13 @@ export default class TimeSeries {
// Due to missing values we could have different timeStep all along the series // Due to missing values we could have different timeStep all along the series
// so we have to find the minimum one (could occur with aggregators such as ZimSum) // so we have to find the minimum one (could occur with aggregators such as ZimSum)
if (i>0) { if (previousTime !== undefined) {
var previousTime = this.datapoints[i-1][1]; let timeStep = currentTime - previousTime;
if (!this.stats.timeStep || currentTime - previousTime < this.stats.timeStep) { if (timeStep < this.stats.timeStep) {
this.stats.timeStep = currentTime - previousTime; this.stats.timeStep = timeStep;
} }
} }
previousTime = currentTime;
if (currentValue === null) { if (currentValue === null) {
if (ignoreNulls) { continue; } if (ignoreNulls) { continue; }
......
...@@ -186,7 +186,7 @@ module.directive('grafanaGraph', function($rootScope, timeSrv) { ...@@ -186,7 +186,7 @@ module.directive('grafanaGraph', function($rootScope, timeSrv) {
// Series could have different timeSteps, // Series could have different timeSteps,
// let's find the smallest one so that bars are correctly rendered. // let's find the smallest one so that bars are correctly rendered.
function getMinTimeStepOfSeries(data) { function getMinTimeStepOfSeries(data) {
var min = 100000000000; var min = Number.MAX_VALUE;
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
if (!data[i].stats.timeStep) { if (!data[i].stats.timeStep) {
...@@ -297,9 +297,7 @@ module.directive('grafanaGraph', function($rootScope, timeSrv) { ...@@ -297,9 +297,7 @@ module.directive('grafanaGraph', function($rootScope, timeSrv) {
break; break;
} }
default: { default: {
if (panel.bars) {
options.series.bars.barWidth = getMinTimeStepOfSeries(data) / 1.5; options.series.bars.barWidth = getMinTimeStepOfSeries(data) / 1.5;
}
addTimeAxis(options); addTimeAxis(options);
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment