在D3 JS中设置Checbox的样式 [英] Styling checbox in d3 js

查看:45
本文介绍了在D3 JS中设置Checbox的样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用angular开发d3 js.我试图在我的节点中有一个复选框.我能够买到它们,但无法根据需要设置它们的样式.我具有复选框的代码如下.

I am working on d3 js with angular. I am trying to have a check box in my node. I am able to get them but not able to style them as per I need. My code for having checkbox is a follows.

 nodeEnter.append('foreignObject').attr('width', '20')
        .attr("x", 200 / 2)
        .attr("y", 1)
        .attr('height', '20').append('xhtml:input')
        .attr('type', 'checkbox')
        // An on click function for the checkboxes
        .on("click",function(d){
            console.log(d)
        });

附加两个图像.一个是使用上述代码后得到的,而另一个是.我该怎么办?

Attaching two images. One is what I am getting after using above code and other one is what is required is . How can I do that?

推荐答案

您可以创建自定义复选框或引用此链接-

You can create custom checkbox or refer this link- D3 checkboxes

对于样式复选框(尤其是更改颜色)的样式,可以使用属性"stroke" [.attr('stroke','#20b2aa')].

And for styling the checkbox especially for changing the color, you can use attribute "stroke"[.attr('stroke', '#20b2aa')].

这篇关于在D3 JS中设置Checbox的样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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