From 44621be7dcebc81bc8a5ad416d48a8433b72a41b Mon Sep 17 00:00:00 2001 From: Fabrice Bellingard Date: Mon, 29 Aug 2011 14:46:58 +0200 Subject: [PATCH] SONAR-2074 Remove y-axis on the chart --- .../plugins/core/widgets/TimelineWidget.java | 2 +- .../main/webapp/javascripts/protovis-sonar.js | 29 ++----------------- 2 files changed, 4 insertions(+), 27 deletions(-) diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TimelineWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TimelineWidget.java index bceb37b2a0c..0877231f2c2 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TimelineWidget.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TimelineWidget.java @@ -32,7 +32,7 @@ import org.sonar.api.web.WidgetPropertyType; @WidgetProperty(key = "metric2", type = WidgetPropertyType.METRIC), @WidgetProperty(key = "metric3", type = WidgetPropertyType.METRIC), @WidgetProperty(key = "hideEvents", type = WidgetPropertyType.BOOLEAN), - @WidgetProperty(key = "chartHeight", type = WidgetPropertyType.INTEGER) + @WidgetProperty(key = "chartHeight", type = WidgetPropertyType.INTEGER, defaultValue = "80") } ) public class TimelineWidget extends AbstractRubyTemplate implements RubyRailsWidget { diff --git a/sonar-server/src/main/webapp/javascripts/protovis-sonar.js b/sonar-server/src/main/webapp/javascripts/protovis-sonar.js index 18c3d627ef6..28e8aba5011 100755 --- a/sonar-server/src/main/webapp/javascripts/protovis-sonar.js +++ b/sonar-server/src/main/webapp/javascripts/protovis-sonar.js @@ -44,23 +44,11 @@ SonarWidgets.Timeline.prototype.render = function() { var widgetDiv = document.getElementById(this.wDivId); var footerFont = "12px Arial,Helvetica,sans-serif"; + var show_y_axis = (data.length==1) /* Sizing and scales. */ - var leftMargin = 20; - var show_y_axis = (data.length==1) - if (show_y_axis) { - // We must evaluate how wide the left margin must be, depending on the values that we get (so that they can be displayed correctly) - var maxNumberOnY = 0; - for (var i = 0; i < trendData.length; i++) { - for (var j = 0; j < trendData[i].length; j++) { - if (trendData[i][j].y > maxNumberOnY) { maxNumberOnY = trendData[i][j].y; } - } - } - minMargin = (maxNumberOnY + "").length * 7; - if (minMargin > leftMargin) { leftMargin = minMargin; } - } var footerHeight = 30 + (events ? 3 : this.wMetrics.size()) * 12; - var w = widgetDiv.parentNode.clientWidth - leftMargin - 30, + var w = widgetDiv.parentNode.clientWidth - 60, h = (this.wHeight == null ? 80 : this.wHeight) + footerHeight - 5, S=2; @@ -77,7 +65,7 @@ SonarWidgets.Timeline.prototype.render = function() { .canvas(widgetDiv) .width(w) .height(h) - .left(leftMargin) + .left(20) .right(20) .bottom(footerHeight) .top(5) @@ -93,17 +81,6 @@ SonarWidgets.Timeline.prototype.render = function() { .add(pv.Label) .text(x.tickFormat); - /* Y-axis and ticks. */ - if (show_y_axis) { - vis.add(pv.Rule) - .data(y[0].ticks(5)) - .bottom(y[0]) - .strokeStyle(function(d) {return d ? "#eee" : "#000";}) - .anchor("left") - .add(pv.Label) - .text(y[0].tickFormat); - } - /* A panel for each data series. */ var panel = vis.add(pv.Panel) .data(trendData); -- 2.39.5