Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set background to transparent in Google timeline chart?

I am trying to set the background of Google timeline chart to transparent.Timeline Chart

Tried using

backgroundColor: 'none'
backgroundColor: 'transparent'

nothing seems to work.

Also I tried using

alternatingRowStyle: false

to remove the alternating colors in the rows. It does not work either. Any other ideas?

like image 746
wishchaser Avatar asked Mar 15 '14 01:03

wishchaser


People also ask

How do you make a Google Graph transparent?

attr('fill-opacity','0.0'); Use the eq:() selector to select the rectangle you want to be transparent. Save this answer.

How do I change the color of text in a Google chart?

Changing the Color You can change the color of the lines that connect data points in Google Charts in two subtly different ways: with the colors option to change the chart palette, or with the series option to specify the color for particular series. In the following chart, we set the color of each series explicitly.


2 Answers

Use this to style the alternating rows like the non-alternating ones (works now, until Google implements this option):

svg g:first-of-type path {
    stroke: #e6e6e6;
}
svg g:first-of-type rect:not(:last-child) {
    fill: #ffffff;
}

enter image description here

like image 153
Nelu Avatar answered Nov 15 '22 07:11

Nelu


This is terribly hacky, but does get the job done provided Google's SVG markup doesn't change. The container of the timeline is specified by the first "g" element. All "rect" therein can be made transparent using the fill-opacity style.

svg g:first-of-type rect {
  fill-opacity: 0;
}

Example here: http://jsfiddle.net/kgto8oqw/1/

Obviously this needs more work to accommodate styling of gridlines etc. but you get the idea.

like image 20
Brent Avatar answered Nov 15 '22 06:11

Brent