0
У меня есть следующий код для рендеринга круговой диаграммы jqplot. По каким-то причинам круговая диаграмма не отображала процент правильно.Круговая диаграмма JQPlot от json
$array= array(array("Males", $males),array("Female", $females));
json_encode($array);
Выходной файл JSon является:
[["Books","8"],["Female","0"]]
Но дисплей для круговой диаграммы показывает 10% вместо 100, это мой визуализатор для круговой диаграммы
$.getJSON('jqPlot.php', function (data) {
var plot1 = jQuery.jqplot('chart1', [data], {
seriesDefaults: {
// Make this a pie chart.
renderer: jQuery.jqplot.PieRenderer,
rendererOptions: {
// Put data labels on the pie slices.
// By default, labels show the percentage of the slice.
showDataLabels: true
},
},
legend: { show: true, location: 'e' }});
});
});
Но если я изменю json-файл на [["Books","8"]]
, круговая диаграмма работает отлично.