jqplot donut chart label/legend color and line

不羁岁月 提交于 2019-12-12 17:04:14

问题


I am working with jqplot donut and all seems to be working fine except that I am unable to give color to donut chart value % and a line that should link value % and the chart. I will use screen shots to better explain what my output is what i am trying to achieve

This is what my output looks like

Using this code

var plot1;
var storedData;
$(document).ready(function () {
    storedData = [ ['Take home pay', 44228.33], ['Tax', 8771.67], ['Super', 4162.5 ], ['Regular expenses', 0 ], ['Unallocated', 44228.33] ];
    jQuery.jqplot.config.enablePlugins = false;
    plot1 = $.jqplot('savings_expense', [storedData], {
        seriesDefaults: {
            // point markers.
            seriesColors: ["#3399FF", "#F6EB0A", "#FFC000", "#92D050", "#604A7B"],
            // make this a donut chart.
            renderer: $.jqplot.DonutRenderer,
            rendererOptions: {
                // Donut's can be cut into slices like pies.
                sliceMargin: 3,
                // Pies and donuts can start at any arbitrary angle.
                startAngle: 90,
                showDataLabels: true,
                highlightMouseOver : true,
                dataLabelPositionFactor: 1.5,
                padding: 50
            }

        }
    });
});

This is what I want to achieve

As you will notice I need to

  1. Display the legend in the same color what appears in the chart
  2. The line that links the legend text with the chart.

I will really appreciate if I can get some assistance on this.

来源:https://stackoverflow.com/questions/26466989/jqplot-donut-chart-label-legend-color-and-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!