Customer Banners (Ads) - SpiceUp. AX and SpotfireX Disclaimer



If you find this site useful and you want to support, buy me a coffee   to keep this site alive and without ads.

Change bar segment labels from percentage to value

# barChart is a BarChart Visualizaiton script parameter
# labelInformationType is an integer document property script parameter with values 0|1 for pct or value
from Spotfire.Dxp.Application.Visuals import BarChart
barChart.As[BarChart]().SegmentLabelInformationType = labelInformationType 


# if you need to toggle from percantage to value, you can do this too:
from Spotfire.Dxp.Application.Visuals import BarChart, BarChart,LabelInformationType
barChart = barChart.As[BarChart]()
barChart.SegmentLabelInformationType = LabelInformationType.Value if barChart.SegmentLabelInformationType==LabelInformationType.Percentage else LabelInformationType.Percentage

4 comments:

Unknown said...

Another way of doing this.

from Spotfire.Dxp.Application.Visuals import BarChart,LabelInformationType
barChart=barChart.As[BarChart]()
if barChart.SegmentLabelInformationType==LabelInformationType.Percentage:
barChart.SegmentLabelInformationType=LabelInformationType.Value
else:
barChart.SegmentLabelInformationType=LabelInformationType.Percentage

Jose Leviaguirre said...

Thanks Aditya for your suggestion. I added that option on the post.

Unknown said...

Thank you For suggestion.
Could you please suggest same for line chart
how to Change line chart labels from percentage to value?

Jose Leviaguirre said...

Checkout my friends site. It has plenty of examples https://sf-ref.com/