Skip to content

Instantly share code, notes, and snippets.

@samarthagarwal
Last active February 5, 2018 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samarthagarwal/5609822b8c200b9cfaa76a6a6d79e618 to your computer and use it in GitHub Desktop.
Save samarthagarwal/5609822b8c200b9cfaa76a6a6d79e618 to your computer and use it in GitHub Desktop.
Code for Donut Chart in HighCharts
var colors = Highcharts.getOptions().colors;
// Create the chart
Highcharts.chart("container", {
chart: {
type: "pie"
},
title: {
text: "Browser market share, January, 2017 to December, 2017"
},
subtitle: {
text: 'Browser market share, January, 2017 to December, 2017'
},
yAxis: {
title: {
text: "Total percent market share"
}
},
tooltip: {
valueSuffix: "%"
},
series: [
{
name: "Browsers",
data: [
{
name: "MSIE",
y: 10,
color: colors[0]
},
{
name: "Firefox",
y: 25,
color: colors[1]
},{
name: "Chrome",
y: 65,
color: colors[2],
}
],
size: "60%",
},
{
name: "Versions",
data: [
{ name: "MSIE 6.0", y: 0.5, color: colors[0] },
{ name: "MSIE 7.0", y: 1.5, color: colors[0] },
{ name: "MSIE 8.0", y: 2, color: colors[0] },
{ name: "MSIE 9.0", y: 2, color: colors[0] },
{ name: "MSIE 10.0", y: 2, color: colors[0] },
{ name: "MSIE 11.0", y: 2, color: colors[0] },
{ name: "Firefox v31", y: 1, color: colors[1] },
{ name: "Firefox v32", y: 1, color: colors[1] },
{ name: "Firefox v33", y: 2, color: colors[1] },
{ name: "Firefox v35", y: 3, color: colors[1] },
{ name: "Firefox v36", y: 6, color: colors[1] },
{ name: "Firefox v37", y: 4, color: colors[1] },
{ name: "Firefox v38", y: 6, color: colors[1] },
{ name: "Chrome v38.0", y: 6, color: colors[2] },
{ name: "Chrome v39.0", y: 4, color: colors[2] },
{ name: "Chrome v40.0", y: 5, color: colors[2] },
{ name: "Chrome v41.0", y: 5, color: colors[2] },
{ name: "Chrome v42.0", y: 20, color: colors[2] },
{ name: "Chrome v43.0", y: 25, color: colors[2] }
],
size: "80%",
innerSize: "60%"
}
]
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment