Open germanftorres opened 12 years ago
Ah, looks like when we moved from a namespace to a prototype, we mucked up a few references. Looks like there's a few logical errors in how bar charts are trying to apply labels. I'll look into it.
Just to let you know my current stance on the labels - from what I noticed textual labels claim all space there is for the chart, so if they are really long they will squish the graph. I am planning to prepare specific test cases and deal with this when I am finished with docs. I am also tempted to experiment with dividing the code into axis, legend and actual graph, because they are intertwined at the moment. Axis already lives on the prototype and legend code could be moved there.
I agree. There is lots and lots of room to refactor the codebase into something much more modular, that way there is less coupled code that all the different graph types can leverage.
Has there been any progress on fixing these issues? Currently the labels on a barchart just throw an error.
I'm still getting
Object #<a> has no method 'labelise'
when trying to add labels, is this going to be fixed or are we on our own with this?
Yep, still having this issue.
+1
+1
I have fixed barchart labels for my own purpose, the commit is there: saimn/c2c-stats@aa4b43224400c9162ca30a443b32284a4d604f90
I'm not a javascript expert and I didn't test all barchart options but it works for me : it works with stacked (my commit msg is wrong) and non-stacked, hbarchart and vbarchart. However there is another bug with tooltips and raphael 2.1.0. With raphael 2.0.2 it's working fine.
Thanks @saimn You're fix kind of worked in my case. When I applied it, the actual column values appeared on top of the bars (rather than a distinct legend that I could specific underneath them). What I'd like is a barchart like outlined here http://masonoise.wordpress.com/2009/12/29/bar-and-pie-charts-with-raphaeljs though I think the blog poster uses on older version of raphael and graphael (0.4).
I'm using the interactive barchart and like you said, I had to use raphael 2.0.2 to see any effect.
@theirishpenguin for barchart
, labels are shown by default at the top of the bars. You can use .label( [...], true)
to put labels at the bottom.
For vbarchart
there is a corresponding option to show lables on the right instead of left which is the default.
@saimn Thanks for clarifying that! It now works as expected, with one small change - I had to wrap the labels inside an extra pair of square brackets, for example
r.barchart(
10, 10, 300, 220,
[[55, 20, 13, 32, 5, 1, 2, 10, 11,44, 64, 23]],
{type: "round"}
).hover(fin, fout).label([['J','F','M','A','M','J','J','A', 'S', 'O', 'N','D']], true);
Thanks again. Was banging my head against a wall until you provided your solution!
Is this being maintained? The bar chart labels not working is kind of critical? Are the authors maintaining this?
+1
+1
Thanks @saimn, I've gotten the correct labels to show but they are straight after another rather than below their individual bars, and I still get an error
TypeError: 'undefined' is not an object (evaluating 'bars[j][i].x')
Help would be appreciated :)
+1
Anybody know the solution? I got the same problem with 0.51
+1
+1
For people who's still looking for solutions, try using https://github.com/jhurt/g.raphael/blob/master/g.bar.js which fixes this issue and worked pretty well for me
+1
+1 and solution from tianyi33 works
+1 this is still unresolved...
+1 yes still unresolved ... defenitly need labels, and I'm getting the same error "Uncaught TypeError: Object #
var chart = r.barchart(10, 10, 550, 300, [
[5.5, 2.0, 7.6, 9.5]
]).hover(fin, fout).label([['a','b','c','d']]);
+1
still problem with label s
Hi!
I'm trying to label a single series barchart and it simply doesn't work. I have modified the test/barchart.html example trying to label the first chart. It gives an exception an the other three charts don't get rendered. It appears as the labelise method gets called on an object which doesn't support it. I have tried to fix de issue but I'm not really good at javascript.
Thanks
Germán