我试图在SQL的帮助下创建以下图表。但我只得到图表上的最后一行。我应该在哪里检查?
目标图表:
$ChartRef = 'my_chart'; // Title of the shape that embeds the chart
$SeriesNameOrNum = 1;
$NewValues = array( array('Cat. A','Cat. B','Cat. C','Cat. D'), array(12.7, 1.5, 3.2, 4.8));
$NewLegend = "Polomp";
$TBS->PlugIn(OPENTBS_CHART, $ChartRef, $SeriesNameOrNum, $NewValues, $NewLegend);
// Merge a chart
$ChartRef = 'my_chart'; // Title of the shape that embeds the chart
$SeriesNameOrNum = 2;
$NewValues = array( array('Cat. A','Cat. B','Cat. C','Cat. D'), array(12.7, 1.5, 3.2, 4.8) );
$NewLegend = "Polomp2";
$TBS->PlugIn(OPENTBS_CHART, $ChartRef, $SeriesNameOrNum, $NewValues, $NewLegend);
// Merge a chart
$ChartRef = 'my_chart'; // Title of the shape that embeds the chart
$SeriesNameOrNum = 3;
$NewValues = array( array('Cat. A','Cat. B','Cat. C','Cat. D'), array(0.7, 2.5, 1.2, 3.8) );
$NewLegend = "Polomp3";
$TBS->PlugIn(OPENTBS_CHART, $ChartRef, $SeriesNameOrNum, $NewValues, $NewLegend);
这里
我的代码:
$sql = "SELECT * FROM gs_rekurse Order By Id DESC LIMIT 3";
$result = mysql_query($sql);
$cats = array();
$values = array();
$i = 1;
while($row = mysql_fetch_array($result, MYSQLI_ASSOC)){
$ChartRef = 'my_chart'; // Title of the shape that embeds the chart
$SeriesNameOrNum =$i;
$NewLegend ="Polpmp$i";
$cats[] = $row['Datum'];
$values[] = $row['Unterstellungen'];
$i++;
}
$NewValues = array($cats, $values);
$TBS->PlugIn(OPENTBS_CHART, $ChartRef, $SeriesNameOrNum, $NewValues, $NewLegend);
感谢