Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

transparent color in javascript D3.js [closed]

Tags:

EDIT: I have a SVG graph produced with d3.js. The filled area of the graph is coloured by CSS rules. I would like the areas to be semi-transparent so that you can see data obscured by the foremost graph area.

Original:

Is there anyway to make the color of this graph transparent? http://jsfiddle.net/skys331/QBDGB/22/ I want to be able to see behind the green data.

Thanks

like image 933
star Avatar asked Jul 08 '13 14:07

star


2 Answers

Yes. You can use transparent for the fill, like so:

.line1 {
  fill: transparent;
  ...
}

You can alternatively set the opacity of the .line1 element:

.line1 {
    fill: green;
    opacity: 0.5;
}

Or set the fill to us rgba (RGB color with an alpha component):

.line1 {
    fill: rgba(0, 128, 0, 0.5);
}
like image 72
rossipedia Avatar answered Sep 20 '22 03:09

rossipedia


Add Opacity to the green:

.line1 {
  fill: green;
  stroke: black;
  stroke-width: 1.5px;
  opacity:0.5;

}

Edited your fiddle: http://jsfiddle.net/QBDGB/23/

like image 39
Rene Pot Avatar answered Sep 22 '22 03:09

Rene Pot