4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../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-Navigation'>/**
19 </span> * @class Ext.chart.Navigation
21 * Handles panning and zooming capabilities.
23 * Used as mixin by Ext.chart.Chart.
25 Ext.define('Ext.chart.Navigation', {
27 constructor: function() {
28 this.originalStore = this.store;
31 //filters the store to the specified interval(s)
32 setZoom: function(zoomConfig) {
34 store = me.substore || me.store,
36 len = store.getCount(),
37 from = (zoomConfig.x / bbox.width * len) >> 0,
38 to = Math.ceil(((zoomConfig.x + zoomConfig.width) / bbox.width * len)),
39 recFieldsLen, recFields = [], curField, json = [], obj;
41 store.each(function(rec, i) {
42 if (i < from || i > to) {
46 //get all record field names in a simple array
47 if (!recFields.length) {
48 rec.fields.each(function(f) {
49 recFields.push(f.name);
51 recFieldsLen = recFields.length;
53 //append record values to an aggregation record
54 for (i = 0; i < recFieldsLen; i++) {
55 curField = recFields[i];
56 obj[curField] = rec.get(curField);
60 me.store = me.substore = Ext.create('Ext.data.JsonStore', {
67 restoreZoom: function() {
68 this.store = this.substore = this.originalStore;