]> git.proxmox.com Git - extjs.git/blame - extjs/build/examples/kitchensink/classic/samples/view/charts/line/Plot.js
add extjs 6.0.1 sources
[extjs.git] / extjs / build / examples / kitchensink / classic / samples / view / charts / line / Plot.js
CommitLineData
6527f429
DM
1/**\r
2 * This example shows how to create a Plot chart with floating axes linked to each other\r
3 * at the origin. Floating axes can track a value on another axis running in the oppsosite\r
4 * direction. This is handy for visualizing mathematical functions. Try zooming and panning\r
5 * the chart to see the effect.\r
6 *\r
7 * To zoom the chart, use the pinch-in/pinch-out gestures, if you are on a mobile device.\r
8 * Or click and drag, if you are using a desktop browser. Click and drag also acts as a\r
9 * panning gesture on desktops. You can use the Pan/Zoom toggle in the upper-left corner\r
10 * of the chart to switch modes.\r
11 */\r
12Ext.define('KitchenSink.view.charts.line.Plot', {\r
13 extend: 'Ext.panel.Panel',\r
14 xtype: 'line-plot',\r
15 controller: 'line-plot',\r
16\r
17 requires: [\r
18 'Ext.chart.CartesianChart',\r
19 'Ext.chart.interactions.PanZoom',\r
20 'Ext.chart.series.Bar',\r
21 'Ext.chart.axis.Numeric',\r
22 'Ext.chart.axis.Category'\r
23 ],\r
24\r
25 // <example>\r
26 // Content between example tags is omitted from code preview.\r
27 otherContent: [{\r
28 type: 'Controller',\r
29 path: 'classic/samples/view/charts/line/PlotController.js'\r
30 }, {\r
31 type: 'Store',\r
32 path: 'classic/samples/store/Plot.js'\r
33 }],\r
34 // </example>\r
35 layout: 'fit',\r
36 width: 650,\r
37\r
38 tbar: {\r
39 reference: 'toolbar',\r
40 items: [\r
41 '->',\r
42 {\r
43 text: 'Next function',\r
44 handler: 'onRefresh'\r
45 },\r
46 {\r
47 text: 'Preview',\r
48 handler: 'onPreview'\r
49 },\r
50 {\r
51 text: 'Reset pan/zoom',\r
52 handler: 'onPanZoomReset'\r
53 }\r
54 ]\r
55 },\r
56\r
57 items: [{\r
58 xtype: 'cartesian',\r
59 reference: 'chart',\r
60 height: 500,\r
61 store: {\r
62 type: 'plot'\r
63 },\r
64 padding: 10,\r
65 insetPadding: 0,\r
66 interactions: {\r
67 type: 'panzoom',\r
68 zoomOnPanGesture: true\r
69 },\r
70 // <example>\r
71 // TODO: must be able to control how series are displayed\r
72 // TODO: for undefined data points (apply fillStyle to the series\r
73 // TODO: to see the issue)\r
74 // </example>\r
75 series: [\r
76 {\r
77 type: 'line',\r
78 xField: 'x',\r
79 yField: 'y1',\r
80 style: {\r
81 lineWidth: 2,\r
82 strokeStyle: 'rgb(0, 119, 204)'\r
83 }\r
84 }\r
85 // <example>\r
86// TODO: The second line series does not render correctly, it should look the same\r
87// TODO: as the blue series will look on next refresh button tap, but doesn't,\r
88// TODO: even though the data looks alright.\r
89// TODO: add 'me.fn[(me.fnIndex + 1) % me.fn.length]' to Plot store's traverseFunctions\r
90// TODO: as a third parameter to test this.\r
91// TODO: {\r
92// TODO: type: 'line',\r
93// TODO: xField: 'x',\r
94// TODO: yField: 'y2',\r
95// TODO: style: {\r
96// TODO: lineWidth: 2,\r
97// TODO: lineDash: [3, 3],\r
98// TODO: strokeStyle: 'rgb(230, 119, 204)'\r
99// TODO: }\r
100// TODO: }\r
101 // </example>\r
102 ],\r
103 axes: [\r
104 {\r
105 type: 'numeric',\r
106 position: 'left',\r
107 fields: ['y1'],\r
108 titleMargin: 20,\r
109 title: {\r
110 text: 'f(x)',\r
111 fillStyle: 'rgb(255, 0, 136)'\r
112 },\r
113 minimum: -4,\r
114 maximum: 4,\r
115 minorTickSteps: 3,\r
116 style: {\r
117 minorTicks: true,\r
118 minorTickSize: 4,\r
119 majorTickSize: 7\r
120 },\r
121 floating: {\r
122 value: 0,\r
123 alongAxis: 1\r
124 },\r
125 grid: true\r
126 },\r
127 {\r
128 type: 'numeric',\r
129 position: 'bottom',\r
130 fields: ['x'],\r
131 titleMargin: 6,\r
132 minorTickSteps: 3,\r
133 style: {\r
134 minorTicks: true,\r
135 minorTickSize: 4,\r
136 majorTickSize: 7\r
137 },\r
138 title: {\r
139 text: 'x',\r
140 fillStyle: 'rgb(255, 0, 136)'\r
141 },\r
142 floating: {\r
143 value: 0,\r
144 alongAxis: 0\r
145 },\r
146 grid: true\r
147 }\r
148 ]\r
149 }],\r
150\r
151 listeners: {\r
152 afterrender: 'onAfterRender'\r
153 }\r
154\r
155});\r