Commits

Chris Leonello  committed 61bf9c3

Added syncronizeHighlight option to pyramid renderer to highlight both bars on pyramid when one is moused over.
Mnor refactor to error thrown when no data supplied.

  • Participants
  • Parent commits 0bdb2ee

Comments (0)

Files changed (2)

File src/jqplot.core.js

             if (data == null || jQuery.isArray(data) == false || data.length == 0 || jQuery.isArray(data[0]) == false || data[0].length == 0) {
                 
                 if (this.noDataIndicator.show == false) {
-                    throw{
-                        name: "DataError",
-                        message: "No data to plot."
-                    };
+                    throw "No Data";
                 }
                 
                 else {

File src/plugins/jqplot.pyramidRenderer.js

         // prop: highlightColors
         // an array of colors to use when highlighting a slice.
         this.highlightColors = [];
+        // prop: syncronizeHighlight
+        // Index of another series to highlight when this series is highlighted.
+        // null or false to not syncronize.
+        this.syncronizeHighlight = false;
         // prop: offsetBars
         // False will center bars on their y value.
         // True will push bars up by 1/2 bar width to fill between their y values.
         plot.plugins.pyramidRenderer.highlightedSeriesIndex = sidx;
         var opts = {fillStyle: s.highlightColors[pidx], fillRect: false};
         s.renderer.shapeRenderer.draw(canvas._ctx, points, opts);
+        if (!isNaN(s.syncronizeHighlight) && plot.series.length >= s.syncronizeHighlight && s.syncronizeHighlight !== sidx) {
+            s = plot.series[s.syncronizeHighlight];
+            opts = {fillStyle: s.highlightColors[pidx], fillRect: false};
+            s.renderer.shapeRenderer.draw(canvas._ctx, s._barPoints[pidx], opts);
+        }
         canvas = null;
     }