Commits

Chris Leonello committed afbf117

In process mods to style legend when toggling series on/off.

Comments (0)

Files changed (2)

src/jquery.jqplot.css

     vertical-align:middle;
 }
 
+/*
+These rules could be used instead of assigning
+element styles and relying on js object properties.
+*/
+
+/*
+td.jqplot-table-legend-swatch {
+    padding-top: 0.5em;
+    text-align: center;
+}
+
+tr.jqplot-table-legend:first td.jqplot-table-legend-swatch {
+    padding-top: 0px;
+}
+*/
+
 td.jqplot-seriesToggle:hover, td.jqplot-seriesToggle:active {
     cursor: pointer;
 }
 
-td.jqplot-table-legend > div {
+.jqplot-table-legend .jqplot-series-hidden {
+    background-color: lightgray;
+}
+
+div.jqplot-table-legend-swatch-outline {
     border: 1px solid #cccccc;
     padding:1px;
 }

src/plugins/jqplot.enhancedLegendRenderer.js

                 nc = 1;
             }
                 
-            var i, j, tr, td1, td2, lt, rs, div0, div1;
+            var i, j, tr, td1, td2, lt, rs, div, div0, div1;
             var idx = 0;
             // check to see if we need to reverse
             for (i=series.length-1; i>=0; i--) {
                             }
                             
                             if (this.seriesToggle) {
+
+                                // add an overlay for clicking series on/off
+                                // div0 = $(document.createElement('div'));
+                                // div0.addClass('jqplot-table-legend-overlay');
+                                // div0.css({position:'relative', left:0, top:0, height:'100%', width:'100%'});
+                                // tr.append(div0);
+
                                 var speed;
                                 if (typeof(this.seriesToggle) == 'string' || typeof(this.seriesToggle) == 'number') {
                                     if (!$.jqplot.use_excanvas || !this.disableIEFading) {
         }
         return this._elem;
     };
+
+    var handleToggle = function (ev) {
+        ev.data.series.toggleDisplay(ev);
+        if (ev.data.series.canvas._elem.hasClass('jqplot-series-hidden')) {
+            console.log('add');
+            $(this).parent().addClass('jqplot-series-hidden');
+        }
+        else {
+            console.log('remove');
+            $(this).parent().removeClass('jqplot-series-hidden');
+        }
+    };
     
     // called with scope of plot.
     var postDraw = function () {