]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3113 Support of direction attribute. Drop reverseColor.
authorStas Vilchik <vilchiks@gmail.com>
Fri, 11 Apr 2014 10:49:10 +0000 (16:49 +0600)
committerStas Vilchik <vilchiks@gmail.com>
Fri, 11 Apr 2014 10:49:10 +0000 (16:49 +0600)
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsCloudWidget.java
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_cloud.html.erb
sonar-server/src/main/coffee/widgets/word-cloud.coffee

index c8b956bb28fdd55bdd7702a25d2f52a78cc1fb0a..a287ed664c4ecb53647353f4db7a48093dd059bd 100644 (file)
@@ -35,7 +35,6 @@ import static org.sonar.api.web.WidgetScope.GLOBAL;
   @WidgetProperty(key = "colorMetric", type = WidgetPropertyType.METRIC, defaultValue = CoreMetrics.COVERAGE_KEY,
     options = { WidgetConstants.FILTER_OUT_NEW_METRICS, "type:PERCENT" }),
   @WidgetProperty(key = "maxItems", type = WidgetPropertyType.INTEGER, defaultValue = "100"),
-  @WidgetProperty(key = "reverseColor", type = WidgetPropertyType.BOOLEAN, defaultValue = "false")
 })
 public class MeasureFilterAsCloudWidget extends CoreWidget {
 
index 0980281749452d35dc002cbb4f7ae19b20f918c9..4fa9da38b9b543229537758c85749d1068373150 100644 (file)
@@ -3,7 +3,6 @@
   chartTitle = widget_properties['chartTitle']
   filterId = widget_properties['filter'].to_i
   maxItems = widget_properties['maxItems'].to_i
-  reverseColor = widget_properties['reverseColor']
 
   filter = MeasureFilter.find_by_id(filterId.to_i)
   @widget_title = link_to h(filter.name), {:controller => 'measures', :action => 'filter', :id => filter.id, :display => 'list'}
@@ -42,7 +41,6 @@
       .source(baseUrl + '/measures/search_filter?' + query)
       .metricsPriority(metrics)
       .options({
-        reverseColor: <%= reverseColor -%>,
         maxItemsReachedMessage: '<%= message("widget.measure_filter_histogram.max_items_reached", :params => [maxItems]) -%>',
         baseUrl: baseUrl + '/dashboard/index/',
         noData: '<%= message('no_data') -%>'
index ec1658316b623ff7bbe8acfa740fbb42f8e1f51e..ffbb76066bf40b79c8bf127da5e2bfa9b41a3032 100644 (file)
@@ -55,10 +55,11 @@ window.SonarWidgets.WordCloud.prototype.render = (container) ->
 
   # Configure scales
   @color = d3.scale.linear().domain([0, 100])
-  if @options().reverseColor
-    @color.range(['#1f77b4', '#d62728'])
+  if @metrics()[@colorMetric].direction == 1
+    @color.range ['#d62728', '#1f77b4']
   else
-    @color.range(['#d62728', '#1f77b4'])
+    @color.range ['#1f77b4', '#d62728']
+
   sizeDomain = d3.extent @components(), (d) => @getSizeMetric d
   @size = d3.scale.linear().domain(sizeDomain).range([10, 24])