Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to customize color in pie chart of NVD3

I am trying to use NVD3 http://nvd3.org/livecode/#codemirrorNav a pie chart. But i want to change the default color. How do i change the color. i am not able to do it.

like image 370
user2315392 Avatar asked Apr 24 '13 12:04

user2315392


People also ask

How do you customize colors on a pie chart?

Change the color of a chartUse the Chart Styles button to quickly change the color or style of the chart. Click the chart you want to change. In the upper-right corner, next to the chart, click Chart Styles. Click Color and pick the color scheme you want, or click Style and pick the option you want.

How do you fill a pie chart with color?

Click the "Color" drop-down menu, then select the color you want to use for the pie-chart section. Ensure that "No Fill" is not selected near the top of the window, or no color will show up on the slide. For colors, you should have "Solid Fill" or "Gradient Fill" selected in that window.

How do I change the color of my pie chart in Excel based on value?

Select the bar chart or column chart, then click Kutools > Charts > Color Chart by Value. Then in the popped-out dialog, set the value range and the relative color as you need. Click to free download now!

How do I change the color of my donut chart?

tab, expand Fill, and then do one of the following: To vary the colors of data markers in a single-series chart, select the Vary colors by point check box. To display all data points of a data series in the same color on a pie chart or donut chart, clear the Vary colors by slice check box.


1 Answers

If you want to use specific color for pie

chart.color(function(d){     return d.data.color }); 

Then, organize your data as:

[   {     key: "Cumulative Return",     values: [       {          "label": "One",         "value" : 29.765957771107,         "color" : "#8c564b"       } ,       {          "label": "Three",         "value" : 32.807804682612,         "color" : "#e377c2"       }      ]   } ] 
like image 156
nicky Avatar answered Oct 01 '22 07:10

nicky