【发布时间】:2017-10-30 22:26:58
【问题描述】:
This is the output that I would be requiring
This is the output that I am getting at the moment
我已经在我的 d3 代码中添加了圆形字形,但我需要根据条件添加字形,如果月份是一月,那么只有圆圈才会出现!例如,按照 01/2019、01/2020、01/2021 的顺序,圆圈应仅出现在这些日期
g.selectAll("circle")
.data(dataIS)
.enter()
.append("circle")
.attr("cx", function (d) { return x(parseTime(d.date));})
.attr("cy", function (d) { return y(d.salary + d.bonus); })
.attr("r", "4")
.style("stroke","black")
.style("stroke-width","2")
.style("fill", "red" );
这会在所有日期创建圈子,我需要过滤并仅在 1 月显示它们
【问题讨论】:
-
你能添加一个代码示例吗?
-
欢迎来到 StackOverflow。请使用代码编辑您的问题(有一个“编辑”按钮),而不是在 cmets 中编写代码。另外,请添加所有相关代码(minimal reproducible example)以获得正确答案。
-
@MiroslavLigas - 已添加代码,感谢您的帮助!
标签: javascript html d3.js data-visualization linechart