]> git.proxmox.com Git - extjs.git/blame - extjs/build/examples/kitchensink/classic/samples/view/charts/financial/OHLC.js
add extjs 6.0.1 sources
[extjs.git] / extjs / build / examples / kitchensink / classic / samples / view / charts / financial / OHLC.js
CommitLineData
6527f429
DM
1/**\r
2 * This example shows how to create an OHLC chart. OHLC charts are financial charts that\r
3 * allow one to visualize the open/high/low/close values of a stock.\r
4 *\r
5 * The example makes use of two interactions: 'crosshair' (default) and 'panzoom'. The gear\r
6 * icon can be used to switch between the two.\r
7 */\r
8Ext.define('KitchenSink.view.charts.financial.OHLC', {\r
9 extend: 'Ext.Panel',\r
10 xtype: 'financial-ohlc',\r
11 controller: 'financial-candlestick',\r
12\r
13 requires: [\r
14 'Ext.chart.CartesianChart',\r
15 'Ext.chart.series.Line',\r
16 'Ext.chart.axis.Numeric',\r
17 'Ext.draw.modifier.Highlight',\r
18 'Ext.chart.axis.Time',\r
19 'Ext.chart.interactions.ItemHighlight'\r
20 ],\r
21\r
22 // <example>\r
23 // Content between example tags is omitted from code preview.\r
24 otherContent: [{\r
25 type: 'Controller',\r
26 path: 'classic/samples/view/charts/financial/CandlestickController.js'\r
27 }, {\r
28 type: 'Store',\r
29 path: 'classic/samples/store/StockPrice.js'\r
30 }],\r
31 // </example>\r
32 layout: 'fit',\r
33 width: 650,\r
34\r
35 tbar: [\r
36 '->',\r
37 {\r
38 text: 'Refresh',\r
39 handler: 'onRefresh'\r
40 },\r
41 {\r
42 xtype: 'segmentedbutton',\r
43 width: 270,\r
44 defaults: {\r
45 ui: 'default-toolbar'\r
46 },\r
47 items: [\r
48 {\r
49 text: 'Crosshair',\r
50 pressed: true\r
51 },\r
52 {\r
53 text: 'Pan'\r
54 },\r
55 {\r
56 text: 'Zoom'\r
57 }\r
58 ],\r
59 listeners: {\r
60 toggle: 'onModeToggle'\r
61 }\r
62 },\r
63 {\r
64 text: 'Reset pan/zoom',\r
65 handler: 'onPanZoomReset'\r
66 }\r
67 ],\r
68\r
69 items: [{\r
70 xtype: 'cartesian',\r
71 reference: 'chart',\r
72 width: '100%',\r
73 height: 500,\r
74 insetPadding: 20,\r
75 store: {\r
76 type: 'stock-price'\r
77 },\r
78 interactions: [\r
79 {\r
80 type: 'panzoom',\r
81 enabled: false,\r
82 zoomOnPanGesture: false,\r
83 axes: {\r
84 left: {\r
85 allowPan: false,\r
86 allowZoom: false\r
87 },\r
88 bottom: {\r
89 allowPan: true,\r
90 allowZoom: true\r
91 }\r
92 }\r
93 },\r
94 {\r
95 type: 'crosshair',\r
96 axes: {\r
97 label: {\r
98 fillStyle: 'white'\r
99 },\r
100 rect: {\r
101 fillStyle: '#344459',\r
102 opacity: 0.7,\r
103 radius: 5\r
104 }\r
105 }\r
106 }\r
107 ],\r
108 series: [\r
109 {\r
110 type: 'candlestick',\r
111 xField: 'time',\r
112 openField: 'open',\r
113 highField: 'high',\r
114 lowField: 'low',\r
115 closeField: 'close',\r
116 style: {\r
117 ohlcType: 'ohlc',\r
118 barWidth: 10,\r
119 opacity: 0.9,\r
120 dropStyle: {\r
121 fill: 'rgb(237,123,43)',\r
122 stroke: 'rgb(237,123,43)'\r
123 },\r
124 raiseStyle: {\r
125 fill: 'rgb(55,153,19)',\r
126 stroke: 'rgb(55,153,19)'\r
127 }\r
128 }\r
129 }\r
130 ],\r
131 axes: [\r
132 {\r
133 type: 'numeric',\r
134 fields: ['open', 'high', 'low', 'close'],\r
135 position: 'left',\r
136 maximum: 1000,\r
137 minimum: 0\r
138 },\r
139 {\r
140 type: 'time',\r
141 fields: ['time'],\r
142 position: 'bottom',\r
143 visibleRange: [0, 0.3]\r
144 }\r
145 ]\r
146 }]\r
147\r
148});\r