axis line stroke color inconsistent #1516

davidjmcclelland opened this Issue Feb 16, 2016 · 1 comment


None yet

1 participant


I am new to nvd3 - I am using the simple line graph with legend,
If I set my axis line colors via:


And then remove the tallest series by clicking the legend, any new axis lines are drawn in whatever the default color is (where is that set?), not Red.

Is there a redraw function or something that can control the color of any new lines drawn after the chart is created? I tried using CSS as follows but this does not color the axis lines, and doesn't solve my use case even if it did:

line {

I have been able to style text and paths using CSS, but CSS is too static - my users author and style their charts using the UI I am developing. I have the same problem dynamically styling axis tick label text - any new text comes in black, not Red.

I have seen many solutions which require building the grid in d3. I chose nvd3 to avoid having to manage all that, although I am already making many d3 calls in my nvd3 chart to style it. It does everything else I need very well - thank you!


Below shows how adding a statechange triggers a refresh via updateStyles and a kludgey wait for the animation to complete.

Any suggestions on a cleaner method that this to keep styles intact when animations occur?

chart.dispatch.on ('stateChange', function (e) {updateStyles (e)});

        function updateChart(){
        function updateStyles(e){
            setTimeout(function() { doUpdateStyles(); }, thisWidget.duration);
          //  console.log("legend was clicked");
        function doUpdateStyles(){
                .style("fill", chartStyles.text);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment