You can use CSS to customize the typefaces used in dygraph labels. In this example we’ll use CSS to make the main label bold and to reduce the size of the typefaces used on the axes:
.dygraph-title {
color: navy;
font-weight: bold;
}
.dygraph-axis-label {
font-size: 11px;
}
dygraph(nhtemp, main = "New Haven Temperatures") %>%
dyCSS("dygraph.css")
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 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.
The full reference to the various CSS classes used throughout a dygraph is here: http://dygraphs.com/css.html.
If you are creating an R Markdown document or Shiny application, you may want to apply your dygraphs CSS globally to the page or application rather than attaching it to each plot. See these links for documentation on how to do this: