1 <!--#include
virtual=
"header.html" --
>
2 <h2>dygraphs per-series and per-axis options
</h2>
4 <p>When you create a Dygraph object, your code looks something like
8 g = new Dygraph(document.getElementById(
"div"),
13 <p>This document is about some of the values you can put in the
14 <i>options
</i> parameter.
</p>
16 <h3>per-series options
</h3>
18 <p>Typically, an option applies to the whole chart: if you set the
19 strokeWidth option, it will apply to all data-series equally:
</p>
22 g = new Dygraph(document.getElementById(
"div"),
31 <p>Some options, however, can be applied on a per-series or a per-axis
32 basis. For instance, to set three different strokeWidths, you could
36 g = new Dygraph(document.getElementById(
"div"),
41 strokeWidth:
5, // default stroke width
43 strokeWidth:
3 // Y1 gets a special value.
46 strokeWidth:
1 // so does Y3.
51 <p>The result of these options is that Y1 will have a strokeWidth of
1, Y2 will have a strokeWidth of
5 and Y3 will have a strokeWidth of
1. You can see a demonstration of this
<a href='tests/per-series.html'
>here
</a>.
</p>
53 <h3>per-axis options
</h3>
55 <p>Some options make more sense when applied to an entire axis, rather than to individual series. For instance, the axisLabelFormatter option lets you specify a function for format the labels on axis tick marks for display. You might want one function for the x-axis and another one for the y-axis.
</p>
57 <p>Here's how you can do that:
</p>
60 g = new Dygraph(document.getElementById(
"div"),
67 axisLabelFormatter: function(x) {
72 axisLabelFormatter: function(y) {
80 <p>The keys in the 'axes' option are always 'x', 'y' and, if you have a
81 secondary y-axis, 'y2'. If you set the
"axisLabelFormatter" option at the
82 top level, it will apply to all axes.
</p>
84 <p>To see this in practice, check out the
<a
85 href=
"tests/two-axes.html">two-axes
</a> test.
</p>
87 <!--#include
virtual=
"footer.html" --
>