JQPlot-堆叠的水平条形图-堆叠时无条形 [英] JQPlot - Stacked Horizontal Bar Chart - No Bars When Stacked

查看:103
本文介绍了JQPlot-堆叠的水平条形图-堆叠时无条形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Having a strange issue with jqplot. I've created a horizontal bar chart with 2 series and 5 labels; all populated with variables from a table.

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个系列堆叠在每个标签下,但是当我添加线时

This renders a lovely horizontal bar chart. I would like for the 2 series to be stacked under each label, but when I add the line

stackSeries: true,

我的系列之上默认值我的酒吧全部消失.其他所有内容(标签,刻度等)保持不变.除了我需要添加的stackSeries选项之外,还有其他东西吗?

above my seriesDefaults my bars all vanish. Everything else (labels, ticks, etc) remains the same. Is there something in addition to the stackSeries option I need to add?

提前谢谢! 卡尔

推荐答案

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

I found a way to fix my problem (not entirely, but sufficiently for my need). This issue only occurs when I use custom lables pulled from somewhere else; if I use generic "1,2,3,4,etc." the graph stacks properly and shows data. Ideally I would have custom lables, but I can just put a simple table beside the graph to act as the axis labels.

这篇关于JQPlot-堆叠的水平条形图-堆叠时无条形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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