I have a stacked bar chart, split by a boolean field. This causes the legend to appear with two colours (cool!) but the legend has these values: true and false. To the reader, there is no context for what is true or false means.
In this case, the field name is is_active
.
At the very least having the field name appear in the legend will help people read and understand the chart.
Better: Is there a way to replace "true" and "false" with "Active" and "Inactive" respectively?
I tried this Advanced->JSON Input:
{
"script": {
"inline": "doc['is_active'].value ? 'Active' : 'Inactive'",
"lang": "painless"
}
}
Which results in an error "String cannot be cast to java.lang.Number". If I replace the strings in the JSON Input with numbers, the numbers do indeed appear in the legend. No help though.
Instead of using term aggregation
in split series
bucket, use filter aggretation
. Create two filters, one for true
and one for false
and apply custom labels there.