diff --git a/lib/timeline/component/graph2d_types/line.js b/lib/timeline/component/graph2d_types/line.js index 7d70e8d3..7a866c3d 100644 --- a/lib/timeline/component/graph2d_types/line.js +++ b/lib/timeline/component/graph2d_types/line.js @@ -133,13 +133,17 @@ Line.prototype.draw = function (dataset, group, framework) { // append with points for fill and finalize the path if (group.options.shaded.enabled == true) { var fillPath = DOMutil.getSVGElement('path', framework.svgElements, framework.svg); - var dFill; + var zero = 0; if (group.options.shaded.orientation == 'top') { - dFill = 'M' + dataset[0].x + ',' + 0 + ' ' + d + 'L' + dataset[dataset.length - 1].x + ',' + 0; + zero = 0; + } + else if (group.options.shaded.orientation == 'bottom') { + zero = svgHeight; } else { - dFill = 'M' + dataset[0].x + ',' + svgHeight + ' ' + d + 'L' + dataset[dataset.length - 1].x + ',' + svgHeight; + zero = Math.min(Math.max(0,group.zeroPosition),svgHeight); } + var dFill = 'M' + dataset[0].x + ',' + zero + ' ' + d + 'L' + dataset[dataset.length - 1].x + ',' + zero; fillPath.setAttributeNS(null, 'class', group.className + ' vis-fill'); if(group.options.shaded.style !== undefined) { fillPath.setAttributeNS(null, 'style', group.options.shaded.style); diff --git a/lib/timeline/optionsGraph2d.js b/lib/timeline/optionsGraph2d.js index a2faf89d..e2f249c1 100644 --- a/lib/timeline/optionsGraph2d.js +++ b/lib/timeline/optionsGraph2d.js @@ -33,7 +33,7 @@ let allOptions = { graphHeight: {string, number}, shaded: { enabled: {boolean}, - orientation: {string:['bottom','top']}, // top, bottom + orientation: {string:['bottom','top','zero']}, // top, bottom, zero __type__: {boolean,object} }, style: {string:['line','bar','points']}, // line, bar @@ -171,7 +171,7 @@ let configureOptions = { stack:false, shaded: { enabled: false, - orientation: ['top','bottom'] // top, bottom + orientation: ['zero','top','bottom'] // zero, top, bottom }, style: ['line','bar','points'], // line, bar barChart: { @@ -266,4 +266,4 @@ let configureOptions = { } }; -export {allOptions, configureOptions}; \ No newline at end of file +export {allOptions, configureOptions};