...
Priority of portlet dimension settings
Preferences
Setting from dashboard logic
Default size:
Height: 320px
Width:
100% for the screen is less than 1024px
50% for the screen is from 1024px to <1920px
33% for the screen is from 1920px
100% for the chart portlet
Code Examples
the following 2 examples can be found in the working sample logic Dashboard_Portlet_Dimensions
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
final Integer INITIAL_WIDTH = 500600 // 500600 pixels final Integer INITIAL_HEIGHT = 300200 // 300200 pixels ResultMatrix resultMatrix = createSampleResultMatrix() // Sets initial width and height for the returned result matrix. // Result matrix represents the portlet, so this becomes initial portlet dimensions resultMatrix.withLayout( INITIAL_WIDTH, INITIAL_HEIGHT ) //❶ return resultMatrix /** * Sample result matrix, representing a portlet with data formatted in table * @return */ ResultMatrix createSampleResultMatrix() { def resultMatrix = api.newMatrix("Customer Id", "Net Margin %") resultMatrix.addRow([ "Customer Id" : "C1", "Net Margin %" : 0.104 ]) resultMatrix.addRow([ "Customer Id" : "C2", "Net Margin %" : 0.044 ]) resultMatrix.addRow([ "Customer Id" : "C3", "Net Margin %" : 0.014 ]) return resultMatrix } |
❶ see withLayout() in Groovy API
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
final Integer INITIAL_WIDTH = 300 // 300 pixels final Integer INITIAL_HEIGHT = 200500 // 200500 pixels DashboardControllerdef controller = createSampleDashboardController() // Sets initial width and height for the returned controller. // Dashboard Controller represents the portlet, so this becomes initial portlet dimensions. controller.withLayout(INITIAL_WIDTH, INITIAL_HEIGHT) //❶ return controller /** * Sample dashboard controller, representing a portlet with html content * @return */ DashboardControllerdef createSampleDashboardController() { def controller = api.newController() controller.addDownloadButtonaddButton("VISITShow PRICEFXProducts", AppPages.MD_PRODUCTS_PAGE) "https://www.pricefx.com/") def lorem = "<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nullam sit amet magna in magna gravida vehicula. Aliquam id dolor. Cras elementum.</p>" (1..3).each { controller.addHTML(lorem) } return controller } |
❶ see withLayout() in Groovy API