您好我正在尝试复制以下图片:
我找到了一个几乎可以复制的插件,我试图将其自定义为样式并添加内部文本。我似乎无法将其设计如下。我试图将color属性应用于系列,但这不起作用。我不确定colorScheme属性是否覆盖,但我现在卡住了。
以下是我尝试过的内容:jsFiddle
,代码如下:
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);
提前致谢
答案 0 :(得分:1)
您需要创建自己的配色方案:
$.jqx._jqxChart.prototype.colorSchemes.push({ name: 'myScheme', colors: ['#006688', '#bbbbbb', '#7777777'] });
然后在设置对象中引用它而不是'scheme13':
colorScheme: 'myScheme',
不幸的是,他们不支持每个值的标注/引导线或显示中间的总数。如果需要,您需要使用SVG手动绘制它们。