I have a bar chart done using d3 and I would like to put text on the bars. How can I choose the most legible color for the text e.g. white for dark bars and black for others? I can't choose the bar colors but I do know what color each bar is when I append the text.
PS: The possible duplicate is a general Javascript solution, its much easier with d3.
The d3 specific solution to this is simple:
Thanks @Jamiec for the link.