1

jqplot 有一个奇怪的问题。我创建了一个带有 2 个系列和 5 个标签的水平条形图;全部用表中的变量填充。

var plot1 = $.jqplot('chart1', [
    [[SERIESA[0],TITLE[0]], [SERIESA[1],TITLE[1]], [SERIESA[2],TITLE[2]], [SERIESA[3],TITLE[3]], [SERIESA[4],TITLE[4]]], 
    [[SERIESB[0],TITLE[0]], [SERIESB[1],TITLE[1]], [SERIESB[2],TITLE[2]], [SERIESB[3],TITLE[3]], [SERIESB[4],TITLE[4]]]], {
    seriesDefaults: {
        renderer:$.jqplot.BarRenderer,
        // Show point labels to the right ('e'ast) of each bar.
        // edgeTolerance of -15 allows labels flow outside the grid
        // up to 15 pixels.  If they flow out more than that, they 
        // will be hidden.
        pointLabels: { show: true, location: 'e', edgeTolerance: -15 },
        // Rotate the bar shadow as if bar is lit from top right.
        shadow: false,
        // Here's where we tell the chart it is oriented horizontally.
        rendererOptions: {
            barDirection: 'horizontal'
        }
    },
    axes: {
        yaxis: {
            renderer: $.jqplot.CategoryAxisRenderer
        }
    }
});

这呈现了一个可爱的水平条形图。我希望将 2 系列堆叠在每个标签下,但是当我添加该行时

stackSeries: true,

在我的 seriesDefaults 之上,我的酒吧都消失了。其他一切(标签、刻度等)保持不变。除了我需要添加的 stackSeries 选项之外,还有什么?

提前致谢!卡尔

4

3 回答 3

0

我不确定您的代码可能是什么原因,您显示的内容似乎没问题。也许你设置数据的方式有问题,但又一次它根本不起作用。

查看我的示例,它可能会对您有所帮助。

于 2012-05-02T13:14:44.937 回答
0

我找到了一种方法来解决我的问题(不完全,但足以满足我的需要)。仅当我使用从其他地方提取的自定义标签时才会出现此问题;如果我使用通用的“1、2、3、4等” 图表正确堆叠并显示数据。理想情况下,我会有自定义标签,但我可以在图表旁边放一个简单的表格作为轴标签。

于 2012-05-08T08:13:11.630 回答
0

实际上,您可以通过添加 tickt 来自定义标签,例如:

 xaxis: {
                renderer: $.jqplot.CategoryAxisRenderer,
                tickOptions: {
                    angle: -90
                },
                labelOptions: {
                    fontSize: '11pt',
                },
                ticks: ['tick 1', 'tick 2'],
            }
于 2013-10-11T11:43:36.670 回答