Rails beginner
Rails beginner

Reputation: 14504

Highstocks compare stocks how to define data?

I am wondering how data is defined to create a Highstock graph.

Here is the jsfiddle: http://jsfiddle.net/gh/get/jquery/1.6/highslide-software/highcharts.com/tree/master/samples/stock/demo/compare/

How to define data as [4, 5, 6] and startpoint?

Upvotes: 1

Views: 2290

Answers (1)

eolsson
eolsson

Reputation: 12727

The data in the example you linked is defined as an array consisting of [<timestamp>, <value>], (inlined in this example):

[[1103500800000,185.02],
[1103587200000,183.75],
[1103673600000,186.30],
[1103760000000,187.90],
[1104105600000,191.91],
[1104192000000,192.76],
...]

But you can use pointStart and pointInterval to specify the data as well but that will only work if all data points have equal distance between each other (example).

pointStart: 1103500800000,
pointInterval: 1000 * 3600 * 24,
data: [185.02,
       183.75,
       186.30,
       187.90,
       191.91,
       ...]

Upvotes: 4

Related Questions