measures = component_measures(@snapshots, metrics)
@measures_by_snapshot = measures_by_snapshot(@snapshots, measures)
if @components_configuration.treemap_enabled? && @snapshots.size>1
- @treemap = Sonar::Treemap.new(1, default_treemap_size_metric, TREEMAP_SIZE, TREEMAP_SIZE, {
+ @treemap = Sonar::Treemap.new(1, default_treemap_size_metric, TREEMAP_SIZE, {
:color_metric => default_treemap_color_metric,
:root_snapshot => @snapshot
})
html_id = params[:id]
bad_request('Missing required property: id') if html_id.blank?
- width = params[:width]
- bad_request('Missing required property: width') if width.blank?
- bad_request('Bad width') if width.to_i<=0
-
height = params[:height]
bad_request('Missing required property: height') if height.blank?
bad_request('Bad height') if height.to_i<=0
bad_request('Missing parameter: resource or filter')
end
- treemap = Sonar::Treemap.new(html_id, size_metric, width.to_i, height.to_i, {
+ treemap = Sonar::Treemap.new(html_id, size_metric, height.to_i, {
:color_metric => color_metric,
:root_snapshot => (resource ? resource.last_snapshot : nil),
:measures_by_snapshot => (filter_context ? filter_context.measures_by_snapshot : nil),
class Sonar::Treemap
include ActionView::Helpers::UrlHelper
- attr_accessor :size_metric, :color_metric, :width, :height, :root_snapshot, :period_index,
+ attr_accessor :size_metric, :color_metric, :height, :root_snapshot, :period_index,
:id, :components_size, :measures
- def initialize(id, size_metric, width, height, options={})
+ def initialize(id, size_metric, height, options={})
@components_size = 0
@id = id
@size_metric = size_metric
- @width = width
@height = height
@color_metric = options[:color_metric]
build_tree(root)
output = Sonar::HtmlOutput.new do |o|
- o.width = @width
+ o.width = 100
o.height = @height
o.full_html = false
o.details_at_depth = 1
html = ''
html += "<div style=\""
html += "overflow:hidden;position:absolute;"
- html += "left:#{node.bounds.x1}px; top:#{node.bounds.y1}px;"
- html += "width:#{node.bounds.width}px;height: #{node.bounds.height}px;"
+ html += "left:#{node.bounds.x1}%; top:#{node.bounds.y1}px;"
+ html += "width:#{node.bounds.width}%;height: #{node.bounds.height}px;"
html += "background-color:#FFF;\">"
html += "<div rid='#{node.rid}' id=\"tm-node-#{node.id}\" style='margin: 1px;background-color: #{node.color}; height: #{node.bounds.height-4}px;
border: 1px solid #{node.color};' alt=\"#{node.tooltip}\" title=\"#{node.tooltip}\""
</td>
<% if @treemap %>
<td width="10px"> </td>
- <td width="<%= @treemap.width -%>" valign="top">
+ <td width="280px" valign="top">
<script>
new Treemap(1, '<%= @treemap.size_metric ? @treemap.size_metric.key : '' -%>', '<%= @treemap.color_metric ? @treemap.color_metric.key : '' -%>', 100.0).init('resource',
<%= @resource.id -%>);
-<div class="treemap" style="width: <%= treemap.width -%>px; height:<%= treemap.height %>px;">
+<div class="treemap" style="width: 100%; height:<%= treemap.height %>px;">
<%= treemap.generate_html() -%>
</div>
\ No newline at end of file
<%= height_in_percents -%>);
treemap.init('<%= context_type -%>', <%= context_id -%>).load();
- autoResize(200, function() {
- treemap.load();
- });
</script>
return null;
};
Treemap.prototype.width = function () {
- return $('tm-' + this.id).getWidth() - 10;
+ return $('tm-' + this.id).getWidth();
};
Treemap.prototype.load = function () {
var context = this.currentContext();
}
new Ajax.Request(
- baseUrl + '/treemap/index?id=' + this.id + '&width=' + width + '&height=' + height + '&size_metric=' + this.sizeMetric + '&color_metric=' + this.colorMetric + '&' + context.type + '=' + context.id,
+ baseUrl + '/treemap/index?id=' + this.id + '&height=' + height + '&size_metric=' + this.sizeMetric + '&color_metric=' + this.colorMetric + '&' + context.type + '=' + context.id,
{
asynchronous:true,
evalScripts:true