aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/timeline.html.erb12
1 files changed, 6 insertions, 6 deletions
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/timeline.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/timeline.html.erb
index a756e495f97..17b0543a2e5 100644
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/timeline.html.erb
+++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/timeline.html.erb
@@ -1,7 +1,7 @@
<%
# Retrieve widget settings
metric_data_map = {}
- metric_name_map = {}
+ metric_map = {}
metrics_specified = false
(1..3).each do |index|
metric=widget_properties["metric#{index}"]
@@ -11,7 +11,7 @@
metrics_specified = true
if measure(metric)
metric_data_map[metric.id] = []
- metric_name_map[metric.id] = metric.short_name
+ metric_map[metric.id] = metric
end
end
end
@@ -19,7 +19,7 @@
# No metric has been selected, it's the first time the widget is displayed: 'ncloc' is the default metric
ncloc = Metric.by_name('ncloc')
metric_data_map[ncloc.id] = []
- metric_name_map[ncloc.id] = message('metric.ncloc.name')
+ metric_map[ncloc.id] = ncloc
end
chartHeight = widget_properties["chartHeight"]
@@ -45,10 +45,10 @@
js_data = "["
js_snapshots = "["
js_metrics = "["
- total_number_of_metrics = metric_name_map.keys.size()
+ total_number_of_metrics = metric_map.keys.size()
metric_data_map.keys.each_with_index() do |metric_id, index|
unless metric_data_map[metric_id].empty?
- js_metrics += "\"" + metric_name_map[metric_id] + "\","
+ js_metrics += "\"" + metric_map[metric_id].short_name + "\","
js_data += "["
metric_data_map[metric_id].each() do |metric_data|
# for every metric value, we need to check that the corresponding snapshot has values for each metric (if not, Protovis won't be able to display)
@@ -57,7 +57,7 @@
# Only Oracle returns a Time object, so let's parse this string if it's not a Time instance
m_date = Time.parse(metric_data[:date]) unless m_date.is_a? Time
m_value = sprintf("%0.02f", metric_data[:value])
- m_value_localized = (m_value.end_with? '.00') ? number_with_precision(metric_data[:value], :precision => 0).to_s : number_with_precision(metric_data[:value], :precision => 1).to_s
+ m_value_localized = ProjectMeasure.new (:metric => metric_map[metric_id]).format_numeric_value(metric_data[:value], {})
js_data += "{x:d("
js_data += m_date.year.to_s
js_data += ","