Commit 85e6aa96 authored by olau@iola.dk's avatar olau@iola.dk

Fixed min = max bug, thanks to Michael Messinides

git-svn-id: https://flot.googlecode.com/svn/trunk@32 1e0a6537-2640-0410-bfb7-f154510ff394
parent 084fe2ae
Flot 0.x
--------
Fixed a bug in dealing with data where min = max, thanks to Michael
Messinides.
Flot 0.2 Flot 0.2
-------- --------
......
...@@ -232,20 +232,19 @@ ...@@ -232,20 +232,19 @@
function calculateRange(axis, axisOptions) { function calculateRange(axis, axisOptions) {
var min = axisOptions.min != null ? axisOptions.min : axis.datamin; var min = axisOptions.min != null ? axisOptions.min : axis.datamin;
var max = axisOptions.max != null ? axisOptions.max : axis.datamax; var max = axisOptions.max != null ? axisOptions.max : axis.datamax;
var delta = max - min;
// check degenerate case // check degenerate case
if (delta == 0.0) { if (max - min == 0.0) {
var widen; var widen;
if (max == 0.0) if (max == 0.0)
widen = 1.0; widen = 1.0;
else else
widen = 0.01; widen = 0.01;
axis.min = max - widen; min -= widen;
axis.max = max + widen; max += widen;
} }
else {
axis.tickSize = getTickSize(axisOptions.noTicks, min, max, axisOptions.tickDecimals); axis.tickSize = getTickSize(axisOptions.noTicks, min, max, axisOptions.tickDecimals);
// consider autoscaling // consider autoscaling
...@@ -277,7 +276,6 @@ ...@@ -277,7 +276,6 @@
axis.min = min; axis.min = min;
axis.max = max; axis.max = max;
} }
}
function extendXRangeIfNeededByBar() { function extendXRangeIfNeededByBar() {
if (options.xaxis.max == null) { if (options.xaxis.max == null) {
......
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