Cannot read property 'style' of null×
Catalinul95 opened this issue · 3 comments
What Version?
3.1.14
Issue
I am getting this error ( "Cannot read property 'style' of null" ) in a red box, when checking the html code, I found: "google-visualization-errors-all-1"
Controller Code (chart creation code)
$lava = new Lavacharts();
$entries = $lava->DataTable();
$query = Survey::select('country AS 0', \DB::raw('count(country) AS entries'))->groupBy('country')->get()->toArray();
$data = [];
foreach ($query as $q) {
$data[] = [$q[0], $q['entries']];
}
$entries->addStringColumn('Country')
->addNumberColumn('Popularity')
->addRow(array('Germany', 200))
->addRow(array('France', 200))
->addRow(array('Italy', 200));
$lava->GeoChart('Popularity', $entries);
return view('dashboard.homepage', ['colorsNum' => $colorsNum, 'lava' => $lava]);
View Code
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-body">
<div id="pop-div"></div>
// With the lava object
<?= $lava->render('GeoChart', 'Popularity', 'pop-div') ?>
</div>
</div>
</div>
It loos like you are using Laravel so you should be using the service provider examples \Lava::GeoChart()
for example.
The class is a singleton within the service provider, so you don't have to do $lava = new Lavacharts();
that
and then calls like $lava->
should be \Lava::
and you don't have to pass anything to the view.
There are blade aliases available and you would again, in the view, reference the service provider.
It does not work, I remember that I tried the static ones too. I was using Laravel 8, I gave up and used directly google's API for maps.
fair enough, I don't have time anymore to work on this, I apologize. It was my passion project before my real-life, living passion project was born (my daughter) 😅