Pārlūkot izejas kodu

HUE-315. Make Protovis/HueChart work in IE

Marcus McLaughlin 15 gadi atpakaļ
vecāks
revīzija
9ddcc2597d

+ 3 - 2
desktop/core/static/js/Source/CCS/HueChart.Box.js

@@ -86,9 +86,10 @@ HueChart.Box = new Class({
                         //Add position indicator if enabled
                         if (this.options.positionIndicator) this.setPositionIndicator(vis);
                         //Create panel for capture of events
-                        this.eventPanel = vis.add(pv.Panel);
+                        this.eventPanel = vis.add(pv.Panel).fillStyle("rgba(0,0,0,.001)");
                         //If there's a mouse event, add the functionality to capture these events.
-                        if (this.hasEvent('pointMouseOut') && this.hasEvent('pointMouseOver') || this.hasEvent('pointClick')) this.addMouseEvents(vis);
+                        //if (this.hasEvent('pointMouseOut') && this.hasEvent('pointMouseOver') || this.hasEvent('pointClick')) this.addMouseEvents(vis);
+                        this.addMouseEvents(vis);
                         if (this.hasEvent('spanSelect')) this.makeSelectable(vis);
                 }.bind(this));
         },

+ 8 - 2
desktop/core/static/js/Source/CCS/HueChart.js

@@ -179,7 +179,13 @@ HueChart.Data = new Class({
                 this.dataObjects.each(function(d) {
                         //Check if dateProperty value is parsable as string.  
                         //Parse as string if it is, otherwise parse as ms value.
-                        d[dateProperty] = new Date().parse(Date.isParsable(d[dateProperty]) ? d[dateProperty] : parseInt(d[dateProperty], 10));
+                        var parseResult = Date.parse(d[dateProperty]);
+                        if (parseResult.isValid()) {
+                                d[dateProperty] = parseResult;
+                        } else {
+                                parseResult = Date.parse(d[dateProperty].toInt());
+                                if (parseResult.isValid()) d[dateProperty] = parseResult;
+                        } 
                 });
                 //Sort data by date property.
                 this.sortByProperty(dateProperty);
@@ -365,7 +371,7 @@ HueChart.buildData = function(table) {
                return header.get('text');
         });
         //Iterate through table row and cells.
-        $$(table.getElements('tr')).each(function(row) {
+        $$(table.getElements('tbody tr')).each(function(row) {
                 var datum = {};
                 $$(row.getElements('td')).each(function(cell, i) {
                        datum[headers[i]] = cell.get('text'); 

+ 22 - 8
ext/thirdparty/js/protovis/protovis-d3.2.js

@@ -6207,7 +6207,19 @@ pv.SvgScene.wedge = function(scenes) {
 /**
  *
  */
-pv.VmlScene = {};
+pv.VmlScene = {
+        
+        events: [
+        "onmousedown",
+        "onmouseup",
+        "onclick",
+        "ondblclick",
+        "onmousewheel",
+        "onmouseover",
+        "onmouseout",
+        "onmousemove"
+        ]
+};
 
 /**
  *
@@ -6261,9 +6273,7 @@ pv.VmlScene.dispatch = pv.listener(function(e) {
   var t = e.srcElement.$scene;
   if (t) {
     var type = e.type;
-
     /* TODO: mousewheel fixes? */
-
     if (pv.Mark.dispatch(type, t.scenes, t.index)) e.returnValue = false;
   }
 });
@@ -6641,13 +6651,17 @@ pv.VmlScene.panel = function(scenes) {
       g = s.canvas.firstChild;
       if (!g) {
         s.canvas.appendChild(g = this.create("v:group"));
-        g.onclick
+        /*g.onclick
             = g.onmousedown
             = g.onmouseup
             = g.onmousemove
             = g.onmouseout
             = g.onmouseover
-            = pv.VmlScene.dispatch;
+            = pv.VmlScene.dispatch;*/
+        for (var j = 0; j < this.events.length; j++) {
+                g.attachEvent(this.events[j], this.dispatch);
+        }
+            
       }
       scenes.$g = g;
       g.style.position = "relative";
@@ -15104,9 +15118,9 @@ pv.Behavior.select = function() {
     pv.Mark.dispatch("selectend", scene, index);
     scene = null;
   }
-
-  pv.listen(window, "mousemove", mousemove);
-  pv.listen(window, "mouseup", mouseup);
+  
+  pv.listen(window.document.documentElement, "mousemove", mousemove);
+  pv.listen(window.document.documentElement, "mouseup", mouseup);
   return mousedown;
 };
 /**