chart.js - user add the final point of the line

Viewed 141

i need to make a line chart where the user complete the last point on the chart then take an action depending on it. i'm using Chart.js but if that is supported in any library i'm open to change. so any ideas? thanks

1 Answers

I think you cannot draw a line using chart.js the best solution would be a shift to D3 charts where you can make custom charts lines etc..

You can create a line using D3 as below

var svgContainer = d3.select("body").append("svg")
    .attr("width", 200)
    .attr("height", 200);


var circle = svgContainer.append("line")
    .attr("x1", 5)
    .attr("y1", 5)
    .attr("x2", 50)
    .attr("y2", 50)
    .attr("stroke-width", 2)
    .attr("stroke", "black");
Related