0

我想为 s1 donut添加 dataLabels标签,为 s2 添加 dataLabels百分比或不添加标签。我该怎么做?

在此处输入图像描述

     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'
                  }
                }
              }
4

1 回答 1

0

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

于 2014-05-11T16:03:01.623 回答