Icons in Cells
Since version 14.0
When using the ResultMatrix to display your data, you may want to use the withFormatting method for adding icons to the cells. You can use the entire Unicode Set to define your icons.
- 1 Examples
- 1.1 Basic Definition
- 1.1.1 Result
- 1.2 Alternate Definition
- 1.3 Customer Health Example
- 1.3.1 Result
- 1.4 Category Example
- 1.4.1 Result
- 1.5 Icon Summary Example
- 1.5.1 Result
- 1.1 Basic Definition
Examples
Basic Definition
def resultMatrix = api.newMatrix("Net Margin %")
resultMatrix.addRow(
resultMatrix.styledCell("10").withFormatting("▲ {}%"),
)
/*
- ▲ icon is used as a prefix
- {} is a placeholder for the actual value of the cell
- % is a suffix
*/
return resultMatrix
Result
Simple Example
Alternate Definition
You can use also the Java Unicode notation for definition of the Unicode icon.
def resultMatrix = api.newMatrix("Net Margin %")
resultMatrix.addRow(
resultMatrix.styledCell("10").withFormatting("\u25B2 {}%"),
)
/*
- \u25B2 defines an icon that is used as prefix
- {} is a placeholder for the actual value of the cell
- % is a suffix here
*/
return resultMatrix
Customer Health Example
def resultMatrix = api.newMatrix("Customer Name","Customer Id","Health Score Last 12M", "Margin %")
resultMatrix.addRow(
resultMatrix.styledCell("Nobel Hobel AG", "green", "none", "bold", "left").withFormatting("▲ {}"),
resultMatrix.styledCell("CD-00027", "black", "none", "regular"),
resultMatrix.styledCell("+75").withFormatting("▲ {}").withCSS("color: green"),
resultMatrix.styledCell("40.83").withFormatting("{} %"),
)
resultMatrix.addRow(
resultMatrix.styledCell("Ardex", "green", "none", "bold", "left").withFormatting("▲ {}"),
resultMatrix.styledCell("CD-00029", "black", "none", "regular"),
resultMatrix.styledCell("+75").withFormatting("▲ {}").withCSS("color: green"),
resultMatrix.styledCell("40.62").withFormatting("{} %"),
)
resultMatrix.addRow(
resultMatrix.styledCell("MX Meat Inc", "red", "none", "bold", "left").withFormatting("▼ {}"),
resultMatrix.styledCell("CD-00146", "black", "none", "regular"),
resultMatrix.styledCell("+50").withFormatting("▷ {}").withCSS("color: orange"),
resultMatrix.styledCell("48.96").withFormatting("{} %"),
)
resultMatrix.addRow(
resultMatrix.styledCell("Soupo AG", "red", "none", "bold", "left").withFormatting("▼ {}"),
resultMatrix.styledCell("CD-00006", "black", "none", "regular"),
resultMatrix.styledCell("+43").withFormatting("▷ {}").withCSS("color: orange"),
resultMatrix.styledCell("0.38").withFormatting("{} %"),
)
resultMatrix.addRow(
resultMatrix.styledCell("Zumtoschwein KG", "red", "none", "bold", "left").withFormatting("▼ {}"),
resultMatrix.styledCell("CD-00147", "black", "none", "regular"),
resultMatrix.styledCell("+33").withFormatting("▼ {}").withCSS("color: red"),
resultMatrix.styledCell("53.54").withFormatting("{} %"),
)
return resultMatrix
Result
Customer Health Example
Category Example
Result
Icon Summary Example
Result
Found an issue in documentation? Write to us.