/
How to Create Portlet Alternating Between Chart and HTML
How to Create Portlet Alternating Between Chart and HTML
The following example shows a dashboard logic which can switch to an HTML (e.g. such a nicely looking error message; here represented by the PFX logo) based on a condition (here represented by the 'decision').
def fields = [ [name: "String value", type: FieldFormatType.TEXT], [name: "Integer value", type: FieldFormatType.INTEGER], [name: "Numeric value", type: FieldFormatType.NUMERIC], [name: "Percent value", type: FieldFormatType.PERCENT], [name: "Date value", type: FieldFormatType.DATE], ]; def m = api.newMatrix(fields.collect{it -> it.name}); def rows = []; def d = new Date(); for (int i=0; i< 500; i++) { rows << ["string text "+i, i, 0.11*i, 0.01*i, d-i]; } fields.each {field -> m.setColumnFormat(field.name, field.type); } rows.each {row -> m.addRow((0..row.size()-1).collectEntries{index -> [fields[index].name, row[index]] }); } ///end matrix def controller = api.newController() controller.addHTML("<img src='https://www.pricefx.eu/site/wp-content/uploads/2016/02/logo.png' width=147 height=36/>") return decision() ? m : controller; boolean decision() { def m2 = new Date() return new BigDecimal(m2.getTime()).remainder( 2 ) != 0 }
, multiple selections available,
Related content
How to Add a Link to Dashboard
How to Add a Link to Dashboard
More like this
Layout Configuration (Dashboard)
Layout Configuration (Dashboard)
Read with this
How to Create an Interactive Embedded Dashboard
How to Create an Interactive Embedded Dashboard
More like this
Dashboards
Dashboards
Read with this
How to Create New Dashboard
How to Create New Dashboard
More like this
Interactive Dashboards
Interactive Dashboards
Read with this
Found an issue in documentation? Write to us.