score:0
I had same issues, but after profiling my laravel application, I found that the issue is not highcharts but my queries to database were not optimzied, so I optimezed by avoiding to use Eloquent relationship or eager loading for heavy tables, You can also consider to use temporary tables,below is a sample of raw query in laravel.
public function countOutStanding()
{
$count= DB::select("SELECT count(1) as count FROM myTable");
return array_shift($count)->count;
}
score:6
This is actually not a Laravel issue. Before I get into the slow load times, if you want to return a script, you need to set the correct headers.
This:
return view('highchart.gauge')->with(compact('value' , 'divname','chartTitle','suffix','minValue','maxValue','colorMin','colorMed','colorMax'));
Should be this:
return response(view('highchart.gauge')->with(compact('value' , 'divname','chartTitle','suffix','minValue','maxValue','colorMin','colorMed','colorMax')), 200, ['Content-Type' => 'application/javascript']);
Now to answer the slow load times, you are loading...12 scripts or so? In order to minimize load times, you should minimize the number of roundtrips / have fewer HTTP requests. Each browser has a max number of simultaneous HTTP connections per server, which is what your image is illustrating. It's simultaneously loading 2 (or so?) scripts at a time.
In addition to this, you are using Laravel to parse your scripts rather than just simply serving a javascript file. That's a lot of overhead. So what do you need to do?
- Minimize HTTP requests.
- If possible, just serve a file rather than having the server parse the script.
One way to minimize HTTP requests is to send all the variables at once and then return the concatenated view. In order to concatenate views, you can just use the period like you would with strings:
return response(view(...) . view(...), 200, ['Content-Type' => 'application/javascript']);
Another way, which I would recommend, would be to move your highchart script to your public directory. Then, in your blade file, just store the variables in a javascript array. Your highchart script can then loop through that and initialize the chart(s).
Source: stackoverflow.com
Related Query
- php: laravel slow view render time when rendering javascript for highcharts
- Simple, Open source PHP wrapper for Highcharts library
- PHP in Javascript for PhantomJS + Highcharts
- Error: Data source must be a URL for refresh | console error | javascript | Highcharts
- How to render partial view for HighCharts and pass parameter in MVC?
- How to get Render Performance for Javascript based Charting Libraries?
- Javascript Highcharts v3.0.5 - How to hide Y Axis Title when using multiple Y Axis
- JavaScript error when using Highcharts
- Rails - convert date string into javascript date object for highcharts
- Highcharts too slow when plotting 4000 bars (rCharts)
- Labels are not rendering for plotLines highcharts
- Highcharts Line - When Y axis min is set to 0, connecting line isn't shown for consecutive 0 values
- Using PhantomJS to create HighCharts grahps server side for use in PDF creation (PHP) - results in exit code 11 from PHPs exec();
- HighCharts is slow to load data when building multiple charts
- when printing page with highcharts using javascript this.print() width values in css in @media print seem to be ignored
- Date / Time problem in javascript with highcharts
- Highcharts slow performance when adding more than 10 series
- How to remove outer shadow when hovered from highcharts JAVASCRIPT
- How to display line break for irregular time series with highcharts
- passing formatting JavaScript code to HighCharts with JSON
- How to do a if else statement for highcharts in laravel
- Get javascript highcharts to render inside a Bootstrap Popover
- Highcharts not working when pass the javascript variable as hightcharts series data
- Highcharts display label for pie chart using html table as data source
- How to specify specific tick positions for highcharts when loading dynamic data?
- Javascript not working when using async attribute : Highcharts
- Why doesn't HighCharts render when I pull it in with Ajax?
- Multidimensional JSON to javascript array for highcharts
- Php 2D array into javascript array in highcharts
- How to make hover effect for two bar in highcharts at the same time is there any way by using css or any inbuilt method to achieve this?
More Query from same tag
- How can I do dynamically updated HighCharts with StockCharts?
- highstock.js chart plotting is a bit off
- Highcharts - selection error with live data and different time intervals
- Highcharts, datetime, xAxis label. How to show all dates on x axis, not only even dates?
- put condition depending on the value HIGHCHARTS
- How to get id of clicked element in highchart contextmenu
- Issue with speedometer highcharts dynamically update guage range
- Highcharts Uncaught TypeError: Cannot set property 'day' of undefined
- accentued character Encoding issue with highcharter in Shiny
- How to update Highcharts with multiple series via JSON?
- Not able to update data for highcharts
- How to set minimum height of data element of series in stacked bar chart?
- Highcharts Treemap, drillup event
- Why can't I enter text into a textarea control that is inside of the highcharts-container div?
- Rails: Lazy_high_charts mapping issue
- Adding Text into Center of Pie Graph highcharts
- Highcharts & Angularjs: update chart from $broadcast in the main controller doesn't update the chart like a $watch would in the chart's controller
- blank page highchart in using jquery to call json arrary
- Prevent from executing previous JavaScript with turbolinks and highcharts //LazyHighCharts
- Highcharts setting the colour of columns in each month period
- Hide 0 values in Stacked Column Chart in Highcharts
- Highcharts: Double side's legend
- How do you process large amounts of data without using a database?
- Highcharts - Detail chart with stacked columns
- Gauge chart in ng2-highcharts
- Highchart Area Range chart with gradient that follows the line
- How to make highcharts stacked bar chart start from a specific date
- Highcharts how to draw dual axis negative stack bar?
- Strip/escape special characters from Google Spreadsheet field before passing data to Highcharts Graph
- Removing or Switching Events on Highcharts