]>
Commit | Line | Data |
---|---|---|
6527f429 DM |
1 | /**\r |
2 | * A basic donut chart functions precisely like a pie chart. The only difference is that\r | |
3 | * the center is blank. This is typically done to increase the readability of the data\r | |
4 | * labels that may be around. The example makes use of two interactions: 'itemhighlight'\r | |
5 | * and 'rotate'. To use the first one, hover over or tap on a pie sector. To use the\r | |
6 | * second one, click or tap and then drag anywhere on the chart.\r | |
7 | */\r | |
8 | Ext.define('KitchenSink.view.charts.pie.Donut', {\r | |
9 | extend: 'Ext.Panel',\r | |
10 | xtype: 'pie-donut',\r | |
11 | controller: 'pie-basic',\r | |
12 | \r | |
13 | // <example>\r | |
14 | // Content between example tags is omitted from code preview.\r | |
15 | otherContent: [{\r | |
16 | type: 'Controller',\r | |
17 | path: 'classic/samples/view/charts/pie/BasicController.js'\r | |
18 | }, {\r | |
19 | type: 'Store',\r | |
20 | path: 'classic/samples/store/MobileOS.js'\r | |
21 | }],\r | |
22 | bodyStyle: 'background: transparent !important',\r | |
23 | layout: {\r | |
24 | type: 'vbox',\r | |
25 | pack: 'center'\r | |
26 | },\r | |
27 | // </example>\r | |
28 | width: 650,\r | |
29 | \r | |
30 | tbar: [\r | |
31 | '->',\r | |
32 | {\r | |
33 | text: 'Preview',\r | |
34 | handler: 'onPreview'\r | |
35 | }\r | |
36 | ],\r | |
37 | \r | |
38 | items: [{\r | |
39 | xtype: 'polar',\r | |
40 | reference: 'chart',\r | |
41 | width: '100%',\r | |
42 | height: 500,\r | |
43 | insetPadding: 50,\r | |
44 | innerPadding: 20,\r | |
45 | store: {\r | |
46 | type: 'mobile-os'\r | |
47 | },\r | |
48 | legend: {\r | |
49 | docked: 'bottom'\r | |
50 | },\r | |
51 | interactions: ['rotate', 'itemhighlight'],\r | |
52 | sprites: [{\r | |
53 | type: 'text',\r | |
54 | text: 'Donut Charts - Basic',\r | |
55 | fontSize: 22,\r | |
56 | width: 100,\r | |
57 | height: 30,\r | |
58 | x: 40, // the sprite x position\r | |
59 | y: 20 // the sprite y position\r | |
60 | }, {\r | |
61 | type: 'text',\r | |
62 | text: 'Data: IDC Predictions - 2017',\r | |
63 | x: 12,\r | |
64 | y: 425\r | |
65 | }, {\r | |
66 | type: 'text',\r | |
67 | text: 'Source: Internet',\r | |
68 | x: 12,\r | |
69 | y: 440\r | |
70 | }],\r | |
71 | series: [{\r | |
72 | type: 'pie',\r | |
73 | angleField: 'data1',\r | |
74 | donut: 50,\r | |
75 | label: {\r | |
76 | field: 'os',\r | |
77 | display: 'outside'\r | |
78 | },\r | |
79 | highlight: true,\r | |
80 | tooltip: {\r | |
81 | trackMouse: true,\r | |
82 | renderer: 'onSeriesTooltipRender'\r | |
83 | }\r | |
84 | }]\r | |
85 | //<example>\r | |
86 | }, {\r | |
87 | style: 'padding-top: 10px;',\r | |
88 | xtype: 'gridpanel',\r | |
89 | columns : {\r | |
90 | defaults: {\r | |
91 | sortable: false,\r | |
92 | menuDisabled: true\r | |
93 | },\r | |
94 | items: [\r | |
95 | { text: 'OS', dataIndex: 'os' },\r | |
96 | { text: 'Market Share', dataIndex: 'data1', width: 150, renderer: 'onDataRender' }\r | |
97 | ]\r | |
98 | },\r | |
99 | store: {\r | |
100 | type: 'mobile-os'\r | |
101 | },\r | |
102 | width: '100%'\r | |
103 | //</example>\r | |
104 | }]\r | |
105 | \r | |
106 | });\r |