Commit 64c5b94e authored by MichaelZ's avatar MichaelZ

added multi axis support and a new example for multi axis and fill options

parent 475c9a04
...@@ -59,6 +59,8 @@ _____________________________________________________ ...@@ -59,6 +59,8 @@ _____________________________________________________
options: options:
_____________________________________________________ _____________________________________________________
fill: bool true => lines get filled
fillColor: null or the color that should be used for filling
active: bool true => plugin can be used active: bool true => plugin can be used
show: bool true => series will be drawn as curved line show: bool true => series will be drawn as curved line
fit: bool true => forces the max,mins of the curve to be on the datapoints fit: bool true => forces the max,mins of the curve to be on the datapoints
...@@ -75,6 +77,7 @@ _____________________________________________________ ...@@ -75,6 +77,7 @@ _____________________________________________________
/* /*
* v0.1 initial commit * v0.1 initial commit
* v0.15 negative values should work now (outcommented a negative -> 0 hook hope it does no harm) * v0.15 negative values should work now (outcommented a negative -> 0 hook hope it does no harm)
* v0.2 added fill option (thanks to monemihir) and multi axis support (thanks to soewono effendi)
* *
* *
*/ */
...@@ -109,7 +112,6 @@ _____________________________________________________ ...@@ -109,7 +112,6 @@ _____________________________________________________
//select the data sets that should be drawn with curved lines and draws them //select the data sets that should be drawn with curved lines and draws them
function draw(plot, ctx) { function draw(plot, ctx) {
var series; var series;
var axes = plot.getAxes();
var sdata = plot.getData(); var sdata = plot.getData();
var offset = plot.getPlotOffset(); var offset = plot.getPlotOffset();
...@@ -117,8 +119,8 @@ _____________________________________________________ ...@@ -117,8 +119,8 @@ _____________________________________________________
series = sdata[i]; series = sdata[i];
if (series.curvedLines.show && series.curvedLines.lineWidth > 0) { if (series.curvedLines.show && series.curvedLines.lineWidth > 0) {
axisx = axes.xaxis; axisx = series.xaxis;
axisy = axes.yaxis; axisy = series.yaxis;
ctx.save(); ctx.save();
ctx.translate(offset.left, offset.top); ctx.translate(offset.left, offset.top);
...@@ -366,7 +368,7 @@ _____________________________________________________ ...@@ -366,7 +368,7 @@ _____________________________________________________
init: init, init: init,
options: options, options: options,
name: 'curvedLines', name: 'curvedLines',
version: '0.1' version: '0.2'
}); });
......
<div id="fillAndMultiAxis"></div>
<script id="source" language="javascript" type="text/javascript">
$(function () {
var d1 = [[20,20], [42,60], [54, 20], [80,80]];
var d2 = [[20,700], [80,300]];
var options = { series: {
curvedLines: {
active: true
}
},
axis: { min:10, max: 100},
yaxes: [{ min:10, max: 90}, { position: 'right'}]
};
$.plot($("#fillAndMultiAxis"),
[
{data: d1, curvedLines: { show: true, fill: true, fillColor: "#C3C3C3", lineWidth: 3}}, {data: d1, points: { show: true }},
{data: d2, curvedLines: { show: true, lineWidth: 3}, yaxis:2}, {data: d2, points: { show: true }, yaxis:2}
], options);
});
</script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment