Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / docs / source / Navigation.html
diff --git a/docs/source/Navigation.html b/docs/source/Navigation.html
new file mode 100644 (file)
index 0000000..2418f1a
--- /dev/null
@@ -0,0 +1,55 @@
+<!DOCTYPE html><html><head><title>Sencha Documentation Project</title><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../prettify.css" type="text/css"><link rel="stylesheet" href="../prettify_sa.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script></head><body onload="prettyPrint()"><pre class="prettyprint"><pre><span id='Ext-chart.Navigation'>/**
+</span> * @class Ext.chart.Navigation
+ *
+ * Handles panning and zooming capabilities.
+ * 
+ * @ignore
+ */
+Ext.define('Ext.chart.Navigation', {
+
+    constructor: function() {
+        this.originalStore = this.store;
+    },
+    
+    //filters the store to the specified interval(s)
+    setZoom: function(zoomConfig) {
+        var me = this,
+            store = me.substore || me.store,
+            bbox = me.chartBBox,
+            len = store.getCount(),
+            from = (zoomConfig.x / bbox.width * len) &gt;&gt; 0,
+            to = Math.ceil(((zoomConfig.x + zoomConfig.width) / bbox.width * len)),
+            recFieldsLen, recFields = [], curField, json = [], obj;
+        
+        store.each(function(rec, i) {
+            if (i &lt; from || i &gt; to) {
+                return;
+            }
+            obj = {};
+            //get all record field names in a simple array
+            if (!recFields.length) {
+                rec.fields.each(function(f) {
+                    recFields.push(f.name);
+                });
+                recFieldsLen = recFields.length;
+            }
+            //append record values to an aggregation record
+            for (i = 0; i &lt; recFieldsLen; i++) {
+                curField = recFields[i];
+                obj[curField] = rec.get(curField);
+            }
+            json.push(obj);
+        });
+        me.store = me.substore = Ext.create('Ext.data.JsonStore', {
+            fields: recFields,
+            data: json
+        });
+        me.redraw(true);
+    },
+
+    restoreZoom: function() {
+        this.store = this.substore = this.originalStore;
+        this.redraw(true);
+    }
+    
+});</pre></pre></body></html>
\ No newline at end of file