Creating charts is often a pain because of how you have to convert your data into what the charting library supports and each library is different.
To help make this easier Erik Campobadal created a new Laravel chart package to create interactive charts. It supports a dozen of the most popular charting libraries from standard line and bar charts, to real time charting libraries.
To create your own chart it uses a familiar fluent syntax
1Charts::multi('line', 'highcharts')2 ->setColors(['#ff0000', '#00ff00', '#0000ff'])3 ->setLabels(['One', 'Two', 'Three'])4 ->setDataset('Test 1', [1,2,3])5 ->setDataset('Test 2', [0,6,0])6 ->setDataset('Test 3', [3,4,1]);
Plus you can also create charts directly from your database:
1$chart = Charts::database(User::all(), 'bar', 'highcharts')2 ->setElementLabel("Total")3 ->setDimensions(1000, 500)4 ->setResponsive(false)5 ->groupByDay();
Real time charts can be setup like this:
1$chart = Charts::realtime(url('/path/to/json'), 1000, 'area', 'highcharts')2 ->setResponsive(false)3 ->setHeight(300)4 ->setWidth(0)5 ->setTitle("Permissions Chart")6 ->setMaxValues(10);
For more information check out the official GitHub repo or watch the tutorial video:
This charting library supports a ton of options and seems to be really powerful for all your charting needs.