作者热门文章
- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
Jqplot有如下图表
我的问题是如何在 jqplot 图表
之外显示标签,如下面的 high 图表
,
高位图表可在此处获得 fiddle
排行榜
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
jqplot如何实现在图表外用线条显示标签?
最佳答案
dataLabelPositionFactor 控制标签在切片上的位置。增加将使标签向饼图边缘滑动,减少将使标签向饼图中心滑动。
dataLabelPositionFactor : 1.2,
默认 dataLabelThreshold 值为 3,因此不显示值 <=3,因此将其设置为 0
数据标签阈值:0
$(document).ready(function(){
var data = [
['Heavy Industry', 12],['Retail', 9], ['Light Industry', 14],
['Out of home', 16],['Commuting', 7], ['Orientation', 9]
];
var plot1 = jQuery.jqplot ('chart1', [data],
{
seriesDefaults: {
// Make this a pie chart.
renderer: jQuery.jqplot.PieRenderer,
rendererOptions: {
// Put data labels on the pie slices.
// By default, labels show the percentage of the slice.
showDataLabels: true,
//dataLabelPositionFactor controls position of label on slice. Increasing will slide label toward edge of pie, decreasing will slide label toward center of pie.
dataLabelPositionFactor : 1.2,
// default dataLabelThreshold value is 3, hence values <=3 are not displayed hence make it to 0
dataLabelThreshold : 0
}
},
legend: { show:true, location: 'e' }
}
);
});
关于javascript - jqplot如何显示饼图外的标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21448072/
有人可以帮我理解为什么我的饼图百分比计算不正确吗?看截图: 根据我的计算,如 RHS 上所示,支出百分比应为 24.73%。传递给 Highcharts 的值如下:- 花费:204827099.36-
我正在制作圆环饼图。 我设置数据的颜色并获取钻取(它是保存外部切片的数据和配置的对象)切片的颜色为同一组颜色。我想设置要在向下钻取对象中使用的不同颜色数组。请参阅附图(外层切片有两种颜色:橙色和透明)
我是一名优秀的程序员,十分优秀!