Ok, I've got a bar chart. And it basically works... but the labels on the y-axis are kinda long and wrap and then run into each other.
我有一个条形图。和它工作……但是y轴上的标签有点长,然后相互缠绕。
I've tried changing the css, but it gets overidden by JS. I tried scanning thru the jqplot library to find out where it happens but i got lost. Any ideas? is there just an option i can set?
我尝试过改变css,但是被JS控制住了。我试图通过jqplot库进行扫描,以找出发生的地方,但我迷路了。什么好主意吗?是否有我可以设置的选项?
You can see here:
在这里你可以看到:
Here is my html file:
这是我的html文件:
<html>
<head>
<!--[if lt IE 9]><script language="javascript" type="text/javascript" src="excanvas.js"></script><![endif]-->
<script language="javascript" type="text/javascript" src="jquery.min.js"></script>
<script language="javascript" type="text/javascript" src="jquery.jqplot.min.js"></script>
<script language="javascript" type="text/javascript" src="jqplot.barRenderer.min.js"></script>
<script language="javascript" type="text/javascript" src="jqplot.categoryAxisRenderer.js"></script>
<link rel="stylesheet" type="text/css" href="jquery.jqplot.css" />
<script>
$(function() {
graph_me('chart1',[ 'This is a label', 'This is another label..', 'Is this too long? This looks like it might break','Im not sure, but '], [40, 20, 5, 1]);
});
function graph_me(div_name, labels_in, values_in) {
var labels = labels_in.reverse();
var values = values_in.reverse();
$.jqplot(div_name, [values], {
series:[{
renderer:$.jqplot.BarRenderer,
rendererOptions: {
barDirection: 'horizontal',
varyBarColor: true
}
}
],
axes: {
yaxis: {
renderer: $.jqplot.CategoryAxisRenderer,
ticks: labels,
tickOptions: {
showGridline: false,
markSize: 0
}
}
}
});
}
</script>
</head>
<body>
<div id="chart1" style="height:400px;width:500px; margin: 0 auto;"></div>
</body>
</html>
1 个解决方案
#1
7
You could try this in your css:
你可以试试css:
.jqplot-yaxis {
margin-left:-80px !important;
width:80px !important;
}
#1
7
You could try this in your css:
你可以试试css:
.jqplot-yaxis {
margin-left:-80px !important;
width:80px !important;
}