score:0
In your model;
use this
public function getCreatedAtAttribute($value)
{
return date('m/d/Y', strtotime($value));
}
score:1
Turns out, it was the 'dates' variable causing the problem (in addition to a syntax error). Chartjs was looking for an array like:
["2015/06/08", 2015/06/13", "2015/6/20"]
instead of the collection object from the eloquent query.
So I ran $dates = array_column($inventories->toArray(), 'updated_at');
to get the array, then reformatted the dates by running:
foreach ($dates as $date){
$formatted_dates[] = date('m/d/Y', strtotime($date));
}
Then I passed $formatted_dates
to the view.
I'm sure there's a better way, but I'm learning more everyday and it works for me!
Source: stackoverflow.com
Related Query
- Using chart.js with laravel passing data from controller to view
- Using data from API with Chart JS
- How to display chart using Chartjs with JSON data in Laravel
- How to display variables from Laravel controller to view javascript with specific index
- Passing data from a controller to ChartJS - Laravel
- Displaying Chart with data retrieved from Entity Framework in Controller
- Chartjs random colors for each part of pie chart with data dynamically from database
- ChartJS (React) Line Chart - How to show single tooltip with data and labels from 3 (multiple) dataset?
- How to create chartjs chart with data from database C#
- How to get chart from data points (arrays) with inconsistent time intervals and chart.js?
- Passing an Array from a Flask view to the javascript code of another view
- Initialize a Chart.js chart with data from an api
- Populating Chart.Js line graph with multiple lines using data from a JSON Object
- How to get Data from API to display chart using chartjs in Vuejs
- Passing Data from Controller to ChartJS
- How to create a chart with chartjs.org with data from an array?
- Line Chart using Chart js with time data
- Real-time line chart with ChartJS using Ajax data
- Visualization of charts using real time data from MSSQL with node.js webserver
- The chart doesn't display the data from my call to the API with Axios
- Send data from php to chart with ajax
- Chart.js not rendering chart with data from mySQL database
- Using number/text input field to set the data values in ChartJs stops the chart from being displayed
- Live updating chart with data from database with Chart.js
- Chart.js chart by passing data through the controller MVC
- Changing chart data dynamically with C# from SQL database
- Create a pie chart using an array from a data table in chart.js
- How to create a chart.js scatter chart with data from two lists
- How to pass a chart.js chart data object in json from a controller in asp.net mvc
- getting additional value fields from data source for dx.chartjs doughnut chart
More Query from same tag
- Is it possible to have a canvas next to another canvas without space on the bottom?
- Change color on labels in chart.js
- Chart.js line graph not displaying when using formatted timestamp labels
- Multi-colored legend stacked bar chart Chartjs
- How to plot an equation using ChartJS?
- How to include Chart.js in my AngularJS project?
- Chart js always show labels on a doughnut chart
- How to order a horizontal bar chart - chartJS & Chart.HorizontalBar.js
- Make chartjs pie chart wiyh dynamic data
- HTML file won't generate anything on webpage using Chart.js
- How to put rounded corners on a Chart.js Bar chart
- How to change the display of an axis Chart.js
- How to increase space between label and chart area in chart.js
- is it possible to get time in box charts in chartjs?
- ChartJS non overlapping lines
- Chart.js - how to add a second data line to the line graph
- How to add ChartJS code in Html2Pdf to view image
- Adding a Label to Chart js Pie Graph
- Customize Chart js dataset data
- Chart.js lost its colors
- Limit data in Chart.js with Flask/SQLAlchemy in python
- Unable to Draw Chart using ChartJS
- How implement Chart.js in Angular 2?
- Draw asynchronous information on a graph with VueJS
- Flask Socketio | Update and plot a chart using background tasks created by Flask Executor or ThreadPoolExecutor
- Second dataset with single point makes y axis too big on Chart.js
- Chart.js wrong x axis date time?
- Ng2-charts Time xAxes : unwanted high zoom on click
- ng2-Chart: can we show the tooltip data of pie chart on load?
- Gantt Chart Variation with Chart JS or other libraries