Search code examples
javascriptgraphchartsc3.jstrendline

Drawing trend-line on the line diagram in c3js


I need to draw trend-line on simple line graph in c3js but i can't seem to find a built-in way to do that? If that's not possible, how do i calculate trend-line (linear regression) data to display on the chart?

Thanks


Solution

  • There isn't a built-in solution (yet), but I'll put in my two cents in case someone can create something for c3.js specifically.

    You may have to calculate the start/end points using one of these methods:

    There are also D3.js solutions here: