CarlicosMar / dwpe

Automatically exported from code.google.com/p/dwpe
0 stars 0 forks source link

visualize: error in IE when last value of row is 0 #21

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Make a page that calls $('table').visualize(); on document.ready.  Paste in the 
two tables at the bottom this ticket, which differ only in the value of the 
col3 of row1.

I would expect to see two graphs that are identical except in the value for 
col3 of row1 (which was changed to 0 in the second table).
Instead, the second table does not render -any- bars for row1, even for the 
columns with non-zero values.

I'm using the versions of the visualize plugin, jquery, and excanvas as 
supplied in the most recent download from April 7 
(http://code.google.com/p/dwpe/downloads/detail?name=dwpe-
code-public-latest.zip).  I'm fairly sure it's an IE-specific bug.  It shows up 
in Internet Explorer versions 6, 7, and 8, but not in my versions of Google 
Chrome (5.0.324.9 beta), Firefox 
(3.6.3), Safari (4.0.5), and Opera (10.10).

<table>
  <thead>
    <tr>
      <td></td>
      <th scope='col'>col1</th>
      <th scope='col'>col2</th>
      <th scope='col'>col3</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>row1</th>
      <td scope='row'>4</td>
      <td scope='row'>3</td>
      <td scope='row'>6</td>
    </tr>
    <tr>
      <th>row2</th>
      <td scope='row'>3</td>
      <td scope='row'>2</td>
      <td scope='row'>5</td>
    </tr>
  </tbody>
</table>

<table>
  <thead>
    <tr>
      <td></td>
      <th scope='col'>col1</th>
      <th scope='col'>col2</th>
      <th scope='col'>col3</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>row1</th>
      <td scope='row'>4</td>
      <td scope='row'>3</td>
      <td scope='row'>0</td>
    </tr>
    <tr>
      <th>row2</th>
      <td scope='row'>3</td>
      <td scope='row'>2</td>
      <td scope='row'>5</td>
    </tr>
  </tbody>
</table>

Original issue reported on code.google.com by hyn...@gmail.com on 25 Apr 2010 at 4:55

GoogleCodeExporter commented 8 years ago
Forgot the mention the more bizarre part: As far as I can tell, this issue only 
crops up if it is the -last- value of 
the row that is 0.  If the value for col1 or col2 was 0 and col3 was non-zero, 
the bars would render as expected.

Original comment by hyn...@gmail.com on 25 Apr 2010 at 4:56

GoogleCodeExporter commented 8 years ago
Narrowed this down to a bug in explorercanvas and have filed a bug over there.  
http://code.google.com/p/explorercanvas/issues/detail?id=74

If you guys don't want to wait for them to fix the issue, the visualize plugin 
could be altered to never call 
lineTo(x,y) if the x and y given are the current position.

Original comment by hyn...@gmail.com on 25 Apr 2010 at 9:45

GoogleCodeExporter commented 8 years ago
For bar graphs, that fix would be replacing lines 367–368:

ctx.moveTo(xVal, 0);
ctx.lineTo(xVal, Math.round(-points[i]*yScale));

with:

yVal = Math.round(-points[i]*yScale);
if (yVal != 0) {
    ctx.moveTo(xVal, 0);
    ctx.lineTo(xVal, yVal);
}

Original comment by hyn...@gmail.com on 25 Apr 2010 at 10:10

GoogleCodeExporter commented 8 years ago
If you got the values from a DB, you may also create a condition to do not 
exhibit that value, but I'm sure that depends the type of chart you will use. 
i.e: there's no reason do display 0 in a pie chart. 

Original comment by alysson....@gmail.com on 17 Nov 2010 at 1:17

GoogleCodeExporter commented 8 years ago
This problem also showed up for me when the last value of a row is 1 as well.  
The code in comment 3 fixes it, though the bar graph for that value of 1 does 
not show up (or is extremely tiny).

Original comment by sbfis...@washoecounty.us on 18 Jul 2011 at 9:46

GoogleCodeExporter commented 8 years ago
I am also facing this problems please help me out to solve this issue in 
details.

Original comment by rup.dewa...@gmail.com on 24 Aug 2011 at 5:53

GoogleCodeExporter commented 8 years ago
perfect solution. Thanks!!

Original comment by joseguti...@gmail.com on 8 Nov 2011 at 4:30

GoogleCodeExporter commented 8 years ago
Hi... I have the same problem with Pie... a solutione?

Original comment by david.te...@gmail.com on 23 Apr 2012 at 12:25