$values_x = array();
for ($i = 0; $i < count( $series[0]['data'] ); $i++ ) {
$values_x[] = $series[0]['data'][$i][0];
}
$values_y = array();
for ($i = 0; $i < count( $series[0]['data'] ); $i++ ) {
$values_y[] = $series[0]['data'][$i][1];
}
$categories = array(
"label" => $label_x,
"values" => $values_x,
"colors" => $eco_chart_colors,
);
$series = array("label" => null, "values" => array( array("data" => $values_y)));
} else {
$categories = array(
"label" => $label_x,
"values" => $values_x,
"colors" => "",
);
$series = array("label" => $label_y, "values" => $series);
}
The variable $value_x
comes as numbers, ex: 2010, 2011, 2012, but I need to be strings ex: '2010', '2011', '2012'.
Preferably I wanted to force everything that comes within $categories
to be string, already tried with strval
but always give me values: null
.