Jump to content
JChartFX Community
  • 0

Displaying many pie charts instead of 1


vaughndumas@gmail.com

Question

Hi,

I have a problem getting the Pie charts to work. Instead of having all the data in a single chart, I'm getting 3 different charts. Here's my code:



  


var chart1;

function loadChart() {
    chart1 = new cfx.Chart();
    var data = [{
        "a": 5,
        "b": 6,
        "c": 4
    }];
    chart1.setDataSource(data);
    chart1.setGallery(cfx.Gallery.Pie);
    chart1.create('ChartDiv');
}

If you have any ideas as to how to fix this or can point me in the right direction I'd appreciate it.

Take care,

Vaughn

post-2107-13939743238589_thumb.jpeg

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

You have to change the data object notation.Try this:

var chart1;

function loadChart() {
    chart1 = new cfx.Chart();

    var data = [{
        "Label": "a",
        "Value": 5
    }, {
        "Label": "b",
        "Value": 6
    }, {
        "Label": "c",
        "Value": 4
    }];

    chart1.setDataSource(data);
    chart1.setGallery(cfx.Gallery.Pie);
    chart1.create('ChartDiv');
}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...