JqPlot - pie legend is too high when there are many legend items

I use jqPlot to create a pie chart with a legend. Some of my jqPlot pie options are as follows:

seriesDefaults: {
    renderer: $.jqplot.PieRenderer,
    rendererOptions: {
        padding: 10,
        showDataLabels: true,
        dataLabelFormatString: '%.2f%%',
        sliceMargin: 2,
        startAngle: -90
    }
},
legend: {
    show: true,
    location: 'e',
    placement: 'outside',
    xoffset: 1,
    fontSize: '11px',
    rowSpacing: '10px',
    textColor: '#222222',
    fontFamily: 'Lucida Grande, Lucida Sans, Arial, sans-serif'
}

I recently met a case where there are a lot of legend items (like 21), which makes my legendary box too tall. I am wondering if there is a way either

  • have a vertical scroll bar in the legend field
  • display legend items in multiple columns (preferred)

I tried to set the following properties:

  • numberRows
  • numberColumns

which I found on this page:

$. jqplot.PieRenderer options

however, they do not seem to make any changes.

Can anyone provide me with a good solution to this problem?

+5
source share
1 answer

/. , . , numberColumns numberRows rendererOptions, :

legend: { 
  show: true, 
  location: 'ne',
  rendererOptions: {numberColumns: 2}
}

, , - , , :)

+12

All Articles