]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Added ability for drawing a Line Chart as a stepped Line Chart.
authoramlethojalen <amleth@quavu.com.au>
Tue, 5 Jul 2016 09:50:53 +0000 (19:50 +1000)
committeramlethojalen <amleth@quavu.com.au>
Tue, 5 Jul 2016 09:50:53 +0000 (19:50 +1000)
docs/03-Line-Chart.md
src/elements/element.line.js

index d4b6ea902ceb4f750b084ccd8ab2845e3db1b0cf..447b05c5c3ccb8da06a0cb44c0ff0ab76e209009 100644 (file)
@@ -39,7 +39,7 @@ label | `String` | The label for the dataset which appears in the legend and too
 xAxisID | `String` | The ID of the x axis to plot this dataset on
 yAxisID | `String` | The ID of the y axis to plot this dataset on
 fill | `Boolean` | If true, fill the area under the line
-lineTension | `Number` | Bezier curve tension of the line. Set to 0 to draw straightlines. *Note* This was renamed from 'tension' but the old name still works.
+lineTension | `Number` | Bezier curve tension of the line. Set to 0 to draw straightlines. Set to -1 to draw a Stepped Line Chart. *Note* This was renamed from 'tension' but the old name still works.
 backgroundColor | `Color` | The fill color under the line. See [Colors](#getting-started-colors)
 borderWidth | `Number` | The width of the line in pixels
 borderColor | `Color` | The color of the line.
index ba7fdf70341909806a7428b037ea9878c74656b4..da939fc60d453e64f35ddba2ab46c291f26b876b 100644 (file)
@@ -29,6 +29,9 @@ module.exports = function(Chart) {
                                previousSkipHandler.call(me, previousPoint, point, nextPoint);
                        } else if (point._view.tension === 0) {
                                ctx.lineTo(point._view.x, point._view.y);
+                       } else if (point._view.tension === -1) {
+                               ctx.lineTo(point._view.x, previousPoint._view.y);
+                               ctx.lineTo(point._view.x, point._view.y);                               
                        } else {
                                // Line between points
                                ctx.bezierCurveTo(