需要不显示或不生成图表标记 [英] Need to display none or not generate chart marks

查看:44
本文介绍了需要不显示或不生成图表标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此CSS正在删除标记...

This CSS is working for remove marks...

#mychart .c3-circles-avg2017,
#mychart .c3-circles-avg2018 {
   display: none;
}

这样做很丑,因为所有配置和图表定义均在Javascrpt上。我需要使用JavaScript ,理想的情况是使用C3或D3 ...我尝试使用D3,但它不起作用

is a ugly way to do it, because all configs and chart definitions are at Javascrpt. I need to do by Javascript, ideal is to use C3 or D3... I try D3 and it is not working:

d3.selectAll('#mychart .c3-circles-avg2017').style("display","none");
d3.selectAll('#mychart .c3-circles-avg2018').style("display","none");

如何通过Javascript获得相同的CSS效果? (或者说对C3不加标记)。

how to obtain same CSS effect by Javascript? (or say to C3 not put marks).

(在@thatOneGuy评论后编辑)

(edit after @thatOneGuy comment)

https://jsfiddle.net/jo1h0dyb/

推荐答案

如果这是用于折线图中的圆,并且您想在配置中进行,则需要设置point.r。从参考资料中还不清楚,但是它可以使用一个以数据点{id,index,value,x}作为参数以及固定值的函数。

If this is for the circles in a line graph, and you want to do it in the config, point.r is what needs set. It's not clear from the reference but it can take a function that has a datapoint {id, index, value, x} as an argument as well as a fixed value.

https://c3js.org/reference.html#point-r

在您的情况下尝试以下操作:

Try this in your case:

point: {
  r: function (d) { return (d.id === "avg2017" || d.id === "avg2018") ? 0 : 5 }
}

这篇关于需要不显示或不生成图表标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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