How to draw Line Graph using data from MySQL table and PHP | ChartJS


Video is ready, Click Here to View ×

In this video we will learn to draw Line Graph using data from MySQL table, PHP and ChartJS.

Previous Video:

Important Links:

Tell me which video should I make in the comments 🙂

Find me on

35 thoughts on “How to draw Line Graph using data from MySQL table and PHP | ChartJS

  1. hello, good day, a question about chartsjs 2.x, if I have the graphic but now I want to clean it or delete it already draw, to place another, how and where I must put the code, I'm occupying your code, or want to I send you my code, thank you for your support.
    pd already try to erase or clean the canvas label and you can see two graphics
    two graphics are spliced ​​and I do not know how to eliminate them

  2. I am having trouble with the scale of the axis I have 2 sets of data one sets the range correctly the other has values 0-25 and graph has y axis range only to 1.0 Any ideas how can I add custom Y-Axis in your example?

  3. Even with the data = JSON.parse(data); correction, my attempt is not working. It returns Uncaught TypeError: Cannot read property '0' of undefined
    at Object.success (main_user.php?login=Fernando+Ferrari+Fernandes:403)
    at i (jquery-3.2.1.min.js:2)
    at Object.fireWith [as resolveWith] (jquery-3.2.1.min.js:2)
    at A (jquery-3.2.1.min.js:4)
    at XMLHttpRequest.<anonymous> (jquery-3.2.1.min.js:4)

  4. thanks for the tutorial. Sir, i am counting the amount amount of entry in my table per user and using chart js pie chart to display the result, but displaying the percentage of each entry on the chart has been difficult for me. can you please help?

  5. Did you make any video on candel stick chart same work which you done with line graph .
    i want to make candel stick chart by get value from mysql table,PHP .Please tell me how could i do this..????

  6. Hello!
    why [javascript of "line & bar"] are clashed [ javascript of "doughunt & pie"]
    when they are in same html or php , one of them can not display

    thank you~

  7. Hi Yusuf Shakeel! How to draw multiple charts per one page from your solution? if I have 10 records json data render to 10 charts. Please share your code if it possible

Leave a Reply

Your email address will not be published. Required fields are marked *