Forum Discussion
New Style Preset code in JSON - How do I set up my "Default" in the JSON?
- Anonymous1 year ago
hI andy808 ,
Thank you for the update!Glad it worked! Consider accepting your answer as solution,so other members in the community can easily find it.
Thanks again for your cooperation.Have a great day! - Anonymous1 year ago
Hi andy808 ,
I would like to confirm whether you have successfully resolved the issue .
If the issue has been resolved, please mark the helpful reply as a "solution" to indicate that the question has been answered and to assist others in the community.
Thank you for your cooperation. Have a great day.
Hi andy808 ,
Thank you for sharing the updated JSON and clarifying the issue and thank you Sahir_Maharaj for the helpful response!
Power BI does not automatically apply a named preset as the default. Instead, it uses the settings under the "*" section as the default style for all visuals of that type.In this case, columnChart.
To apply your Light Mode styling by default,try using below :
"visualStyles": {
"columnChart": {
"*": {
"legend": {
// Example Light Mode
"show": true,
"position": "Top",
"fontColor": { "solid": { "color": "#000000" } }
},
"stylePresets": [
{ "name": "Light Mode Preset" },
{ "name": "Dark Mode Preset" }
]
},
"Light Mode Preset": {
"legend": {
// Keep your Light Mode settings here for manual use
}
},
"Dark Mode Preset": {
"legend": {
// Dark Mode settings
}
}
}
}
This way, the Light Mode style is applied by default, and users can still switch to the Dark Mode preset manually in the Format pane if required.
Hope this resolve your query.If so,consider accepting it as solution.
Thank you.
Regards,
Pallavi.
Thanks Pallavi! That does work. From Microsoft documentation it seemed a bit more straight forward, but its not. Thanks again.
- Anonymous1 year agoNot applicable
hI andy808 ,
Thank you for the update!Glad it worked! Consider accepting your answer as solution,so other members in the community can easily find it.
Thanks again for your cooperation.Have a great day!