У меня ниже php-код, где все работает нормально и показывает одну круговую диаграмму.
<?php
include "libchart/classes/libchart.php";
header("Content-type: image/png");
$chart = new PieChart(500, 260);
$con=mysqli_connect("localhost","root","","bkash");
$result = mysqli_query($con,"SELECT count(*) as count FROM dialer_rate where mno='tnr' and trx_result='Success' ");
$result1 = mysqli_query($con,"SELECT count(*) as count1 FROM dialer_rate where mno='tnr' and trx_result='Failed'");
$result = $result->fetch_object();
$result1 = $result1->fetch_object();
$dataSet = new XYDataSet();
$dataSet->addPoint(new Point("Success ($result->count)", $result->count));
$dataSet->addPoint(new Point("Failed ($result1->count1)", $result1->count1));
#$dataSet->addPoint(new Point(" (50)", 50));
$chart->setDataSet($dataSet);
$chart->setTitle("bKash USSD Dialer Success/Fail rate");
$chart->render();
?>
Теперь я хочу показать еще одну круговую диаграмму на той же странице под этой круговой диаграммой. Вот почему я добавил тот же код PHP после верхнего кода, а мой полный код PHP ниже. но 2-я круговая диаграмма не отображается.
<?php
include "libchart/classes/libchart.php";
header("Content-type: image/png");
$chart = new PieChart(500, 260);
$con=mysqli_connect("localhost","root","","bkash");
$result = mysqli_query($con,"SELECT count(*) as count FROM dialer_rate where mno='tnr' and trx_result='Success' ");
$result1 = mysqli_query($con,"SELECT count(*) as count1 FROM dialer_rate where mno='tnr' and trx_result='Failed'");
$result = $result->fetch_object();
$result1 = $result1->fetch_object();
$dataSet = new XYDataSet();
$dataSet->addPoint(new Point("Success ($result->count)", $result->count));
$dataSet->addPoint(new Point("Failed ($result1->count1)", $result1->count1));
#$dataSet->addPoint(new Point(" (50)", 50));
$chart->setDataSet($dataSet);
$chart->setTitle("bKash USSD Dialer Success/Fail rate");
$chart->render();
?>
<?php
include "libchart/classes/libchart.php";
header("Content-type: image/png");
$chart = new PieChart(500, 260);
$con=mysqli_connect("localhost","root","","bkash");
$result2 = mysqli_query($con,"SELECT count(*) as count2 FROM dialer_rate where mno='air' and trx_result='Success' ");
$result3 = mysqli_query($con,"SELECT count(*) as count3 FROM dialer_rate where mno='air' and trx_result='Failed'");
$result2 = $result2->fetch_object();
$result3 = $result3->fetch_object();
$dataSet = new XYDataSet();
$dataSet->addPoint(new Point("Success ($result2->count)", $result2->count2));
$dataSet->addPoint(new Point("Failed ($result3->count1)", $result3->count3));
#$dataSet->addPoint(new Point(" (50)", 50));
$chart->setDataSet($dataSet);
$chart->setTitle("bKash USSD Dialer Success/Fail rate");
$chart->render();
?>
Пожалуйста, предложите мне, где нужно изменить или добавить …
Задача ещё не решена.
Других решений пока нет …