如何在甜甜圈渲染器jqplot中添加自定义标签?

时间:2013-11-14 09:24:11

标签: javascript jquery charts jqplot

我想为s1圆环和dataLabels 百分比添加dataLabels 标签,或者为s2添加标签。我该怎么办?

enter image description here

     function drawDonut(chartId){
             var s1 = [['a',6], ['b',8], ['c',14], ['d',20]];
             var s2 = [['e', 6], ['f', 8], ['g', 14], ['h', 20]];

              var plot = $.jqplot(chartId,[s1,s2], {
                seriesDefaults: {
                  // make this a donut chart.
                  renderer:$.jqplot.DonutRenderer,
                  rendererOptions:{
                    // Donut's can be cut into slices like pies.
                    sliceMargin: 0,
                    dataLabelThreshold: 0,
                    // Pies and donuts can start at any arbitrary angle.
                    startAngle: -90,
                    showDataLabels: true,
                    // By default, data labels show the percentage of the donut/pie.
                    // You can show the data 'value' or data 'label' instead.
                    dataLabels: 'label'
                  }
                }
              }

1 个答案:

答案 0 :(得分:0)

那是因为你在seriesDefaults中设置showDataLabels。查看http://www.jqplot.com/docs/files/jqPlotOptions-txt.html了解如何设置每个系列的选项。