dygraphs charts are a combination of DOM elements and pixels on a
<canvas>
. The parts that are DOM elements can be styled
using CSS.
As a general rule of thumb, all the text on a chart (the legend, the axis labels, the chart labels) can be styled. The data series and gridlines are drawn on the canvas and must by styled using dygraphs options.
This chart shows the CSS classes for chart labels:
The CSS classes for the chart labels are:
.dygraph-label.dygraph-title
.dygraph-label.dygraph-xlabel
.dygraph-label.dygraph-ylabel
.dygraph-label.dygraph-y2label
The axis labels ("2000", "4000", "6000", … for the y-axis and "1920", "1930", "1940", … for the x-axis) also get CSS classes:
.dygraph-axis-label.dygraph-axis-label-x
.dygraph-axis-label.dygraph-axis-label-y
.dygraph-axis-label.dygraph-axis-label-y.dygraph-axis-label-y2
The legend has the .dygraph-legend
class. When using highlightSeriesOpts, the selected
series' <span> gets a .highlight
class. This can be used to
show only a single series in the legend.
For CSS classes and annotations, see the annotations documentation.