gregm gregm - 2 months ago 33
CSS Question

Is there a way to change background-color of dygraph labels?

When I place a dygraph on my website I want the background of the graph to match the background-color of my website. When I set the dygraph background color via css in the tag attributes the color is not applied to the label, it remains white when I mouse over the data.

<div id="graphdiv" style="width:750px; height:300px; background-color: lightblue;"></div>


If the option existed it would presumably be called labelsColor, but that option doesn't exist. Is there some other way to change the label color?

Answer

Not sure why you’re having an issue with the color of the background as my graph div is in the body of my page and simply inherits the CSS background style of the page body. As for the color of the legend, amongst other things, see http://dygraphs.com/css.html—I changed the color of the background of my legend using:

background: transparent !important;

in .dygraph-legend and it is now the color of the body of the page.