We would like to set Category to off on a card
visual through the Power BI Embedded API. Is this possible?
I’ve tried setting the property CategoryAxis
, Visible
to false
, but this did not achieve the desired outcome of suppressing the automatically generated title of the card.
In other words, the visual appears like this by default:
When you turn category off:
You get this:
We want to move the slider across programmatically using the API after the visual has been loaded, similar to changing title size for example, which can be done using setProperty
as shown here:
https://learn.microsoft.com/en-us/javascript/api/overview/powerbi/visual-properties#available-properties-for-out-of-the-box-visuals
This can be done by applying a theme.
The following theme json removes the category label on a card visual:
const changeCardVisualTheme: Theme = {
name: 'cardVisual',
visualStyles: {
card: {
'*': {
categoryLabels: [{
show: false
}]
}
}
}
};
Then to apply it using the Power Bi Report object in JavaScript:
await report.applyTheme(changeCardVisualTheme)