From fbf3cf7f60d572f82a2f6cd954d1eb03549e9051 Mon Sep 17 00:00:00 2001 From: MichaelZinsmaier Date: Sat, 9 Nov 2013 11:02:18 +0100 Subject: [PATCH] added a test plot for a single data point and resolved the issues with it --- curvedLines.js | 6 ++++-- tests/testSinglePoint.htm | 41 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 tests/testSinglePoint.htm diff --git a/curvedLines.js b/curvedLines.js index adf1b5b..18d9739 100644 --- a/curvedLines.js +++ b/curvedLines.js @@ -104,7 +104,6 @@ //if the plugin is active register processDatapoints method function processOptions(plot, options) { - if (options.series.curvedLines.active) { plot.hooks.processDatapoints.unshift(processDatapoints); } @@ -112,7 +111,10 @@ //only if the plugin is active function processDatapoints(plot, series, datapoints) { - if (series.curvedLines.apply == true && series.originSeries === undefined) { + var nrPoints = datapoints.points.length / datapoints.pointsize; + var EPSILON = 0.5; //pretty large epsilon but save + + if (series.curvedLines.apply == true && series.originSeries === undefined && nrPoints > (1 + EPSILON)) { if (series.lines.fill) { var pointsTop = calculateCurvePoints(datapoints, series.curvedLines, 1) diff --git a/tests/testSinglePoint.htm b/tests/testSinglePoint.htm new file mode 100644 index 0000000..89fbd5f --- /dev/null +++ b/tests/testSinglePoint.htm @@ -0,0 +1,41 @@ + + + + CurvedLines Plugin for flot + + + + + + +
+ + + + +
+