Home forums Using CanvasJS Using multiple value from json to create Pie Chart

This topic contains 2 replies, has 3 voices, and was last updated by  tructuyenbongda 1 week, 1 day ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #23566

    joejoejoe
    Member

    Well Hello there.
    I’m new here.

    Can I create Pie Chart from multiple value from json?

    Please take a look my json.

    SELECT idprov,
    (Totalbelum * 100 / t.Totalbelum) as Percentbelum,
    (Totalsudah * 100 / y.Totalsudah) as Percentsudah
    FROM form_kuesioner_pengelola
    CROSS JOIN (SELECT SUM(CASE WHEN jasa_akses_inet_sedia = ‘belum’ THEN 1 ELSE 0 END) as Totalbelum FROM form_kuesioner_pengelola C where idprov=1 group by idprov) t
    CROSS JOIN (SELECT SUM(CASE WHEN jasa_akses_inet_sedia = ‘sudah’ THEN 1 ELSE 0 END) as Totalsudah FROM form_kuesioner_pengelola C where idprov=1 group by idprov) y
    where idprov=1
    group by idprov

    I want to show pie chart that only contain Percentbelum and Percentsudah

    Thank you

    #23610

    Vishwas R
    Keymaster

    @joejoejoe,

    Number of slices (data points) in the pie chart are based on the number of dataPoints that you pass. Passing just ‘Percentbelum and Percentsudah’ in the chart-options should work fine in your case. Please take a look at gallery example on Rendering Chart in PHP with Data from database.

    If this doesn’t help you fulfill your requirements, kindly share sample project with sample database over Google-Drive or Onedrive, so that we can look into it and help you out.


    Vishwas R
    Team CanvasJS

    #23672

    oh verry nice

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.