cyberbobak Posted January 16, 2014 Report Share Posted January 16, 2014 Hello all, how could I change legend box for pie chart ? This is working for bar chart: var discovered = 300; chart1.getSeries().getItem(0).setText("Discovered: " + discovered); Thank You Quote Link to comment Share on other sites More sharing options...
0 JuanC Posted January 16, 2014 Report Share Posted January 16, 2014 If you are passing data with json, the pie will show the first string field found in your json objects, e.g. var data = [{"Name":"Rolling Stones", "Sales":10},{"Name":"Pink Floyd", "Sales":8},{"Name":"Led Zeppelin", "Sales":7}]; chart1.setDataSource(data); chart1.setGallery(cfx.Gallery.Pie); The legend box (and tooltip for each pie) will show the band name. If you are passing data manually you can use axisX.getLabels() as follows but I would recommend the json approach. var data = chart1.getData(); data.setSeries(1); data.setPoints(3); data.setItem(0, 0, 20); data.setItem(0, 1, 14); data.setItem(0, 2, 17); chart1.setGallery(cfx.Gallery.Pie); var labels = chart1.getAxisX().getLabels(); labels.clear(); labels.setItem(0, "First Item"); labels.setItem(1, "Second Item"); labels.setItem(2, "Third Item"); Regards, JuanC Quote Link to comment Share on other sites More sharing options...
0 cyberbobak Posted January 17, 2014 Author Report Share Posted January 17, 2014 Hi, it's working,thank You Quote Link to comment Share on other sites More sharing options...
Question
cyberbobak
Hello all,
how could I change legend box for pie chart ?
This is working for bar chart:
var discovered = 300;
chart1.getSeries().getItem(0).setText("Discovered: " + discovered);
Thank You
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
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.