Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Dynamic sizing of GRID cells
shir
<p>Hi,</p><p> </p><p>I am using BIRT RCP 4.3.1</p><p> </p><p>There is a requirement to generate a report which displays the health of various applications in a particular system.</p><p> </p><p>We have a hierarchy system (may change) where some applications are more critical than the others.</p><p> </p><p>This hierarchy is defined in a DB table,. e.g.</p><p> </p><p>Criticality--> App</p><p> 1 --> X</p><p> 2 --> Y</p><p> 1 --> Z</p><p> 3 --> A</p><p> 4 --> B</p><p> </p><p>In birt how do we dynamically re-size the size of grid cell which displays the respective application health.</p><p> </p><p>More critical application has a bigger size cell, less critical to have a smaller sized cell</p>
Find more posts tagged with
Comments
pricher
<p>Hi,</p><p> </p><p>You can dynamically re-size the width and/or height of a data element through scripting. I have attached an example that uses data from Classic Models to dynamically re-size the height of the City cell based on the value of the CNT cell. Look at the onCreate method of the CITY data item to see how it works.</p><p> </p><p>Hope this helps,</p><p> </p><p>P.</p>
shir
<p>Thanks for the example...</p><p> </p><p>However my scenario is a bit different.</p><p> </p><p>I have a grid, where each cell already has the app name and respective health. Now with this multiple data already present i have to check their respective criticality and resize the grid cell.</p><p> </p><p>Can you please suggest as how to tweek the above example to achieve it ?</p>
pricher
<p>If I understand correctly, you want to dynamically change the size of items that are not directly linked to data. I have modified the previous design to show how you could dynamically change the size of labels in a grid based on data coming from a query. The trick is to read the data from the data set into a hash Map and reuse that hash map for dynamically changing the label size later.</p><p> </p><p>Here are the detail steps:</p><p> </p><p>1. Create a HashMap variable in the beforeFactory method of the report;</p><p> </p><p>2. In the table at the top of the report, I have scripted the onCreate method of the detail row to store the data from the data set. In your case, you would store "App" and "Criticality". Since we don't need to display the table, the Visibility property is set to false;</p><p> </p><p>3. In the onCreate method of each label in the grid, I have added the code to read from the HashMap and change the size of the label dynamically.</p><p> </p><p>Hope this helps better!</p><p> </p><p>P.</p>
shir
<p>Thanks, i will try to implement the same.</p><p> </p><p>Can you please explain the statement</p><p> </p><p>s = map.get(this.text) / 10; , what will this .text contain.</p><p> </p><p>The map will have pairs of data, city and count, e.g.</p><p>326,Lille</p><p>978,Paris,</p><p> </p><p>How does the above statement work ?</p>
micajblock
<p>I think what you are trying to build is called a treemap. Below is a ;ink to a DevShare that uses a Google visualization to build this.</p><p> </p><p><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/devshare/_/designing-birt-reports/1534-treemap-html5-example'>http://developer.actuate.com/community/devshare/_/designing-birt-reports/1534-treemap-html5-example</a></p>
;
pricher
<p>The statement <em><strong>this.text</strong></em> retrieves the text displayed in the label.</p><p> </p><p><em><strong>map.get(this.text)</strong></em> will retrieve the value on CNT for the CITY of that label.</p><p> </p><p>Based on your example, if a label displays 'X', the call will retrieve the criticality for 'X'. Of course, the logic for re-sizing the label will probably differ.</p><p> </p><p>What's most important to remember here are two things:</p><p> </p><p>1. You can store values from a data set in a variable for later use;</p><p>2. You can use these values to change the appearance of a label through scripting.</p><p> </p><p>P.</p>
shir
<p>Thanks Pricher, i will try out the implementing it.</p><p> </p><p>however as mblock suggested, TreeMap is something from which i can actually try to achieve my requirement.</p><p> </p><p>
@mblock
; The link you provided has a very good example to begin with, however can you please suggest , where do i get more detailed example/tutorial and some advanced functions as drill down etc...</p>
micajblock
<p>The example uses Google's visualization. Using the same technique you can use others.</p><p> </p><p><a data-ipb='nomediaparse' href='
https://developers.google.com/chart/interactive/docs/gallery/treemap'>https://developers.google.com/chart/interactive/docs/gallery/treemap</a></p><p> </p><p><a
data-ipb='nomediaparse' href='
http://bl.ocks.org/mbostock/4063582'>http://bl.ocks.org/mbostock/4063582</a></p>
;