]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5929 TreeMap Widget: colors of squares are not matching Sqale Rating
authorStas Vilchik <vilchiks@gmail.com>
Mon, 15 Dec 2014 14:48:10 +0000 (15:48 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Mon, 15 Dec 2014 15:03:19 +0000 (16:03 +0100)
server/sonar-web/src/main/coffee/widgets/treemap.coffee

index 72cff1254f34077463764707c0385253db7d4ed1..f929f8d24b9868f2c1611461f9fd4525911b0e56 100644 (file)
@@ -135,7 +135,12 @@ class Treemap extends window.SonarWidgets.BaseWidget
 
 
   getRatingColorScale: ->
-    color = d3.scale.ordinal().domain([1, 2, 3, 4, 5]).range @colors5r
+    domain = [1, 2, 3, 4, 5]
+    if @components().length > 0
+      colorMetricSample = @colorMetric.value _.first @components()
+      if typeof colorMetricSample == 'string'
+        domain = ['A', 'B', 'C', 'D', 'E']
+    color = d3.scale.ordinal().domain(domain).range @colors5r
     color