人力车:改变X轴标签的颜色

时间:2021-09-02 23:41:09

By default the labels are all a dark gray, I've tried to override them using CSS multiple ways.

默认情况下,标签都是深灰色,我试图用CSS多种方式覆盖它们。

How do I change the label's color on render? Or how do I change the color in the SVG output?

如何在渲染时更改标签的颜色?或者如何更改SVG输出中的颜色?

I've looked everywhere and have found similar titles but different meanings. Love how manipulatable this graph is, but the label text color is a must for me.

我到处寻找并找到了类似的标题但意义不同。喜欢这个图表是如何可操作的,但标签文本颜色对我来说是必须的。

Thanks in advance.

提前致谢。

1 个解决方案

#1


2  

Finally found the way to do it. Gotta use JS to overwrite the attributes.

终于找到了做到这一点的方法。必须使用JS来覆盖属性。

After the graph.render() function use these:

graph.render()函数使用后:

$('.x_ticks_d3 text').css('opacity', '1.0');//fix text opacity
$('#x_axis text').css('fill', 'white');//text color
$('.x_ticks_d3 .tick').css('stroke-width', '0px');//text smoothing
$('#x_axis path').css('opacity', '0');//remove line or
$('#x_axis path').css('stroke', 'white');//change line color

This got everything to be white for me, and was able to remove the lines also.

这让我觉得一切都是白色的,并且能够删除线条。

#1


2  

Finally found the way to do it. Gotta use JS to overwrite the attributes.

终于找到了做到这一点的方法。必须使用JS来覆盖属性。

After the graph.render() function use these:

graph.render()函数使用后:

$('.x_ticks_d3 text').css('opacity', '1.0');//fix text opacity
$('#x_axis text').css('fill', 'white');//text color
$('.x_ticks_d3 .tick').css('stroke-width', '0px');//text smoothing
$('#x_axis path').css('opacity', '0');//remove line or
$('#x_axis path').css('stroke', 'white');//change line color

This got everything to be white for me, and was able to remove the lines also.

这让我觉得一切都是白色的,并且能够删除线条。