Skip to content Skip to sidebar Skip to footer

How To Apply Color To My Axes In D3?

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://jsfidd

Solution 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

Post a Comment for "How To Apply Color To My Axes In D3?"