首页 文章

JQPlot - 堆积的水平条形图 - 堆叠时没有条形

提问于
浏览
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,

在我的系列之上默认我的酒吧都消失了 . 其他一切(标签,刻度等)保持不变 . 除了需要添加的stackSeries选项之外还有什么东西吗?

提前致谢!卡尔

3 回答

  • 0

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

    Check out my example it might help you out.

  • 0

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

  • 0

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

    xaxis: {
                    renderer: $.jqplot.CategoryAxisRenderer,
                    tickOptions: {
                        angle: -90
                    },
                    labelOptions: {
                        fontSize: '11pt',
                    },
                    ticks: ['tick 1', 'tick 2'],
                }
    

相关问题