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

bar chart label method returns an error (with fix)

Open lukasberns opened this issue 15 years ago • 10 comments

barchart.label(['Some', 'Label'])

Error: vx * (B || 1) + j is not a object

Fix: replace every v[x * (B || 1) + j] inside the label method with v[j][x]

lukasberns avatar Oct 21 '09 13:10 lukasberns

in the not compressed version you need to replace : "bars[i * (multi || 1) + j]" by "bars[j][i]"

But this fix doesn't work with stacked=false;

jeremi avatar Jan 03 '10 13:01 jeremi

@jeremi your code worked very well, I don't understand why it wasn't incorporated inside g.bar.js :(

juarezpaf avatar Aug 04 '10 02:08 juarezpaf

This resolved the issue for me, as well.

evanchaney avatar Aug 09 '10 00:08 evanchaney

The correct fix is much simpler. The problem is just that two variables were initialized in the wrong order. To fix the minimized version from the unix commandline, do: sed -e 's/(B=q;)(q=0;)/\2\1/' < g.bar-min.js > foo.js && mv foo.js g.bar-min.js

For the uncompressed version, find: multi=len; len=0;

and reverse the order.

I've fixed this in my branch: http://github.com/vezult/g.raphael/commit/8a2b7dc3f97dedf5196791fa9eaa8640350d161a

vezult avatar Sep 23 '10 01:09 vezult

These suggested fixes did not work correctly for me. I've just committed some fixes that improve the label for both vertical and horizontal bars, with stacked and non-stacked options.

See: http://github.com/glittle/g.raphael/commit/b7054272e5165dfc19cb44c395dec4740cb80f34

glittle avatar Sep 25 '10 05:09 glittle

I can't make the label to work since my chart displays 12 columns and each of these columns have 4 columns. I wanted to display a 12 months charts, and for each month, the number of x, the number of y etc...

K20 avatar Feb 17 '11 15:02 K20

Hi,

I'm afraid none of the fixes proposed above work for me. I get the following error:

"Uncaught TypeError: Object #<R> has no method 'labelise': g.bar.js line 300"

JackKelly avatar Mar 13 '12 19:03 JackKelly

I get the same error, not sure if this is maintained

abhisec avatar Apr 25 '12 20:04 abhisec

Hi, any progress or solution to this issue?

stonehz avatar Dec 06 '12 12:12 stonehz

There is a limit that only 10 bars/sectors can be displayed using g.raphael

GayathriTulasi avatar Oct 15 '13 11:10 GayathriTulasi