mercredi 2 janvier 2019

Google GeoChart (library Lavacharts) -> AddRow / AddRows not rendering any result on map despite array of values is created

Issue:

Laravel GeoChart Library to Render Google Visualization -> AddRow / AddRows not rendering any result on map despite array of values is created.

Controller Code (chart creation code)

$countryIso = ['US','CA','BR']; 
foreach ($countryIso as $isocode) {
            $productDDP[$isocode] = $this->product->priceCalc($product = $product, $countryIso = $isocode);
        }

View Results: using different variants of Code and giving errors:

If I print the result of print_r($productDDP);

it displays the following code:

Array
(
    [US] => 900
    [CA] => 1,276
    [BR] => 1,215
)

I tried different approaches:

with ->addRows(array($productDDP)); "Invalid number of cells, must be less than or equal to the number of columns."

with ->addRow(array($productDDP)); or using ->addRow([$productDDP]);

Argument 3 passed to Khill\Lavacharts\DataTables\Cells\Cell::__construct() must be of the type array, string given

with ->addRows($productDDP);

Argument 1 passed to Khill\Lavacharts\DataTables\DataTable::addRow() must be of the type array or null, string given

with ->addRow(array([$productDDP]))

Render the chart but no value is set on the map.

Questions?
  • What I have to use for that kind of arrays?
  • addRow or addRows?.
  • In which format do we have to pass array data for addRow/s?

any help appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire