从SQL创建图表

I am trying to create the following chart with help of SQL. But I get only the last row on the chart. Where should I check?

Target Chart:

 $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);

here

My Code:

$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);

thanks