深色背景中的 c3 图;如何更改轴和刻度值颜色

c3 graph in a dark background; how to change axis and tick value color

我在深色背景上绘制了一个图表,但由于轴颜色和刻度值颜色,很难阅读。如何将轴的颜色、刻度和轴刻度值更改为白色?

您可以使用 CSS 来设置图表的样式,例如

path.domain { stroke: white; }
.tick text { stroke: yellow; }
.c3-legend-item text { stroke: grey; }

要使轴为白色,刻度标签为黄色,图例文本为灰色。

.c3 path, .c3 line, .tick text { 
  stroke: white;
}

如果您不想使用描边,也可以尝试更改填充颜色:

path.domain { fill: white; }
.tick text { fill: yellow; }
.c3-legend-item text { fill: grey; }

您可以尝试调整路径和线条的 CSS 属性。请参阅下面的示例 CSS 作为助手。

.c3 .c3-axis-x path,
.c3 .c3-axis-x line {
  stroke: red;
}

.c3 .c3-axis-y path,
.c3 .c3-axis-y line {
  stroke: blue;
}