You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run composer show khill/lavacharts if you don't know
Version 3.1
Issue
Please describe the issue.
Hi, I'm trying to do a geo chart with LavaCharts, and I wanted to add more columns.
Like I would like to have Country, Users, Description, Etc. (another column from the database).
I did some code but when I refresh my page appears without the 'Country' label/text
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Khill\Lavacharts\Lavacharts;
use App\Visitor;
class VisitorController extends Controller
{
public function index(){
$lava = new Lavacharts;
$data = Visitor::select( "country as -1","description as 0","users as 1")->get()->toArray();
$popularity= $lava->DataTable()
->addStringColumn("Country")
->addStringColumn("Description")
->addNumberColumn("Users ")
->addRows($data);
$lava->GeoChart("Popularity", $popularity);
return view("visitor",["lava"=>$lava]);
}
}
(Controller)
Model
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Visitor extends Model
{
protected $fillable=['country','description','users'];
}
(Model)
blade:
`
<div id="visitor" style="width:80%;margin:0 auto;"></div>
<?=$lava->render("GeoChart","Popularity","visitor");?>
`
web.php:
` Route::get('/visitor', 'VisitorController@index')->name('visitor');`
If i do something like this :
$popularity = $lava->DataTable();
$popularity->addStringColumn('Country')
->addNumberColumn('Popularity')
->addStringColumn('Desc')
->addRow(array('Germany', 200,'asdad'))
->addRow(array('United States', 300,'asdad'))
->addRow(array('Brazil', 400,'asdad'))
->addRow(array('Canada', 500,'asdad'))
->addRow(array('France', 600,'asdad'))
->addRow(array('RU', 700,'asdad'));
The error is: Incompatible data table: Error: Table contains more columns than expected (Expecting 2 columns)×
The text was updated successfully, but these errors were encountered:
What Version?
Issue
Hi, I'm trying to do a geo chart with LavaCharts, and I wanted to add more columns.
Like I would like to have Country, Users, Description, Etc. (another column from the database).
I did some code but when I refresh my page appears without the 'Country' label/text
the blade view, here you can see how my data/columns from database are, missing Country, and the description doesn't have a column, it just appears as a label.
Controller Code (chart creation code)
(Controller)
Model
The text was updated successfully, but these errors were encountered: