Hi all,
I am using LeftJoin to merge two dataStores and display graph as attached below.
Simple example of query
$myData= $this->src('automaker')
->query("SELECT
Datum,
Kolicina,
PrometAktuelna,
Dobavljac
FROM
my_table
LIMIT 12
");
$myData->pipe($this->dataStore("spojene_trenutna"));
And I join data in the View with:
$new_store = $this->dataStore('spojene_star_pret')->leftJoin($this->dataStore('spojene_trenutna'),array(
"Datum"=>"Datum"
));
The thing is that query above (year 2021) does not return all 12 entries (12 months data) and it contains only (as marked with arrow on image below) Jan data. For that reason, graph does not show names of all months. You can see "null" on the side. Only Jan is display.
I am wondering how to fix that? I was thinking to re-create $myData and inject missing months, values with something like this:
$aktuelna = array(
array( "Datum" => "Jan", "Kolicina" => 23135, "PrometAktuelna" => 2224.96, "Dobavljac" => 1675 ),
array( "Datum" => "Feb", "Kolicina" => 0, "PrometAktuelna" => 0.00, "Dobavljac" => 0 ),
array( "Datum" => "Mar", "Kolicina" => 0, "PrometAktuelna" => 0.00, "Dobavljac" => 0 ),
array( "Datum" => "Apr", "Kolicina" => 0, "PrometAktuelna" => 0.00, "Dobavljac" => 0 ),
// ....
// .....
);
I have tried but does not work with this array. I believe there is easier way to get desired result.