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.
Examples
Basic Definition
Groovy
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
Alternate Definition
You can use also the Java Unicode notation for definition of the Unicode icon.
Groovy
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
Groovy
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
Category Example
Groovy
def resultMatrix = api.newMatrix("Category Name","# Products","Quantity", "Margin %")
resultMatrix.addRow(
resultMatrix.styledCell("Low", "black", "none", "bold", "left").withFormatting("1️⃣ {}"),
resultMatrix.styledCell("30", "black", "none", "regular"),
resultMatrix.styledCell("16,815"),
resultMatrix.styledCell("39.386").withFormatting("{} %"),
)
resultMatrix.addRow(
resultMatrix.styledCell("Normal", "black", "none", "bold", "left").withFormatting("2️⃣️ {}"),
resultMatrix.styledCell("31", "black", "none", "regular"),
resultMatrix.styledCell("67,000"),
resultMatrix.styledCell("40.656").withFormatting("{} %"),
)
resultMatrix.addRow(
resultMatrix.styledCell("High", "black", "none", "bold", "left").withFormatting("3️⃣️ {}"),
resultMatrix.styledCell("5", "black", "none", "regular"),
resultMatrix.styledCell("17,304"),
resultMatrix.styledCell("42.522").withFormatting("{} %"),
)
resultMatrix.addRow(
resultMatrix.styledCell("Very High", "black", "none", "bold", "left").withFormatting("4️⃣️ {}"),
resultMatrix.styledCell("3", "black", "none", "regular"),
resultMatrix.styledCell("14,469"),
resultMatrix.styledCell("41.798").withFormatting("{} %"),
)
return resultMatrix
Result
Icon Summary Example
Groovy
def resultMatrix = api.newMatrix("Name","Type","Icon")
resultMatrix.addRow(
resultMatrix.styledCell("Increase", "black", "none", "bold", "left"),
resultMatrix.styledCell("Trends", "black", "none", "regular"),
resultMatrix.styledCell("").withFormatting("▲").withCSS("color: green"),
)
resultMatrix.addRow(
resultMatrix.styledCell("Constant", "black", "none", "bold", "left"),
resultMatrix.styledCell("Trends", "black", "none", "regular"),
resultMatrix.styledCell("").withFormatting("▷"),
)
resultMatrix.addRow(
resultMatrix.styledCell("Decrease", "black", "none", "bold", "left"),
resultMatrix.styledCell("Trends", "black", "none", "regular"),
resultMatrix.styledCell("").withFormatting("▼").withCSS("color: red"),
)
resultMatrix.addRow(
resultMatrix.styledCell("Top", "black", "none", "bold", "left"),
resultMatrix.styledCell("Aggregation", "black", "none", "regular"),
resultMatrix.styledCell("").withFormatting("\uD83D\uDC4D"),
)
resultMatrix.addRow(
resultMatrix.styledCell("Worst", "black", "none", "bold", "left"),
resultMatrix.styledCell("Aggregation", "black", "none", "regular"),
resultMatrix.styledCell("").withFormatting("\uD83D\uDC4E\uD83C\uDFFC"),
)
resultMatrix.addRow(
resultMatrix.styledCell("Good", "black", "none", "bold", "left"),
resultMatrix.styledCell("Health", "black", "none", "regular"),
resultMatrix.styledCell("").withFormatting("✅"),
)
resultMatrix.addRow(
resultMatrix.styledCell("Bad", "black", "none", "bold", "left"),
resultMatrix.styledCell("Health", "black", "none", "regular"),
resultMatrix.styledCell("").withFormatting("❌"),
)
resultMatrix.addRow(
resultMatrix.styledCell("Low", "black", "none", "bold", "left"),
resultMatrix.styledCell("Category", "black", "none", "regular"),
resultMatrix.styledCell("").withFormatting("1️⃣"),
)
resultMatrix.addRow(
resultMatrix.styledCell("Normal", "black", "none", "bold", "left"),
resultMatrix.styledCell("Category", "black", "none", "regular"),
resultMatrix.styledCell("").withFormatting("2️⃣️"),
)
resultMatrix.addRow(
resultMatrix.styledCell("High", "black", "none", "bold", "left"),
resultMatrix.styledCell("Category", "black", "none", "regular"),
resultMatrix.styledCell("").withFormatting("3️⃣️ "),
)
resultMatrix.addRow(
resultMatrix.styledCell("Low", "black", "none", "bold", "left"),
resultMatrix.styledCell("Category", "black", "none", "regular"),
resultMatrix.styledCell("").withFormatting("4️⃣️"),
)
return resultMatrix
Result