问题
I am new to d3. I created an axes in d3 and its working fine but i can't set color to my axes. I tried fill:none but it doesn't work for me. Here is the jsfiddle link
http://jsfiddle.net/untnht4u/
回答1:
You can color your axis with CSS. You can set class to the axis as shown below:
var xAxisGroup = svgContainer.append("g")
.attr("class", "axis")
.call(xAxis);
and on the css add class
.axis path, .axis line {
fill: none;
stroke: red;
shape-rendering: crispEdges;
}
working example here
来源:https://stackoverflow.com/questions/32154551/how-to-apply-color-to-my-axes-in-d3