我在Morris.js上有一个简单的图形:
我如何在Y位置设置一步?步骤必须是50分,e.q。:
...
150
100
50
$(document).ready(function() {
new Morris.Line({
element: 'myfirstchart',
data: [
{year: '2011-10-01' },
{year: '2012', mark: 313.75},{year: '2013', mark: 323.75},
{year: '2016-06-01' }
],
xkey: ['year'],
ykeys: ['mark'],
xLabels: 'year',
hideHover: true,
labels: ['Mark'],
ymax : 350, ymin : 0,
events: ['2012','2013','2014','2015','2016'],
eventLineColors: ['#aaaaaa']
});
});
答案 0 :(得分:0)
我认为你能做到这一点的唯一方法是根据你的ymin和ymax设置网格的行数(numLines)。
<script type="text/javascript">
$(document).ready(function() {
new Morris.Line({
element: 'myfirstchart',
data: [
{year: '2011-10-01' },
{year: '2012', mark: 313.75},{year: '2013', mark: 323.75},
{year: '2016-06-01' }
],
xkey: ['year'],
ykeys: ['mark'],
xLabels: 'year',
hideHover: true,
labels: ['Mark'],
ymax : 350, ymin : 0,
numLines: 8,
events: ['2012','2013','2014','2015','2016'],
eventLineColors: ['#aaaaaa']
});
});
</script>