Can anyone suggest me about colouring to each slice of High Charts Data.
My Code is given below also a image there. I want to put my custom color to each slice of data (for data are like Firefox, opera, chrome, IE etc.. )
and also want to remove series name ('Browser share') in this example, if I put it false "name: false" then is showing series one, I want to show it like "Firefox: 45%" on mouse hover on Firefox slice
$(function () {
$('#graph').highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: 'Browser market shares at a specific website, 2014'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '<b>{point.name}</b>: {point.percentage:.1f} %',
style: {
color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
}
}
}
},
series: [{
type: 'pie',
name: 'Browser share',
data: [
['Firefox', 45.0],
['IE', 26.8],
{
name: 'Chrome',
y: 12.8,
sliced: true,
selected: true
},
['Safari', 8.5],
['Opera', 6.2],
['Others', 0.7]
]
}]
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highcharts/4.1.5/highcharts.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highcharts/4.1.5/highcharts-more.src.js"></script>
<div id="graph" style="height: 300px; width:100%;"></div>
To change series name in tooltip you can change pointFormat and remove reference to series.name
Example:
Fiddle: http://jsfiddle.net/avsdgek8/
For colors see answered topics:
highcharts: dynamically define colors in pie chart
How can I change the colors of my highcharts piechart?
Also: color can be set per data point - http://jsfiddle.net/avsdgek8/1/ or per series - http://api.highcharts.com/highcharts#plotOptions.pie.colors
We can specify default color set which the report should as follows: