Home Forums Chart Support Line chart with bar chart Reply To: Line chart with bar chart

#23773

@nisha,

You can calculate the dataPoints to the trend-line dynamically by calculating slope as explained in this stackexchange thread. Here is the updated JSFiddle.

One More Question: yValue += Math.round(Math.random() * 10 – 5); What is 10 and 5 here? What we are doing in this formula. Sorry I am new to this.

JavaScript random method returns a floating-point, pseudo-random number in the range 0–1 (inclusive of 0, but not 1). With the help of random method, you can generate a random number between two numbers (lets say you need a number between 0 and 100), which is used in the JSFiddle that’s shared with you.


Vishwas R
Team CanvasJS