Highcharts update without modifying Yii 1.1


(jstechg) #1

I need to use a more updated version of Highcharts on a web page working properly
and uses the Yii 1.1 and Highcharts version 2.1.9 framework.

This page also makes database access and calls Highcharts in order to paint a chart.

Browsing the source code of the page I see that the Highchars directories and files are found
on the following routes:

Highcharts Página web


./examples/ NOT AVAILABLE
./exporting-server/ myWebPage/protected/views/aplicaciones/exporting-server/
./graphics/ NOT AVAILABLE
./index.html NOT AVAILABLE
./js/highcharts.js myWebPage/protected/views/aplicaciones/js/highcharts.js
./js/highcharts.src.js myWebPage/protected/views/aplicaciones/js/highcharts.src.js
./js/adapters/ NOT AVAILABLE
./js/modules/ myWebPage/protected/views/aplicaciones/js/modules/
./js/themes/ myWebPage/protected/views/aplicaciones/js/themes/

I need to use a more modern version of Highcharts (version 4.0.4 or later).

In order to make a simple first test I have replaced the files on the web
and directories indicated in the previous table, which correspond to Highcharts 2.1.9 by those of
Highcharts 2.2.0 (which have very few variations) and when I open the web again in a browser some
errors appear:

TypeError: c.renderer.symbol(…) is undefined
highcharts.js:166:478
drawPoints http://localhost/myWebPage/protected/views/aplicaciones/js/highcharts.js:166
render http://localhost/myWebPage/protected/views/aplicaciones/js/highcharts.js:176
redraw http://localhost/myWebPage/protected/views/aplicaciones/js/highcharts.js:177
h http://localhost/myWebPage/protected/views/aplicaciones/js/highcharts.js:55
o http://localhost/myWebPage/protected/views/aplicaciones/js/highcharts.js:84
h http://localhost/myWebPage/protected/views/aplicaciones/js/highcharts.js:55
success http://localhost/myWebPage/protected/views/aplicaciones/aplicacionesjs/ShowChart.js:195
jQuery 4
n
fireWith
w
d

The ShowChart.js code is this:

14 var chart;

52 chart = new Highcharts.Chart({
53 chart: {
54 renderTo: ‘container’,
55 defaultSeriesType: ‘scatter’,
56 events: {
57 load: requestData
58 },

        . . .

147 for(i=0;i<json.length;i++)
148 {
. . .

193 chart.addSeries(json[i],false);
194 }
195 chart.redraw();

It seems that the problem is related to jQuery.

If I try to also update the jQuery version, the situation gets worse, because new errors appear in the Yii 1.1 framework.

Therefore, I think a solution (too complicated) could be to migrate the version of Yii from 1.1 to 2.0, with which I will already be using a more modern version of Highcharts.

I would like not to have to migrate the entire page from Yii 1.1 to Yii 2.0, since I only need to update the version of HighCharts and the migration from Yii 1.1 to Yii 2.0 is not easy, since it requires modifying the page code.

I am starting with the web development using Yii and Highcharts, but I have read in the Yii 1.1 manual and I conclude that Highcharts should be installed as an extension, copying its directories and files to the myWebPage/protected/extensions directory

Is it possible to upgrade the version of Highcharts to a more modern one while maintaining the functionality of Yii 1.1?

Should I overwrite the folders that are already on the web with Highcharts (I have tried this and it doesn’t work) or delete them and copy the new version of Highcharts to the folder myWebPage/protected/extensions?

Is there another better solution?

I am looking for the solution that is simpler.


(mbi) #2

there is a yii1 extension that works pretty well you can use with highcharts: https://github.com/miloschuman/yii-highcharts/tree/master/highcharts/assets


(jstechg) #3

Thanks, I am going to try.


(Softark) #4

IMO, since Highcharts is a self-contained javascript library, there’s not so much an extension can do for it. Publishing its assets might be the main (and probably only) job of an extension.

And there’s no need to upgrade the backend framework in order to use the latest version of Hightcharts.

So, I’d rather recommend the use of Highcharts through CDN.

https://www.highcharts.com/docs/getting-started/installation

That’s what I’m doing in my sites, including one on Yii 1.1.
For example this is a weather report page built with Yii 1.1 and Hightcharts