How to put Data Chart taken from Mysql ?


Topic: How to put Data Chart taken from Mysql ?

ZeeiD asked 6 years ago

Hi.. Somebody can help my ?

I want to make a chart pie with DATA taken from mysql

how do I put data taken from phpmysql ?

== my code HTML

JS

var ctxP = document.getElementById("pieChart").getContext('2d');

var myPieChart = new Chart(ctxP, {

type: 'pie',
data: {
  labels: ["IPA", "IPS"],
  datasets: [{
    **data: [300, 50],** //// DATA 300 and 500 are taken from Mysql (php mysql)

    backgroundColor: ["#F7464A", "#46BFBD", "#FDB45C", "#949FB1", "#4D5360"],
    hoverBackgroundColor: ["#FF5A5E", "#5AD3D1", "#FFC870", "#A8B3C5", "#616774"]
  }]
},
options: {
  responsive: true
}     });

My problem is data: [300, 50], //// DATA 300 and 500 are taken from Mysql (php mysql)

Thanks You :)


Bartłomiej Malanowski staff pro premium commented 6 years ago

What's your output from SQL query?


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Open

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: Dekstop
  • Browser: Mozila Firefox
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No