Permalink
Browse files

Fixed description of methods returning internals

git-svn-id: https://flot.googlecode.com/svn/trunk@76 1e0a6537-2640-0410-bfb7-f154510ff394
  • Loading branch information...
1 parent 5d2883f commit 078f25e5cadd2d109414ff47124b24bb2a561fb9 olau@iola.dk committed Sep 13, 2008
Showing with 47 additions and 27 deletions.
  1. +47 −27 API.txt
View
74 API.txt
@@ -564,13 +564,14 @@ like this:
Plot Members
------------
-The Plot object returned from the plot function has the following
-members:
+The Plot object returned from the plot function has some members you
+can call:
- clearSelection()
Clear the selection rectangle.
+
- setSelection(ranges)
Set the selection rectangle. The passed in ranges is on the same
@@ -586,41 +587,19 @@ members:
may have to do a bit of shortcircuiting to prevent an eternal loop
if you invoke setSelection inside a "plotselected" handler.
- - getCanvas()
-
- Returns the canvas used for drawing in case you need to hack on it
- yourself. You'll probably need to get the plot offset too.
-
- - getPlotOffset()
-
- Gets the offset that the grid has within the canvas as an object
- with the members "left", "right", "top", "bottom". I.e., if you draw a
- circle on the canvas with the center placed at (left, top), its
- center will be at the top-most, left corner of the grid.
- setData(data)
You can use this to reset the data used. Note that axis scaling,
ticks, legend etc. will not be recomputed (use setupGrid() to do
that). You'll probably want to call draw() afterwards.
- You can use this function to speed up redrawing a plot if you now
- that the axis won't change. Put in the new data with
+ You can use this function to speed up redrawing a plot if you know
+ that the axes won't change. Put in the new data with
setData(newdata) and call draw() afterwards, and you're good to
go.
-
-
- - getData()
-
- Returns the data currently used. The data series returned are
- normalized with missing settings filled in. So for instance to
- find out what color Flot has assigned to the data series, you
- could do this:
-
- var series = plot.getData();
- for (var i = 0; i < series.length; ++i)
- alert(series[i].color);
+
- setupGrid()
Recalculate and set axis scaling, ticks, legend etc.
@@ -634,3 +613,44 @@ members:
- draw()
Redraws the canvas.
+
+
+There are also some members that let you peek inside the internal
+workings of Flot which in some case is useful. Note that if you change
+something in the objects returned, you're changing the objects used by
+Flot to keep track of its state, so be careful.
+
+ - getData()
+
+ Returns an array of the data series currently used on normalized
+ form with missing settings filled in according to the global
+ options. So for instance to find out what color Flot has assigned
+ to the data series, you could do this:
+
+ var series = plot.getData();
+ for (var i = 0; i < series.length; ++i)
+ alert(series[i].color);
+
+
+ - getAxes()
+
+ Gets an object with the axes settings as { xaxis, yaxis, x2axis,
+ y2axis }. Various things are stuffed inside an axis object, e.g.
+ you could use getAxes().xaxis.ticks to find out what the ticks are
+ for the xaxis.
+
+
+ - getCanvas()
+
+ Returns the canvas used for drawing in case you need to hack on it
+ yourself. You'll probably need to get the plot offset too.
+
+
+ - getPlotOffset()
+
+ Gets the offset that the grid has within the canvas as an object
+ with the members "left", "right", "top", "bottom". I.e., if you draw a
+ circle on the canvas with the center placed at (left, top), its
+ center will be at the top-most, left corner of the grid.
+
+

0 comments on commit 078f25e

Please sign in to comment.