It is currently Thu Apr 24, 2014 2:40 am Advanced search

Infinite Loop caused by data?

Technical support for the Highcharts Stock package

Infinite Loop caused by data?

Postby lfoust » Mon Feb 13, 2012 9:55 am

I am hitting what appears to be an infinite loop which seems to be related to the data I am trying to render.When I run this page (with all the references in place) the browser runs indefinitely until I manually kill it. The reason I think it is related to data is because if I limit the data to just the first series then the chart renders correctly. Since I am unable to attach the html file, I'll paste the contents here:
-------------------------------
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Chart Repro</title>
<script type="text/javascript" src="jquery-1.6.4.js"></script>
<script type="text/javascript" src="jquery-ui-1.8.16.js"></script>
<script type="text/javascript" src="highstock.js"></script>
<script type="text/javascript" src="modules/exporting.js"></script>
<script type="text/javascript">
$(function () {
var data = [
{
"name": "Series 1",
"data": [[1321142400000, 8], [1322352000000, 5], [1322956800000, 2], [1326585600000, 2], [1327190400000, 4], [1327795200000, 1]]
},
{
"name": "Series 2",
"data": [[1321142400000, 1], [1321747200000, 6], [1322352000000, 16], [1322956800000, 18], [1323561600000, 7], [1323561600000, 9], [1325980800000, 9], [1325980800000, 8], [1326585600000, 20], [1327190400000, 14], [1327708800000, 18], [1328313600000, 19]]
},
{
"name": "Series 3",
"data": [[1322352000000, 16], [1322956800000, 18], [1324166400000, 14], [1325980800000, 12], [1325980800000, 16], [1327190400000, 14]]
},
{
"name": "Series 4",
"data": [[1319932800000, 4], [1321142400000, 5], [1321747200000, 1], [1322352000000, 8], [1322956800000, 10], [1323561600000, 4], [1324166400000, 9], [1325980800000, 8], [1326585600000, 1], [1327190400000, 1], [1327795200000, 8], [1328400000000, 6]]
},
{
"name": "Series 5",
"data": [[1319932800000, 21], [1321142400000, 22], [1321747200000, 1], [1321747200000, 27], [1322956800000, 20], [1323561600000, 31], [1324166400000, 16], [1325980800000, 8], [1326585600000, 1], [1327190400000, 28], [1327190400000, 25], [1328400000000, 17]]
},
{
"name": "Series 6",
"data": [[1323216000000, 5], [1323820800000, 8], [1324425600000, 4], [1325635200000, 6], [1327449600000, 5], [1327881600000, 5], [1328486400000, 6]]
}
];
window.chart = new Highcharts.StockChart({
chart: {
renderTo: 'placeholder'
},

rangeSelector: {
selected: 1
},

title: {
text: 'Repro'
},

series: data
});
});
</script>
</head>
<body>
<h1>Chart Repro</h1>
<div id="placeholder" style="width: 600px; height: 300px;">
</div>
</body>
</html>
lfoust
 
Posts: 1
Joined: Mon Feb 13, 2012 9:46 am

Re: Infinite Loop caused by data?

Postby hfrntt » Sun Feb 19, 2012 10:16 pm

Hi, sorry for late reply. Things like this can happen when your data are:
- not sorted by x value
- x value are repeated
In your case I suppose it's the second problem.
Slawek Kolodziej
Highcharts support team
hfrntt
 
Posts: 6394
Joined: Mon Aug 30, 2010 10:41 am

Re: Infinite Loop caused by data?

Postby coshxdave » Thu Mar 01, 2012 1:58 am

hfrntt wrote:Hi, sorry for late reply. Things like this can happen when your data are:
- not sorted by x value
- x value are repeated
In your case I suppose it's the second problem.


I think we may be encountering this problem as well. Could you please elaborate on the second condition? Can x values not be repeated between series? Or is the problem only if the data is repeated in a single series?
coshxdave
 
Posts: 5
Joined: Wed Feb 01, 2012 12:57 am

Re: Infinite Loop caused by data?

Postby hfrntt » Mon Mar 05, 2012 4:37 pm

Yes, x value has to be unique in each series data array. I mean, this:
Code: Select all
series: [{
  name: 'series 1',
  data: [
    [1, 1],
    [1, 2], // this is wrong
    [2, 3],
},{
  name: 'series 2',
  data: [
    [1, 3], // but you can use this value again in other series
    [2, 5],
}]
Slawek Kolodziej
Highcharts support team
hfrntt
 
Posts: 6394
Joined: Mon Aug 30, 2010 10:41 am


Return to Highstock Usage

Who is online

Users browsing this forum: No registered users and 2 guests