-
Notifications
You must be signed in to change notification settings - Fork 436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: paper.labelise is not a function #169
Comments
Raphaël 2.0.2 window.onload = function () {
var r = Raphael("holder"),
data1 = [[55, 20, 13, 32, 5, 1, 2, 10], [10, 2, 1, 5, 32, 13, 20, 55], [12, 20, 30]],
data2 = [[55, 20, 13, 32, 5, 1, 2, 10], [10, 2, 1, 5, 32, 13, 20, 55], [12, 20, 30]],
data3 = [[55, 20, 13, 32, 5, 1, 2, 10], [10, 2, 1, 5, 32, 13, 20, 55], [12, 20, 30]],
txtattr = { font: "12px 'Fontin Sans', Fontin-Sans, sans-serif" };
r.text(160, 10, "Single Series Chart").attr(txtattr);
r.text(480, 10, "Multiline Series Chart").attr(txtattr);
r.text(160, 250, "Multiple Series Stacked Chart").attr(txtattr);
r.text(480, 250, 'Multiline Series Stacked Vertical Chart. Type "round"').attr(txtattr);
r.barchart(10, 10, 300, 220, [[55, 20, 13, 32, 5, 1, 2, 10]], 0, {type: "sharp"}).label([['C', 'D', 'E', 'G', 'L', 'M', 'P', 'S1']]);
r.barchart(330, 10, 300, 220, data1);
r.barchart(10, 250, 300, 220, data2, {stacked: true});
r.barchart(330, 250, 300, 220, data3, {stacked: true, type: "round"});
}; |
Experiencing same issue here, somehow the object is not able to see the labelise prototype that is defined in g.raphael.js... |
Anybody got a workaround for this error ? I'm using Raphaël 2.0.2 and g.Raphael 0.51 . The line number being pointed out by the error is line 344 in g.bar.js . The code from that line number as part of g.bar.js is:-
|
I end up writing all my own function to deal with axis and labels. |
@totszwai Thanks for your inputs. Can you share a sample snippet that you've implemented which has your own function(s) dealing with axis and labels , I'm relatively new to JS and thus not exactly sure how to go about writing my own JS code for axis and labels. Kindly specify the version of raphael.js , g.raphael.js and g.bar.js that your using as well. Thank you. |
I can't because is work related lol Chart.myaxisfunction = function () { Your code goes here, you can check for this.bars in order to find out the Just draw the axis the way you want it. };
|
@totszwai I understand that, I have written a bar chart gist that's pretty much lined up except for the labelling(that's what's throwing the above error :)). I tried looking up this.bars as a function in the g.raphael documentation because I thought you were probably pointing to some built in function I could use for the location and height. I guess I didn't clearly get you. To clearly understand what your saying would it be possible for you to write up a custom function for this gist mentioned above so that I could clearly understand how exactly can I go about labelling it ? Thanks. |
After your line 24, do what I wrote in my last reply... I'm not home right When you do barChart.myfunc = function() {…}, you will have access to I'm not calling any built in function I basically wrote my own function for
|
@totszwai I've updated my gist based on your inputs, but how exactly do I make use of this.bars to go about adding labels? I'm able to see a lot of properties related to chart in the firebug console using Also, you mentioned "you can check for this.bars in order to find out the bars location and height too". How do I add labels if I want to do this for dynamic data ? |
I have something like this...
props.bars[Math.floor(props.bars.length / 2)]; }
Where props.c is the chart generated by raphael, props are the properties As you can see, I just calculate the x, y on where I want to print the In your case, where it says, props.bars, you can do it with this.bars... my When you debug "this.bars", you can look at individual bars such as On Mon, Sep 2, 2013 at 2:06 AM, Mohnish G J [email protected]:
|
Thank you @totszwai, I now have a better idea of how to go about this. |
In g.bar.js at function chart.label, change:
with:
and do the same few lines down. |
I got TypeError after adding .label to barchart like the following:
r.barchart(10, 10, 300, 220, [[55, 20, 13, 32, 5, 1, 2, 10]], 0, {type: "sharp"}).label([['C', 'D', 'E', 'G', 'L', 'M', 'P', 'S1']]);
The text was updated successfully, but these errors were encountered: