Skip to content

Commit

Permalink
SONARWIDLB-10 widget now autoresizes on window resize
Browse files Browse the repository at this point in the history
  • Loading branch information
ganntest committed Oct 29, 2015
1 parent fb34717 commit 7ea09bc
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/main/resources/measure_bar_chart_widget.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,22 @@ path {
<!--[if (gte IE 9)|!(IE)]><!-->
<script>
var $ = jQuery;
var lastPeriod<%= widget.id.to_s %>;

function drawChart<%= widget.id.to_s %>(target) {

barChart(target, '<%= measure.metric.key -%>', '<%= @project.id() -%>', '<%= containerId -%>', "<%= legendText -%>");

var opts = ["W","M", "Q", "S", "Y"];
var weight = "normal";

for (var i in opts) {
if (opts[i] == target) {
weight="bold";
} else {
weight="normal";
}
$( "#p" + opts[i] + "<%= widget.id.to_s %>" ).css( "font-weight", weight );
}
$( "#p" + lastPeriod<%= widget.id.to_s %> + "<%= widget.id.to_s %>" ).css( "font-weight", "normal" );
$( "#p" + target + "<%= widget.id.to_s %>" ).css( "font-weight", "bold" );
lastPeriod<%= widget.id.to_s %> = target;
}

drawChart<%= widget.id.to_s %>("W");

autoResize(500, function() {
drawChart<%= widget.id.to_s %>(lastPeriod<%= widget.id.to_s %>);
});
</script>

<!--[if (gte IE 9)|!(IE)]><!-->
Expand Down

0 comments on commit 7ea09bc

Please sign in to comment.