I’m using jQuery.flot to create custom charts in my project, but I need invert the order of Y axis. Now, at the botton is the min value and at top de max value, I need to have the max value at botton and the min value at top.
This is my example: http://pastehtml.com/view/1doilsa.html
But the inverseTransform option seems not to work.
<body>
script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"
script type="text/javascript" src="http://flot.googlecode.com/svn/trunk/jquery.flot.js"
<div class="plot-lines" style="width: 500px; height: 400px;"></div>
<script type="text/javascript">
$.plot($('.plot-lines'),
[{
data: [ [0, null], [1, 3], [2, 6], [3, 2], [4, null] ],
lines: {
show: true
},
points: {
show: true
}
}],
{
xaxis: {
ticks: [ [0, ''], [1, 'Race 1'], [2, 'Race 2'], [3, 'Race 3'], [4, ''] ]
},
yaxis: {
tickDecimals: 0,
inverseTransform: function (v) { return -v; }
}
}
);
</script>
</body>
Thanks a lot for your help
Unfortunately, this is not supported well in flot 0.6 (the current release).
There is hope though, if you are willing to use the development release (http://code.google.com/p/flot/source/checkout):
Issue #263 specifically was about that, and it is fixed in r303
Your best bet is just to check out the newest source and watch it work!