How would I add a label to the end of the line?

17 views
Skip to first unread message

Nate

unread,
Mar 24, 2011, 5:54:49 PM3/24/11
to Flotr Javascript Plotting Library
We are developing a program which will display graphs using your
library (very nice, btw!)

We use only line graphs.

We will be printing in B&W most of the time, so I'm looking for
additional ways to identify which line is which. The easiest way I can
think of would be to append a label to the RIGHT of the last datapoint
of the line on the line graph.

Has anyone attempted this? I'd be interested in anyone's results and
methods. Obviously if the points are quite close together vertically,
then some kind of stacking and leaders would be required.

hmm, perhaps a box of evenly vertically spaced labels, then with
leaders from the labels to the last datapoints? this 'box' would have
to be off the right of the graph, thus requiring the actual graph to
be shrunk horizontally to allow room for this 'legend' of sorts.

Nate

unread,
Jun 6, 2011, 12:47:05 PM6/6/11
to fl...@googlegroups.com
I've started writing it as a plugin, but have been hung up on one little thing:

  • I can't seem to access some of the graph object's properties, even though they show up in console.log(varname), they give 'undefined' when I actually try to use them.

Take a look at the attached pic.

Why does the .axes.x.scale give me "undefined"? It's clearly present!

Thanks for any tips!



P.S. I'm attempting to access the .scale variable so I can draw leader lines which correspond to each last endpoint WITHIN the 'graph scale', and then run to some labels I have which are not within the actual graph.

George Roberts

unread,
Jun 6, 2011, 12:57:24 PM6/6/11
to fl...@googlegroups.com
I don’t recognize this console output.  What tools are you using?
 
I strongly recommend you get firefox and install the add-on called firebug.  In this you can place a breakpoint in your code and examine the variables that way.  I’ve found this to be better than the debugger built into ie8.
 
My second tip is to not write this as a plugin but just modify flotr.  flotr is pretty stagnant as far as I can tell so you aren’t likely to be upgrading to a newer version.
 
- George Roberts
 
 
From: Nate
Sent: Monday, June 06, 2011 12:47 PM
Subject: Re: How would I add a label to the end of the line?
 
I've started writing it as a plugin, but have been hung up on one little thing:
 
  • I can't seem to access some of the graph object's properties, even though they show up in console.log(varname), they give 'undefined' when I actually try to use them.
 
Take a look at the attached pic.
 
Why does the .axes.x.scale give me "undefined"? It's clearly present!
 
Thanks for any tips!
 
 

 

 
P.S. I'm attempting to access the .scale variable so I can draw leader lines which correspond to each last endpoint WITHIN the 'graph scale', and then run to some labels I have which are not within the actual graph.
--
You received this message because you are subscribed to the Google Groups "Flotr Javascript Plotting Library" group.
To view this discussion on the web visit https://groups.google.com/d/msg/flotr/-/XzhxUmZsbkdkdFlK.
To post to this group, send email to fl...@googlegroups.com.
To unsubscribe from this group, send email to flotr+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/flotr?hl=en.

Nate

unread,
Jun 6, 2011, 1:08:28 PM6/6/11
to fl...@googlegroups.com
Thanks, I may just modify flotr itself. :)

That particular debug view is from Chrome. I've also got Firebug in Firefox, and it has given me the same errors. I've done some dabbling in JS, but haven't used breakpoints yet. I'll read up on those and do some debugging.

Thanks George!


George Roberts

unread,
Jun 6, 2011, 1:14:28 PM6/6/11
to fl...@googlegroups.com
In firebug, go to the script tab.  In the next line down, choose the js file you are editing.  Scroll to the line in question and click on the line number to toggle the breakpoint.  You can see all the breakpoints on the right side under the breakpoints tab.  Refresh the page (f5) and when the debugger stops, you can step line by line.  You can hover the mouse over variables to see their content or go to the right side, select watch tab and enter a variable name.  You can enter “option” and then you can open it up like a tree, drilling down to the property variable you care about.
 
- George Roberts
http://gr5.org
 
From: Nate
Sent: Monday, June 06, 2011 1:08 PM
Subject: Re: How would I add a label to the end of the line?
 

Nathan Sutherland

unread,
Jul 11, 2011, 11:50:50 AM7/11/11
to fl...@googlegroups.com
I've decided on going with another library, do to the fact that all my graphs are similiar enough I can do the layout and formatting myself. :|

Thanks for your help though!
-Nathan

--
You received this message because you are subscribed to the Google Groups "Flotr Javascript Plotting Library" group.
Reply all
Reply to author
Forward
0 new messages