简体   繁体   English

如何更新C3.js图形线宽和刻度颜色?

[英]How to update C3.js graph line width and tick color?

How to update the default line width in a C3.js graph? 如何更新C3.js图中的默认线宽? How to update the tick (the circles) color? 如何更新刻度(圆圈)颜色?

If you use a DOM inspector you can see what classes the different objects have and then it's just a case of assigning some CSS to them eg 如果您使用DOM检查器,您可以看到不同对象具有哪些类,然后只是为它们分配一些CSS,例如

.c3-line {
    stroke-width: 2px;
}

.c3-circle {
    fill: red !important;
}

For case of increasing scatterplot circle radius, radius of circles on line charts. 对于增加散点图圆半径,圆线图上圆的半径的情况。 Please use like this: 请使用这样的:

c3.generate({
...
  point: {
    r: 10,
  },
...
})

As per documentation you can control line width individually by following 根据文档,您可以通过以下方式单独控制线宽

[chart-id] .c3-line-[chart-data-name] {
  stroke-width: 5px;
}

if it does not work try to use !important 如果它不起作用尝试使用!important

ex: 例如:

#chart .c3-line-data2 {
  stroke-width: 5px;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM