我的需要是实现下图
我知道 stacked chart ,但这里有轴点标签(在我的需要中没有任何轴点标签),这是来自 Y 轴。
我很困惑如何实现它。
你能帮我一下吗?任何链接也会有帮助。
<小时/>更新:
我正在尝试代码片段
<script type="text/javascript" language="javascript">
$(document).ready(function(){
var line1 = [14];
var line2 = [77];
var plot4 = $.jqplot('test2', [line1, line2], {
title: '1 Mobility Test Graph',
animate: !$.jqplot.use_excanvas,
stackSeries: true,
seriesDefaults: {
renderer: $.jqplot.BarRenderer,
rendererOptions:{barPadding : 0, barMargin : 5, barDirection: 'horizontal'},
pointLabels:{location : 'e', edgeTolerance : 0, hideZeros: true, show : true},
shadowAngle : 135,
lineWidth : 0,
showLine: true
},
axesDefaults : {
show : false,
tickOptions : {
show : false
}
},
axes: {
yaxis:{renderer:$.jqplot.CategoryAxisRenderer}
},
grid:{
borderWidth:0,
shadow:false
},
legend: {
renderer: $.jqplot.EnhancedLegendRenderer,
show:true,
rendererOptions:{
numberRows:1,
numberColumns: 3,
disableIEFading: false
},
location: 'n',
placement : 'outsideGrid',
marginTop: '5px',
showSwatch:false
}
});
$(".jqplot-xaxis-tick").hide();
$(".jqplot-yaxis-tick").hide();
});
</script>
但这并没有给我任何输出。当我删除 barDirection: 'horizontal'
时,它工作正常。请帮助我,出了什么问题......
这里我得到了jsfiddle ,但它适用于两张图……我怎样才能制作一张图。
最佳答案
你在寻找类似 this 的东西吗? ?那里有一个堆叠的单杠。 根据examples in doc对于水平条形图,您必须为图表提供一个系列数组,其中每个系列的值都是两个值数组 ([x,y]),其中 x 是值,y 是系列 ID。
或者另一种选择是为图表提供一个由单值数组组成的数组,如 shown here .
关于java - 使用 jQplot 实现图表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12898047/