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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
| <!DOCTYPE html>
| <html>
| <head>
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
| <title>The source code</title>
| <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
| <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
| <style type="text/css">
| .highlight { display: block; background-color: #ddd; }
| </style>
| <script type="text/javascript">
| function highlight() {
| document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
| }
| </script>
| </head>
| <body onload="prettyPrint(); highlight();">
| <pre class="prettyprint lang-js"><span id='Ext-chart-Shape'>/**
| </span> * @private
| */
| Ext.define('Ext.chart.Shape', {
|
| /* Begin Definitions */
|
| singleton: true,
|
| <span id='Ext-chart-Shape-method-circle'> /* End Definitions */
| </span>
| circle: function (surface, opts) {
| return surface.add(Ext.apply({
| type: 'circle',
| x: opts.x,
| y: opts.y,
| stroke: null,
| radius: opts.radius
| }, opts));
| },
| <span id='Ext-chart-Shape-method-line'> line: function (surface, opts) {
| </span> return surface.add(Ext.apply({
| type: 'rect',
| x: opts.x - opts.radius,
| y: opts.y - opts.radius,
| height: 2 * opts.radius,
| width: 2 * opts.radius / 5
| }, opts));
| },
| <span id='Ext-chart-Shape-method-square'> square: function (surface, opts) {
| </span> return surface.add(Ext.applyIf({
| type: 'rect',
| x: opts.x - opts.radius,
| y: opts.y - opts.radius,
| height: 2 * opts.radius,
| width: 2 * opts.radius,
| radius: null
| }, opts));
| },
| <span id='Ext-chart-Shape-method-triangle'> triangle: function (surface, opts) {
| </span> opts.radius *= 1.75;
| return surface.add(Ext.apply({
| type: 'path',
| stroke: null,
| path: "M".concat(opts.x, ",", opts.y, "m0-", opts.radius * 0.58, "l", opts.radius * 0.5, ",", opts.radius * 0.87, "-", opts.radius, ",0z")
| }, opts));
| },
| <span id='Ext-chart-Shape-method-diamond'> diamond: function (surface, opts) {
| </span> var r = opts.radius;
| r *= 1.5;
| return surface.add(Ext.apply({
| type: 'path',
| stroke: null,
| path: ["M", opts.x, opts.y - r, "l", r, r, -r, r, -r, -r, r, -r, "z"]
| }, opts));
| },
| <span id='Ext-chart-Shape-method-cross'> cross: function (surface, opts) {
| </span> var r = opts.radius;
| r = r / 1.7;
| return surface.add(Ext.apply({
| type: 'path',
| stroke: null,
| path: "M".concat(opts.x - r, ",", opts.y, "l", [-r, -r, r, -r, r, r, r, -r, r, r, -r, r, r, r, -r, r, -r, -r, -r, r, -r, -r, "z"])
| }, opts));
| },
| <span id='Ext-chart-Shape-method-plus'> plus: function (surface, opts) {
| </span> var r = opts.radius / 1.3;
| return surface.add(Ext.apply({
| type: 'path',
| stroke: null,
| path: "M".concat(opts.x - r / 2, ",", opts.y - r / 2, "l", [0, -r, r, 0, 0, r, r, 0, 0, r, -r, 0, 0, r, -r, 0, 0, -r, -r, 0, 0, -r, "z"])
| }, opts));
| },
| <span id='Ext-chart-Shape-method-arrow'> arrow: function (surface, opts) {
| </span> var r = opts.radius;
| return surface.add(Ext.apply({
| type: 'path',
| path: "M".concat(opts.x - r * 0.7, ",", opts.y - r * 0.4, "l", [r * 0.6, 0, 0, -r * 0.4, r, r * 0.8, -r, r * 0.8, 0, -r * 0.4, -r * 0.6, 0], "z")
| }, opts));
| },
| <span id='Ext-chart-Shape-method-drop'> drop: function (surface, x, y, text, size, angle) {
| </span> size = size || 30;
| angle = angle || 0;
| surface.add({
| type: 'path',
| path: ['M', x, y, 'l', size, 0, 'A', size * 0.4, size * 0.4, 0, 1, 0, x + size * 0.7, y - size * 0.7, 'z'],
| fill: '#000',
| stroke: 'none',
| rotate: {
| degrees: 22.5 - angle,
| x: x,
| y: y
| }
| });
| angle = (angle + 90) * Math.PI / 180;
| surface.add({
| type: 'text',
| x: x + size * Math.sin(angle) - 10, // Shift here, Not sure why.
| y: y + size * Math.cos(angle) + 5,
| text: text,
| 'font-size': size * 12 / 40,
| stroke: 'none',
| fill: '#fff'
| });
| }
| });</pre>
| </body>
| </html>
|
|