g.raphael icon indicating copy to clipboard operation
g.raphael copied to clipboard

bar chart: negative values

Open cainlevy opened this issue 14 years ago • 4 comments

Currently, negative columns:

  • have no hover effect
  • are clipped at the bottom of the canvas
    • causing them to look out of scale
    • causing popups to disappear
    • causing labels to disappear unless isBottom

I think all of these issues would be solved if negative values were calculated into the total height of the graph and the y origin was re-centered.

cainlevy avatar Oct 16 '09 20:10 cainlevy

Has anyone made any progress on a fix with this. I've begun tinkering with the code, but being new to raphael.js am making slow progress. Would be very helpful to have negative values "just work"

jystewart avatar Sep 15 '10 15:09 jystewart

Hi, I have also been tinkering around and I got some stuff working, but when I make all the values negative, for example, the chart just totally looses scale. I agree - negative values need to be calculated into the total height of the graph. Also the labeling of the graph is a problem with negative columns - the column just goes right over the label. I can fix a small bug here and there but am finding it quite difficult to sort out catering for negative values in the bar chart. Any help would be appreciated.

SharanA avatar Nov 04 '10 16:11 SharanA

Got it working pretty well, but probably not the prettiest solution, code wise.

open-agroclimate@677b8d3d1f320e7dda51c0ea43322b960aad5448

It also centers the graph (max of abs(-value) || +value) and keeps scale. For hovering, I check the value and put it above the centerline for negative values, but you COULD place it on bar.y and just switch the direction if you want. That's more client side than library side.

frostbytten avatar Feb 10 '11 01:02 frostbytten

I still have the same problem?! :(

mprinc avatar Aug 15 '14 21:08 mprinc