]>
Commit | Line | Data |
---|---|---|
947f0963 TL |
1 | /** |
2 | * This example shows how to create a line chart with a renderer function that changes the | |
3 | * stroke and fill colors when the line goes down. | |
4 | * | |
5 | * Line charts allow to visualize the evolution of a value over time, or the ratio between | |
6 | * any two values. | |
7 | */ | |
8 | Ext.define('KitchenSink.view.charts.line.Renderer', { | |
9 | extend: 'Ext.panel.Panel', | |
10 | xtype: 'line-renderer', | |
11 | controller: 'line-renderer', | |
12 | ||
13 | requires: [ | |
14 | 'Ext.chart.CartesianChart', | |
15 | 'Ext.chart.series.Line', | |
16 | 'Ext.chart.axis.Numeric', | |
17 | 'Ext.draw.modifier.Highlight', | |
18 | 'Ext.chart.axis.Time', | |
19 | 'Ext.chart.interactions.ItemHighlight' | |
20 | ], | |
21 | ||
22 | //<example> | |
23 | // Content between example tags is omitted from code preview. | |
24 | otherContent: [{ | |
25 | type: 'Controller', | |
26 | path: 'classic/samples/view/charts/line/RendererController.js' | |
27 | }, { | |
28 | type: 'Store', | |
29 | path: 'classic/samples/store/Pie.js' | |
30 | }], | |
31 | //</example> | |
32 | ||
33 | layout: 'fit', | |
34 | ||
35 | width: 650, | |
36 | ||
37 | tbar: [ | |
38 | '->', | |
39 | { | |
40 | text: 'Refresh', | |
41 | handler: 'onRefresh' | |
42 | } | |
43 | ], | |
44 | ||
45 | items: [{ | |
46 | xtype: 'cartesian', | |
47 | reference: 'chart', | |
48 | width: '100%', | |
49 | height: 500, | |
50 | store: { | |
51 | type: 'pie' | |
52 | }, | |
53 | interactions: { | |
54 | type: 'panzoom', | |
55 | zoomOnPanGesture: true | |
56 | }, | |
57 | series: [ | |
58 | { | |
59 | type: 'line', | |
60 | xField: 'name', | |
61 | yField: 'g1', | |
62 | fill: true, | |
63 | smooth: true, | |
64 | style: { | |
65 | lineWidth: 4 | |
66 | }, | |
67 | marker: { | |
68 | type: 'circle', | |
69 | radius: 10, | |
70 | lineWidth: 2 | |
71 | }, | |
72 | renderer: 'onSeriesRender' | |
73 | } | |
74 | ], | |
75 | axes: [ | |
76 | { | |
77 | type: 'numeric', | |
78 | position: 'left', | |
79 | fields: ['g1'], | |
80 | minimum: 0, | |
81 | listeners: { | |
82 | rangechange: 'onAxisRangeChange' | |
83 | } | |
84 | }, | |
85 | { | |
86 | type: 'category', | |
87 | position: 'bottom', | |
88 | fields: 'name' | |
89 | } | |
90 | ] | |
91 | }] | |
92 | ||
93 | }); |