It is currently Tue Jul 29, 2014 2:44 pm Advanced search

creating a chart manipulates external options object

Technical support for the Highcharts Stock package

creating a chart manipulates external options object

Postby Gregor » Thu Feb 16, 2012 4:41 pm

In Version 2.2.0 creating a "Chart" object manipulates the external options object!


Code: Select all
5120 function Chart(options, callback) {
5121
5122      // Handle regular options
5123        var seriesOptions = options.series; // skip merging data points to increase performance
5124        options.series = null;
5125        options = merge(defaultOptions, options); // do the merge
5126     options.series = seriesOptions; // set back the series data


- line 5124 "deletes" the series information from the original options object
- line 5125 creates a new options object (merge creates a new object)
- line 5126 will set the series data at the new object

=> the series data from the original object is gone.....
Gregor
 
Posts: 10
Joined: Wed Jul 13, 2011 3:02 pm

Re: creating a chart manipulates external options object

Postby hfrntt » Wed Feb 22, 2012 5:02 pm

It works in highstock for a bit of time now. If you take a look one line above (5123), you can read about the reason of this behavior - performance issue.
Slawek Kolodziej
Highcharts support team
hfrntt
 
Posts: 6394
Joined: Mon Aug 30, 2010 10:41 am

Re: creating a chart manipulates external options object

Postby Gregor » Sat Feb 25, 2012 6:56 pm

Yes, i understand the reason.
But (IMHO) manipulating the external objects is a very bad idea.

To work around this "performance fix" i have to clone my options object ...
=> I have a perfomance drop and not aperformance boost.
Gregor
 
Posts: 10
Joined: Wed Jul 13, 2011 3:02 pm

Re: creating a chart manipulates external options object

Postby Gregor » Fri Mar 16, 2012 11:05 pm

Nice, in the current release this problem is fixed.

Thanks !!
Gregor
 
Posts: 10
Joined: Wed Jul 13, 2011 3:02 pm

Re: creating a chart manipulates external options object

Postby juliek » Mon Sep 17, 2012 7:35 pm

I'm having this same problem using the latest version of highstocks. After I pass my options object to Highcharts.chart, the series information in the original object becomes null.
juliek
 
Posts: 16
Joined: Tue Jun 26, 2012 3:08 am

Re: creating a chart manipulates external options object

Postby Fusher » Tue Sep 18, 2012 1:46 pm

If you need your data for future reference, pass copy of this data to the options object.
Paweł Fus
Highcharts support team
Fusher
 
Posts: 6566
Joined: Mon Jan 30, 2012 12:16 pm


Return to Highstock Usage

Who is online

Users browsing this forum: No registered users and 5 guests