如何在d3中将颜色应用到我的轴上? [英] how to apply color to my axes in d3?

查看:101
本文介绍了如何在d3中将颜色应用到我的轴上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是d3的新手.我在d3中创建了一个轴,并且可以正常工作,但是我无法为轴设置颜色.我尝试了fill:none,但对我不起作用.这是jsfiddle链接

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/

推荐答案

您可以使用CSS为轴着色. 您可以按如下所示将类设置为轴:

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);

并在CSS上添加类

.axis path, .axis line {
        fill: none;
        stroke: red;
        shape-rendering: crispEdges;
    }

工作示例此处

这篇关于如何在d3中将颜色应用到我的轴上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆