[FEATURE] Add new dataset.steppedLine type
FEATURE
Add new dataset.steppedLine type to simplify migration from Google Charts. Suggested type: middle (or any other name) Stepped lines in Google Charts begins outside bar-columns.
My current solution jsFiddle
Current Behavior

Google Charts Behavior

@bril-andrew seems a good enhancement, can you submit a PR with docs and tests?
@ericnkatz any thoughts, since you implemented before and after?
@bril-andrew @simonbrunel looks good to me.
I used 'before' and 'after' because that's what D3 called the two styles of interpolation.
To obtain the desired 'middle' behaviour, wouldn't it suffice a small change to function lineTo in src/helpers/helpers.canvas.js? Something like adding these 5 lines (actually 4 when putting the else and following if in the same line):
lineTo: function(ctx, previous, target, flip) {
if (target.steppedLine) {
+ if (target.steppedLine === 'middle') {
+ var midx = (previous.x + target.x)/2;
+ ctx.lineTo(midx, previous.y);
+ ctx.lineTo(midx, target.y);
+ } else
if ((target.steppedLine === 'after' && !flip) || (target.steppedLine !== 'after' && flip)) {
I guessed that the flip parameter should be a no-op in the case of 'middle'. Nevertheless, I am not familiar enough with the code, so this might be breaking stuff somewhere.