@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 {
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'}
.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') -%>'
# 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])