diff --git a/CHANGELOG.md b/CHANGELOG.md index 110c8015a27..55298901618 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,9 @@ -# 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 * **Login**: Adds option to disable username/password logins, closes [#4674](https://github.com/grafana/grafana/issues/4674) @@ -24,7 +29,7 @@ * **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) -### Bugfixes +### Bug fixes * **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) * **Graph panel**: Fixed problem with auto decimals on y axis when datamin=datamax, fixes [#6070](https://github.com/grafana/grafana/pull/6070) diff --git a/public/app/core/time_series2.ts b/public/app/core/time_series2.ts index 3d99b43704e..25a99a38ad8 100644 --- a/public/app/core/time_series2.ts +++ b/public/app/core/time_series2.ts @@ -102,6 +102,7 @@ export default class TimeSeries { this.stats.min = Number.MAX_VALUE; this.stats.avg = null; this.stats.current = null; + this.stats.timeStep = Number.MAX_VALUE; this.allIsNull = true; this.allIsZero = true; @@ -110,6 +111,7 @@ export default class TimeSeries { var currentTime; var currentValue; var nonNulls = 0; + var previousTime; for (var i = 0; i < this.datapoints.length; i++) { currentValue = this.datapoints[i][0]; @@ -117,12 +119,13 @@ export default class TimeSeries { // 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) - if (i>0) { - var previousTime = this.datapoints[i-1][1]; - if (!this.stats.timeStep || currentTime - previousTime < this.stats.timeStep) { - this.stats.timeStep = currentTime - previousTime; + if (previousTime !== undefined) { + let timeStep = currentTime - previousTime; + if (timeStep < this.stats.timeStep) { + this.stats.timeStep = timeStep; } } + previousTime = currentTime; if (currentValue === null) { if (ignoreNulls) { continue; } diff --git a/public/app/plugins/panel/graph/graph.ts b/public/app/plugins/panel/graph/graph.ts index b2252978d37..14e0d5c99c0 100755 --- a/public/app/plugins/panel/graph/graph.ts +++ b/public/app/plugins/panel/graph/graph.ts @@ -186,7 +186,7 @@ module.directive('grafanaGraph', function($rootScope, timeSrv) { // Series could have different timeSteps, // let's find the smallest one so that bars are correctly rendered. function getMinTimeStepOfSeries(data) { - var min = 100000000000; + var min = Number.MAX_VALUE; for (let i = 0; i < data.length; i++) { if (!data[i].stats.timeStep) { @@ -297,9 +297,7 @@ module.directive('grafanaGraph', function($rootScope, timeSrv) { break; } default: { - if (panel.bars) { - options.series.bars.barWidth = getMinTimeStepOfSeries(data) / 1.5; - } + options.series.bars.barWidth = getMinTimeStepOfSeries(data) / 1.5; addTimeAxis(options); break; }