From 3e394ec72af32e20516a9d1396b329fc299300d8 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Fri, 11 Apr 2014 16:49:10 +0600 Subject: [PATCH] SONAR-3113 Support of direction attribute. Drop reverseColor. --- .../core/widgets/measures/MeasureFilterAsCloudWidget.java | 1 - .../core/widgets/measures/measure_filter_cloud.html.erb | 2 -- sonar-server/src/main/coffee/widgets/word-cloud.coffee | 7 ++++--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsCloudWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsCloudWidget.java index c8b956bb28f..a287ed664c4 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsCloudWidget.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/measures/MeasureFilterAsCloudWidget.java @@ -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 { diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_cloud.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_cloud.html.erb index 09802817494..4fa9da38b9b 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_cloud.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/measures/measure_filter_cloud.html.erb @@ -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') -%>' diff --git a/sonar-server/src/main/coffee/widgets/word-cloud.coffee b/sonar-server/src/main/coffee/widgets/word-cloud.coffee index ec1658316b6..ffbb76066bf 100644 --- a/sonar-server/src/main/coffee/widgets/word-cloud.coffee +++ b/sonar-server/src/main/coffee/widgets/word-cloud.coffee @@ -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]) -- 2.39.5