google / google-visualization-issues

288 stars 35 forks source link

Bug: Stepped Area Chart display of zeroes is wonky #1238

Open orwant opened 9 years ago

orwant commented 9 years ago
What steps will reproduce the problem? Please provide a link to a
demonstration page if at all possible, or attach code.
1. Create an arrayToDataTable with zero as the second or later value (not the key,
and not the first value in the row).
2. Create a stacked SteppedAreaChart with that array.
3. The row with the zero value will show the zero value not stacked with other values.
Example code at the bottom.

What component is this issue related to (PieChart, LineChart, DataTable,
Query, etc)?
SteppedAreaChart

Are you using the test environment (version 1.1)?
(If you are not sure, answer NO)
NO

What operating system and browser are you using?
Windows 7 64-bit, Google Chrome 26.0.1410.64 m

Example code, adapted from the Google Code Playground code at https://code.google.com/apis/ajax/playground/?type=visualization#stepped_area_chart

function drawVisualization() {
  var data = google.visualization.arrayToDataTable([
    ['Director (Year)',  'Rotten Tomatoes', 'IMDB'],
    ['Alfred Hitchcock (1935)', 80,         20],
    ['Ralph Thomas (1959)',     60,         40],
    ['Don Sharp (1978)',        100,        0],
    ['James Hawes (2008)',      50,         50]
  ]);

  var options = {
    width: 600, height: 400,
    title: 'The decline of \'The 39 Steps\'',
    vAxis: {title: 'Accumulated Rating'},
    isStacked: true
  };

  var chart = new google.visualization.SteppedAreaChart(document.getElementById('visualization'));
  chart.draw(data, options);
}
​
When displaying this chart, the Rotten Tomatoes bars are at 80, 60, 100, and 50, and
the IMDB bars are at 100, 100, 0, and 100.  The IMDB bar should be at 100 also since
it's supposed to be stacked on top of the Rotten Tomatoes bar.  If you change the "Don
Sharp" data from 0 to 0.001 then it appears more like what I expect.  Also, if I change
the data from 0 to null then it also appears correct.  It's only the value 0 that does
not stack correctly.

Original issue reported on code.google.com by david.henderson on 2013-06-20 20:58:37


orwant commented 9 years ago
Definitely a bug.  Thanks for reporting it.

Original issue reported on code.google.com by dlaliberte@google.com on 2013-06-21 12:24:37

orwant commented 9 years ago
Another interesting value to try is -10.  Then it becomes clear what is going on, and
why it almost makes sense the way 0 is shown - it is treated like a non-positive number.
 Also, if we make 0 behave like other positive numbers, then we will have the opposite
problem when all the rest of the numbers are negative.

Original issue reported on code.google.com by dlaliberte@google.com on 2013-06-21 12:34:45