It is currently Sat Aug 02, 2014 2:23 am Advanced search

addPoint and setData methods do not work at all in Highstock

Technical support for the Highcharts Stock package

addPoint and setData methods do not work at all in Highstock

Postby dstondin » Fri Jul 22, 2011 8:20 pm

It is impossible to add data in any way to an existing chart in Highstock without a complete destroy of the chart and re init.
addPoint and setData results in the following javascript error.
Code: Select all
Uncaught TypeError: Property 'destroy' of object #<Object> is not a function


Help?
dstondin
 
Posts: 5
Joined: Thu Mar 24, 2011 12:11 am

Re: addPoint and setData methods do not work at all in Highstock

Postby dre3k » Sat Jul 23, 2011 9:54 am

I confirm that addPoint doesn't work. Below is error that I'm getting in Firebug
Code: Select all
TypeError: graph is undefined
http://127.0.0.1:3000/javascripts/vendor/highstock/highstock.src.js?1310126094
Line 9274


setData works only when navigator option of chart set to:
Code: Select all
{ enabled: false }

But setData seems to be very very slow even on small arrays.

Please release a patch or next beta version, that we could to continue to betatest.

PS. Is there a git repo of highstock? I've only found a highcharts repo here: https://github.com/highslide-software/highcharts.com
dre3k
 
Posts: 2
Joined: Sat Jul 23, 2011 9:30 am

Re: addPoint and setData methods do not work at all in Highstock

Postby hfrntt » Sun Jul 24, 2011 2:17 am

It's the same repository, just switch the branch.

Both issues (with setData and addPoint) are already known and has its ticket on github (https://github.com/highslide-software/h ... issues/302, https://github.com/highslide-software/h ... issues/307)
Slawek Kolodziej
Highcharts support team
hfrntt
 
Posts: 6394
Joined: Mon Aug 30, 2010 10:41 am

Re: addPoint and setData methods do not work at all in Highstock

Postby dre3k » Wed Aug 10, 2011 12:26 pm

I got addPoint to work simply substituting every word 'graph' for 'chart' inside addPoint function.
dre3k
 
Posts: 2
Joined: Sat Jul 23, 2011 9:30 am

Re: addPoint and setData methods do not work at all in Highstock

Postby paco » Tue Aug 30, 2011 1:59 am

I just tried that and I dont think I saw any difference. Still having issues using addPoint(), especially with multiple series...
paco
 
Posts: 13
Joined: Tue Aug 30, 2011 12:58 am

Re: addPoint and setData methods do not work at all in Highstock

Postby torstein.honsi » Fri Sep 02, 2011 3:21 pm

Make sure you're using the latest code: https://raw.github.com/highslide-softwa ... ock.src.js
Torstein Hønsi
CTO, Founder
Highsoft Solutions
User avatar
torstein.honsi
Site Admin
 
Posts: 9190
Joined: Thu Nov 09, 2006 1:22 pm
Location: Vik i Sogn, Norway

Re: addPoint and setData methods do not work at all in Highstock

Postby lennybacon » Sun Sep 04, 2011 7:26 pm

With the latest code (link in the post above) I get the following error:

graph is undefined
currentShift = graph.shift || 0,

Looking at the code this not seems to be fixed yet :-(

*/
addPoint: function (options, redraw, shift, animation) {
var series = this,
data = series.data,
graph = series.graph,
area = series.area,
chart = series.chart,
xData = series.xData,
yData = series.yData,
currentShift = graph.shift || 0,
dataOptions = series.options.data,
point;
//point = (new series.pointClass()).init(series, options);
lennybacon
 
Posts: 4
Joined: Thu Aug 11, 2011 12:33 pm

Re: addPoint and setData methods do not work at all in Highstock

Postby eolsson » Tue Sep 06, 2011 1:49 pm

Could you set up an example where it fails? Maybe we need to reopen the bug, but we need good repro-steps first.
Erik Olsson
Highsoft Solutions AS
eolsson
 
Posts: 396
Joined: Tue May 03, 2011 1:07 pm

Re: addPoint and setData methods do not work at all in Highstock

Postby cheli » Wed Sep 07, 2011 10:01 am

Same problem: setData doesn't work and sometimes it causes memory leaks (in IE). Here's my code:

.....
....

$(document).ready(function() {

chartMaster = new Highcharts.StockChart({

chart: {
renderTo: 'master_container',
events: {
load: requestData
}
},


xAxis: {
type: 'datetime',
maxZoom: 3600000 // One Hour
},


rangeSelector: {
selected: 1
},

series: [{
name: 'download',
data: []
}
]
});
});

where requestData is:



function requestData() {
$.ajax({
url: 'get_data.php',
success: function(dataArray)

var sample_details = eval('(' + dataArray + ')');
var currTotalsampleData = [];
currTotalsampleData = sample_details.totalsample;
chartMaster.series[0].setData(currTotalsampleData);
chartMaster.redraw();


setTimeout(requestData, 1000);
},
cache: false
});


}

dataArray is a JSON array like this:

{"totalsample":[[1315381680000,62918],[1315381740000,51083],[1315381800000,27870],[1315381860000,25855],[1315381920000,64998],[1315381980000,120929],[1315382040000,66733],[1315382100000,132576],[1315382160000,111381],[1315382220000,49501]]}

Thank you.
cheli
 
Posts: 5
Joined: Wed Sep 07, 2011 9:47 am

Re: addPoint and setData methods do not work at all in Highstock

Postby cheli » Wed Sep 07, 2011 11:08 am

I forgot: same code works well using highcharts instead of highstock....
cheli
 
Posts: 5
Joined: Wed Sep 07, 2011 9:47 am

Re: addPoint and setData methods do not work at all in Highstock

Postby cheli » Wed Sep 07, 2011 11:49 am

I resolved putting a reference to:

<script type="text/javascript" src="https://raw.github.com/highslide-software/highcharts.com/stock2/js/highstock.src.js"></script>

instead of
<script type="text/javascript" src="../js/highstock.js">

in my htm file
cheli
 
Posts: 5
Joined: Wed Sep 07, 2011 9:47 am

Re: addPoint and setData methods do not work at all in Highstock

Postby john.sanders24 » Sun Sep 11, 2011 5:00 pm

Can someone tell me why isnt this working?..
http://jsfiddle.net/7m9Ma/7/
john.sanders24
 
Posts: 28
Joined: Sat Sep 10, 2011 2:02 pm

Re: addPoint and setData methods do not work at all in Highstock

Postby hfrntt » Mon Sep 12, 2011 11:48 pm

In your example you used highcharts version without bug fixes, see: http://jsfiddle.net/hfrntt/7m9Ma/22/
Slawek Kolodziej
Highcharts support team
hfrntt
 
Posts: 6394
Joined: Mon Aug 30, 2010 10:41 am

Re: addPoint and setData methods do not work at all in Highstock

Postby herreramariano » Wed Sep 21, 2011 5:13 pm

hfrntt wrote:In your example you used highcharts version without bug fixes, see: http://jsfiddle.net/hfrntt/7m9Ma/22/

In that example is supposed to work ok? I see

Code: Select all
$('#button').click(function() {
    chart.series[0].setData([Date.UTC(2003,8,24),0.8709],
[Date.UTC(2003,8,25),0.872],
[Date.UTC(2003,8,26),0.8714],
[Date.UTC(2003,8,29),0.8638],
[Date.UTC(2003,8,30),0.8567],
[Date.UTC(2003,9,1),0.8536],
[Date.UTC(2003,9,2),0.8564],
[Date.UTC(2003,9,3),0.8639],
[Date.UTC(2003,9,6),0.8538],
[Date.UTC(2003,9,7),0.8489],
[Date.UTC(2003,9,8),0.8459] );
});   


this should set 11 points to the chart, but when I click on the button, the chart refresh with only 2 points on the 1/1/1970 with a long value on the first and 0.8709 on the second.
herreramariano
 
Posts: 17
Joined: Fri Sep 02, 2011 5:43 pm

Re: addPoint and setData methods do not work at all in Highstock

Postby hfrntt » Thu Sep 22, 2011 7:18 pm

I missed one pair of parenthesis, see updated version: http://jsfiddle.net/hfrntt/7m9Ma/24/
Slawek Kolodziej
Highcharts support team
hfrntt
 
Posts: 6394
Joined: Mon Aug 30, 2010 10:41 am

Next

Return to Highstock Usage

Who is online

Users browsing this forum: Bing [Bot] and 2 guests