Hi I am trying to replicate the below image:
I have found a plugin which will almost replicate and I have tried to customise it to style and add the inner text. I cannot seem to style it as below. I have tried to apply the color property to the series but this is not working. I am not sure if the colorScheme property is overriding but I am stuck at the moment.
Here is what I have tried: jsFiddle
and the code is below:
var data = [
{Responses: "Accepted", Share: 33.3},
{Responses: "Unresponded", Share: 26.5},
{Responses: "Rejected", Share: 25.4}
]
// prepare chart data as an array
var source =
{
datatype: "array",
datafields: [
{ name: 'Responses' },
{ name: 'Share' }
],
localdata: data
};
var dataAdapter = new $.jqx.dataAdapter(source, { async: false, autoBind: true, loadError: function (xhr, status, error) { alert('Error loading "' + source.url + '" : ' + error); } });
// prepare jqxChart settings
var settings = {
title: "Geoff's Birthday Party",
description: "",
enableAnimations: true,
showLegend: false,
legendPosition: { left: 520, top: 140, width: 100, height: 100 },
padding: { left: 5, top: 5, right: 5, bottom: 5 },
titlePadding: { left: 0, top: 0, right: 0, bottom: 10 },
source: dataAdapter,
colorScheme: 'scheme13',
seriesGroups:
[
{
type: 'donut',
showLabels: false,
series:
[
{
dataField: 'Share',
displayText: 'Responses',
labelRadius: 100,
initialAngle: 15,
radius: 130,
innerRadius: 90,
centerOffset: 0,
formatSettings: {decimalPlaces:1 },
color:'#00000'
}
]
}
]
};
// setup the chart
$('#jqxChart').jqxChart(settings);
Thanks in advance
You need to create your own color scheme:
$.jqx._jqxChart.prototype.colorSchemes.push({ name: 'myScheme', colors: ['#006688', '#bbbbbb', '#7777777'] });
and then reference it in the settings object instead of 'scheme13':
colorScheme: 'myScheme',
Unfortunately they don't support callout/leader lines for each of the values or showing the total in the middle. If you need that you would need to manually draw them using SVG.