Change label text color in row chart
Asked Answered
A

2

8

I am using dc.js row chart. Something exactly like the day of the week chart in the example of this page

Can someone please suggest how can I change the label colors from white to black.

Arawakan answered 29/3, 2014 at 8:2 Comment(5)
In the CSS, use .dc-chart g.row text {fill: black;}?Durbar
Thanks a lot. Should have done that myself. I was tyring to achieve that using Javascript.Arawakan
What shall I now do to this question ? Delete it ? Answer it myself and close it ?Arawakan
Normally, if the question was indeed answered by someone else in a comment, you ask the person to post it as an answer and then accept it.Durbar
Please post it as an answer and I will accept it :) .. Thank You!Arawakan
D
18

I your CSS, use .dc-chart g.row text {fill: black;}.

Durbar answered 29/3, 2014 at 11:13 Comment(2)
Can you explain how this works? I thought g.row applied to all g elements having class row.Slacker
You are right, it does. So, in the example given by the OP, there is no inline styling for the text elements (or their parent g elements with class row) which would have overriden any CSS styling. So, you can go ahead and simply CSS style the g elements having class row to whichever color you want and the text elements will inherit that (the cascading effect). Here is a minimal FIDDLE illustrating my point.Durbar
L
2

Furthermore, for those who try with pie charts, the selector for labels is without the g.row. i.e. : .dc-chart text.pie-slice {fill: black;}

Laryngo answered 17/2, 2016 at 13:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.