-
Notifications
You must be signed in to change notification settings - Fork 14
/
standalone.js
97 lines (90 loc) · 2.03 KB
/
standalone.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
Ext.Loader.setConfig({
enabled : true,
disableCaching : false, // For debug only
paths : {
'Chart' : 'Chart'
}
});
Ext.require('Chart.ux.HighStock');
Ext.application({
name : 'HighStock',
launch : function() {
Ext.define('StockData', {
extend : 'Ext.data.Model',
fields : [{
name : 'time',
mapping : 0
}, {
name : 'price',
mapping : 1
}]
});
// Use JSONP store for
// http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&callback=?
var store = Ext.create('Ext.data.Store', {
model : 'StockData',
proxy : {
type : 'jsonp',
url : 'http://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json',
reader : {
type : 'array'
}
},
autoLoad : false
});
var win = Ext.create('Ext.Window', {
width : 800,
height : 600,
minHeight : 400,
minWidth : 550,
hidden : false,
shadow : false,
maximizable : true,
title : 'Highstock example',
renderTo : Ext.getBody(),
layout : 'fit',
tbar : [{
text : 'Reload Data',
handler : function() {
store.load();
}
}],
items : [{
xtype : 'highstock',
id : 'chart',
series : [{
name : 'AAPL',
tooltip : {
yDecimals : 2
},
xField : 'time',
yField : 'price'
}],
height : 500,
width : 700,
store : store,
chartConfig : {
chart : {
marginLeft : 50,
marginRight : 50
},
credits : {
href : 'http://joekuan.wordpress.com',
text : 'Joe Kuan (joekuan.wordpress.com)',
style : {
color : '#898989'
}
},
rangeSelector : {
selected : 1
},
title : {
text : 'AAPL Stock Price'
}
}
}]
});
win.show();
store.load();
}
});