Pie chart only 1 sector

Posted by chenzero 
Pie chart only 1 sector
June 10, 2009 07:06AM
Hello,
It seems that the pie chart doesn't work properly when the data only has 1 sector. following is the code.

var myData = new Array(['OK', 1]);
var colors = ['#00cc33'];
myChart = new JSChart('divPieGraph', 'pie');
myChart.setDataArray(myData);
myChart.colorizePie(colors);
myChart.setTitle('test');
//myChart.setTitleColor('#8E8E8E');
myChart.setTitleFontSize(11);
myChart.setTextPaddingTop(30);
myChart.setSize(500, 200);
myChart.setPiePosition(208, 100);
myChart.setPieRadius(75);
myChart.setPieUnitsColor('#555');
myChart.draw();

If add another sector, e.g:
var myData = new Array(['OK', 1], ['', 0]);
var colors = ['#00cc33', '#0066cc'];
.......
it can work, but display an unnecessary '0',
could you give some help how to not display the unnecessary sectors?
Thanks!
Re: Pie chart only 1 sector
July 21, 2009 06:19PM
I wonder about the same thing.

Is there an elegant solution to this?

Thank you.
Re: Pie chart only 1 sector
July 22, 2009 05:49AM
Sorry, I have totally forgot about this subject in the forum... We have just made a modification in the script that allows one bar charts and one sector pie charts. It is a small modification, that's why we haven't made any big announcement on the site, but will solve your problems.

Sabin

--------------------
JS Charts - Created by Smartketer LLC
Sorry, you do not have permission to post/reply in this forum.