Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change graph label colors #8

Closed
kevgliss opened this issue Jun 12, 2014 · 5 comments
Closed

Change graph label colors #8

kevgliss opened this issue Jun 12, 2014 · 5 comments

Comments

@kevgliss
Copy link

This might have to do with nvd3 but would you happen to know an easy way to change the label colors of a graph?

I can change the color with:

d3.selectAll('.nvd3.nv-legend g').style('fill', "white")

in the console, but am unsure how where to make the corrections in relation to angular + nvd3 lifecycle

@krispo
Copy link
Owner

krispo commented Jun 12, 2014

Try to add this to callback option, like:

$scope.options = {
    ...,
    callback: function(){
        d3.selectAll('.nvd3.nv-legend g').style('fill', "white");
    }
}

@kevgliss
Copy link
Author

Worked great! I was also able to change the label colors with:

d3.selectAll('.nv-pieLabels text').style('fill', "white");

Thanks for the help and the sweet library!

@marceol
Copy link

marceol commented Jul 18, 2014

Hi kevgliss, krispo I'm trying to do the same you did, but it is not working for me.... the callback function is executing before the piechart renders, I've placed your code as last function in my controller, and I cannot figure out what could be wrong, Is there any setting to add for the callback to execute after the piechart renders??

Thanks!

@krispo
Copy link
Owner

krispo commented Jul 18, 2014

Can you show your controller code?
please, check also this demo.

@marceol
Copy link

marceol commented Jul 21, 2014

Thanks for the quick response! I've ended up using callback="callbackFunction()" instead of options in the HTML and worked like a charm, awesome library, it is making things a lot simpler for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants