Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines
Hi, I try to pass data from mysql to gauge chart but in the script represent numbers with quote. This is a problem because the gauge chart is not recognized I just saw that the array is exactly the same at hand as a result of the datastore but still doesn't recognize
KoolReport.widget.init({"js":["\/assets\/koolreport_assets\/1072229211\/jquery.min.js",["\/assets\/koolreport_assets\/754407801\/googlechart.js"]],"css":[]},function(){
gchart5e7a6b0c0fb101 = new KoolReport.google.chart("Gauge","gchart5e7a6b0c0fb101",["machinery","temperature"],[["machinery","temperature"],["Plaquero 2",{"v":__"14.355"__,"f":"14.355\u00baC"}],["Plaquero 1",{"v":__"-20.550"__,"f":"-20.550\u00baC"}]],{"redFrom":-18,"redTo":0,"max":15,"min":-50,"yellowFrom":-25,"yellowTo":-18,"minorTicks":5},{"package":"gauge","stability":"current","mapsApiKey":""});
This is the view code:
<?php
use \koolreport\widgets\google\Gauge;
use \koolreport\widgets\koolphp\Table
?>
<div class="report-content">
<div class="text-center">
<h1>Temperatura de congeladores</h1>
</div>
<?php
if($this->dataStore("temperaturedata")->countData()>0){
$data=array(array("machinery"=>"Plaquero 1","temperature"=>-20.438),array("machinery"=>"Plaquero 2","temperature"=>13.938));
Gauge::create(array(
"dataSource"=>$this->dataStore("temperaturedata")->toArray(),
"columns"=>array(
"machinery",
"temperature"=>array(
"suffix"=>"ºC",
)
),
"options"=>array(
"redFrom"=> -18,
"redTo"=> 0,
"max"=> 15,
"min"=> -50,
"yellowFrom"=>-25,
"yellowTo"=> -18,
"minorTicks"=> 5
),
));
Gauge::create(array(
"dataSource"=>$data,
"columns"=>array(
"machinery",
"temperature"=>array(
"suffix"=>"ºC",
)
),
"options"=>array(
"redFrom"=> -18,
"redTo"=> 0,
"max"=> 15,
"min"=> -50,
"yellowFrom"=>-25,
"yellowTo"=> -18,
"minorTicks"=> 5
),
));
echo "<br/>Array:";
print_r($data);
echo "<br/>Datastore:";
print_r($this->dataStore("temperaturedata")->toArray());
Table::create(array(
"dataSource"=>$this->dataStore('temperaturedata')
));
}else{
echo "No hay datos";
}
?>
</div>
Let KoolReport help you to make great reports. It's free & open-source released under MIT license.
Download KoolReport View demo