Opened 11 years ago

Closed 9 years ago

#8108 closed defect (fixed)

straight line graphs with no axes don't show up

Reported by: nazanin Owned by: Eugene Lazutkin
Priority: high Milestone: 1.5
Component: Charting Version: 1.2.1
Keywords: straight line graph Cc: nazanin@…
Blocked By: Blocking:

Description

  1. Create a graph with no axes with these values: (0,10), (1,10),(2,10),(3,10),..


Result: the graph doesn't show up since the max y value minus min y value becomes zero and scale which is span/(max - min) will become NaN.

Fixed it with this patch:

--- a/public/javascripts/dojotoolkit/dojox/charting/scaler/primitive.js
+++ b/public/javascripts/dojotoolkit/dojox/charting/scaler/primitive.js
@@ -2,13 +2,17 @@ dojo.provide("dojox.charting.scaler.primitive");
 
 dojox.charting.scaler.primitive = {
        buildScaler: function(/*Number*/ min, /*Number*/ max, /*Number*/ span, /*Object*/ kwArgs){
+         if (min == max)
+           scale = min;
+         else
+           scale = span/(max - min);
                return {
                        bounds: {
                                lower: min,
                                upper: max,
                                from:  min,
                                to:    max,
-                               scale: span / (max - min),
+                               scale: scale,
                                span:  span
                        },
                        scaler: dojox.charting.scaler.primitive

Attachments (1)

n8108.html (773 bytes) - added by Eugene Lazutkin 9 years ago.
The repro case.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 11 years ago by Eugene Lazutkin

Resolution: invalid
Status: newclosed

Use Dojo 1.2.2 or the trunk. Set min/max parameters on the axis.

comment:2 Changed 11 years ago by nazanin

Resolution: invalid
Status: closedreopened

well that's the point. This happens when you graph with no axis''' in dojo/dojox/charting/plot2d/Base.js _calc function decides whether the graph has axis or not. So this problems doesn't occur when there are axis.

comment:3 Changed 11 years ago by Eugene Lazutkin

Milestone: tbd1.3

Yep, missed the point. Thank you for reopening.

comment:4 Changed 10 years ago by Eugene Lazutkin

Milestone: 1.3future

Moving open tickets to the future.

comment:5 Changed 10 years ago by Eugene Lazutkin

Milestone: future1.4

comment:6 Changed 10 years ago by Eugene Lazutkin

Milestone: 1.41.5

bumping tickets that didn't make the 1.4 cut, but most likely to go in the next point release.

Changed 9 years ago by Eugene Lazutkin

Attachment: n8108.html added

The repro case.

comment:7 Changed 9 years ago by Eugene Lazutkin

Resolution: fixed
Status: reopenedclosed

(In [21870]) Fixed the "straight line" bug, thx nazanin!, !strict, fixes #8108.

Note: See TracTickets for help on using tickets.