jqPlot-当图例项很多时,饼图例太高 [英] jqPlot - Pie legend too tall when there are many legend items

查看:66
本文介绍了jqPlot-当图例项很多时,饼图例太高的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jqPlot创建带有图例的饼图.我的jqPlot饼图选项的一部分如下所示:

I'm using jqPlot to create a pie chart with a legend. Part of my jqPlot pie options look 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'
}

最近,我遇到一种情况,其中有很多图例项(例如21),这使我的图例框太高.我想知道是否有办法

Recently I've come across a case where there are many legend items (e.g., 21), which makes my legend box too tall. I'm wondering if there is a way to either

  1. 图例框中具有垂直滚动条
  2. 在多列中显示图例项(首选)

我尝试设置以下属性:

  • numberRows
  • numberColumns

:

$ .jqplot. PieRenderer选项

但是他们似乎没有任何改变.

however they don't seem to make any changes.

有人能为我提供一个很好的解决这个问题的方法吗?

Would anybody be able to provide me with a good solution to this problem?

推荐答案

尝试使用提供的列/行设置.我亲自检查了此设置是否起作用.只需确保在图例中将numberColumnsnumberRows设置在rendererOptions内即可,例如:

Try to go with the provided column/row settings. I double-checked personally that this settings do work. Just make sure that in legend you set the numberColumns or numberRows inside rendererOptions, like:

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

如果这不起作用,那么我必须说必须在您的代码中隐藏其他错误,然后让我们看一下代码,以便我们可以一起找到并压缩该错误:)

If this doesn't work then I must say some other bug must be hiding in your code, then let us see the code so we can find and squash the bug together :)

这篇关于jqPlot-当图例项很多时,饼图例太高的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆