Bläddra i källkod

HUE-5223 [core] Lighten up the treeview chart

Enrico Berti 9 år sedan
förälder
incheckning
03dc9fe

+ 1 - 1
apps/search/src/search/static/search/css/search.css

@@ -491,7 +491,7 @@ em {
 
 .partitionChart text {
   pointer-events: none;
-  fill: white;
+  fill: #212121;
 }
 
 .d3-tip {

+ 11 - 11
desktop/core/src/desktop/static/desktop/js/hue.colors.js

@@ -110,13 +110,7 @@ var HueColors = {
   },
 
 
-  /**
-   * Gets a palette of colors to be used in charts
-   * It can be used in several ways, e.g.
-   * getChartColor() >> the whole spectrum
-   * @return {array}                  A list of colors in the {'color': '#HEX_VALUE'} format
-   */
-  getCUIChartColors: function getChartColors(swatch, bands, reversed, distributed) {
+  getCUIChartColors: function () {
     var normalizedColors = {}, i;
     this.CUIScaleColors.forEach(function (scaleDef) {
       normalizedColors[scaleDef.name] = scaleDef.colors;
@@ -147,18 +141,24 @@ var HueColors = {
       sequence.forEach(addPlus);
       sequence.forEach(addMinus);
     }
-
     return wholeSpectrum;
-
   },
 
   d3Scale: function () {
     return d3.scale.category20().range().concat(d3.scale.category20b().range().concat(d3.scale.category20c().range()));
   },
-  cuiD3Scale: function () {
-    return this.getCUIChartColors().map(function (c) {
+  cuiD3Scale: function (swatch) {
+    var colors = this.getCUIChartColors().map(function (c) {
       return c.color;
     });
+    if (swatch) {
+      this.CUIScaleColors.forEach(function (s) {
+        if (s.name === swatch) {
+          colors = s.colors;
+        }
+      });
+    }
+    return colors;
   },
   LIGHT_BLUE: "#DBE8F1",
   BLUE: "#87BAD5",

+ 12 - 11
desktop/core/src/desktop/static/desktop/js/ko.charts.js

@@ -1280,7 +1280,7 @@
 
   ko.bindingHandlers.partitionChart = {
     render: function (element, valueAccessor) {
-
+      chartsNormalState();
       var MIN_HEIGHT_FOR_TOOLTIP = 24;
 
       var _options = valueAccessor();
@@ -1353,12 +1353,12 @@
 
       if (typeof _options.zoomable == "undefined" || _options.zoomable) {
         g.on("click", click)
-            .on("dblclick", function (d, i) {
-              if (typeof _options.onClick != "undefined" && d.depth > 0) {
-                chartsUpdatingState();
-                _options.onClick(d);
-              }
-            });
+          .on("dblclick", function (d, i) {
+            if (typeof _options.onClick != "undefined" && d.depth > 0) {
+              chartsUpdatingState();
+              _options.onClick(d);
+            }
+          });
       }
       else {
         g.on("click", function (d, i) {
@@ -1372,7 +1372,7 @@
       var _kx = _w / _data.dx,
           _ky = _h / 1;
 
-      var _colors = HueColors.scale(HueColors.DARK_BLUE, HueColors.BLUE, 5)
+      var _colors = [HueColors.cuiD3Scale('gray')[0]];
 
       g.append("svg:rect")
           .attr("width", _data.dy * _kx)
@@ -1383,15 +1383,15 @@
             return d.children ? "parent" : "child";
           })
           .attr("stroke", function (d) {
-            return HueColors.DARK_BLUE;
+            return HueColors.cuiD3Scale('gray')[3];
           })
           .attr("fill", function (d, i) {
             var _fill = _colors[d.depth] || _colors[_colors.length - 1];
             if (d.obj && _options.fqs) {
               $.each(_options.fqs(), function (cnt, item) {
                 $.each(item.filter(), function (icnt, filter) {
-                  if (filter.value() == d.obj.fq_values) {
-                    _fill = HueColors.ORANGE;
+                  if (JSON.stringify(filter.value()) == JSON.stringify(d.obj.fq_values)) {
+                    _fill = HueColors.cuiD3Scale('gray')[3];
                   }
                 });
               });
@@ -1429,6 +1429,7 @@
         _y.domain([d.x, d.x + d.dx]);
 
         var t = g.transition()
+            .delay(250)
             .duration(d3.event.altKey ? 7500 : 750)
             .attr("transform", function (d) {
               return "translate(" + _x(d.y) + "," + _y(d.x) + ")";