Joris Schelfhout
Joris Schelfhout

Reputation: 45

How do I change the color of the background lines, the structural ones

I need to change the color of the background lines in dygraphs. Because I want them to be solid black instead of grey. Otherwise our printer won't display them properly.

There's no mention of a CSS class that refers to these lines, But I'm sure you guys know some genius way to find out how.

Upvotes: 1

Views: 642

Answers (1)

Quinn Johns
Quinn Johns

Reputation: 386

As per the following site, you can utilize the axisLineColor and gridLineColor options to change the colors of axis and grid lines respectively.

Example:

dygraph(AirPassengers, main = "Airline Passengers / Month") %>%
  dyAxis("x", drawGrid = FALSE) %>%
  dyAxis("y", label = "Passengers (Thousands)") %>%
  dyOptions(includeZero = TRUE, 
            axisLineColor = "navy", 
            gridLineColor = "lightblue")

If you want to want to modify labels, title colors, you can do it, via CSS Styling classes.

The CSS classes for the chart labels are:

Title: .dygraph-label .dygraph-title
x-axis label: .dygraph-label .dygraph-xlabel
y-axis label: .dygraph-label .dygraph-ylabel
y2-axis label: .dygraph-label .dygraph-y2label

The axis labels also get CSS classes:

x-axis: .dygraph-axis-label .dygraph-axis-label-x
y-axis: .dygraph-axis-label .dygraph-axis-label-y
y2-axis: .dygraph-axis-label .dygraph-axis-label-y .dygraph-axis-label-y2

Upvotes: 3

Related Questions