4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-chart-Callout'>/**
19 </span> * @class Ext.chart.Callout
20 * A mixin providing callout functionality for Ext.chart.series.Series.
22 Ext.define('Ext.chart.Callout', {
24 /* Begin Definitions */
28 constructor: function(config) {
29 if (config.callouts) {
30 config.callouts.styles = Ext.applyIf(config.callouts.styles || {}, {
31 color: "#000",
32 font: "11px Helvetica, sans-serif"
34 this.callouts = Ext.apply(this.callouts || {}, config.callouts);
35 this.calloutsArray = [];
39 renderCallouts: function() {
46 animate = me.chart.animate,
48 styles = config.styles,
49 group = me.calloutsArray,
50 store = me.chart.store,
51 len = store.getCount(),
52 ratio = items.length / len,
53 previouslyPlacedCallouts = [],
59 for (i = 0, count = 0; i < len; i++) {
60 for (j = 0; j < ratio; j++) {
61 var item = items[count],
63 storeItem = store.getAt(i),
66 display = config.filter(storeItem);
68 if (!display && !label) {
74 group[count] = label = me.onCreateCallout(storeItem, item, i, display, j, count);
77 if (label[p] && label[p].setAttributes) {
78 label[p].setAttributes(styles, true);
84 if (label[p].setAttributes) {
85 label[p].setAttributes({
88 } else if(label[p].setVisible) {
89 label[p].setVisible(false);
94 config.renderer(label, storeItem);
95 me.onPlaceCallout(label, storeItem, item, i, display, animate,
96 j, count, previouslyPlacedCallouts);
97 previouslyPlacedCallouts.push(label);
101 this.hideCallouts(count);
104 onCreateCallout: function(storeItem, item, i, display) {
106 group = me.calloutsGroup,
107 config = me.callouts,
108 styles = config.styles,
109 width = styles.width,
110 height = styles.height,
112 surface = chart.surface,
119 calloutObj.lines = surface.add(Ext.apply({},
123 stroke: me.getLegendColor() || '#555'
128 calloutObj.panel = Ext.create('widget.panel', {
129 style: "position: absolute;",
140 hideCallouts: function(index) {
141 var calloutsArray = this.calloutsArray,
142 len = calloutsArray.length,
145 while (len-->index) {
146 co = calloutsArray[len];