Jagamohan Sahoo Posted March 7, 2019 Share Posted March 7, 2019 Hello Team, I have a line chart trend which shows "Total Value" & " %Total Value" based on a document property drop down change through script. However while changing over from "Total Value" to " %Total Value", the script is not applying the % symbol with currency type correctly on "Line chart". Can anyone suggest or enhance this what goes wrong (its showing as decimal ex: 0.98 or 0.34 ). ### Description about the property control used and object ### vizL -> Line chart visualization. vizC -> Cross table visualization. dpMeasure -> pointing to the drop down control holds value "Total Value" & " %Total Value" dpSwitch -> pointing to the drop down control holds value "Line Chart" & "Bar chart" to toggle. Calender Date Hierarchy -> it is a hierarchy to toggle between Year/Quarter/Month. dpCalender -> It's a slider control to toggle between Year/Quarter/Month. and been set to X-Axis of line chart. The field here we are using is a "Currency Type". from Spotfire.Dxp.Data import* from Spotfire.Dxp.Application.Visuals import* from Spotfire.Dxp.Application.Visuals import * from Spotfire.Dxp.Application.Visuals import ScaleAxis from System import Globalization from Spotfire.Dxp.Data.Formatters import * from System.Globalization import CultureInfo vizL = vizL.As[LineChart]() vizC= vizC.As[CrossTablePlot]() if dpMeasure == "Total Value" and dpSwitch == "Line Chart": vizL.XAxis.Expression = "" vizL.YAxis.Expression='Sum([Total Value]) As [Total Value]' formatter = DataType.Real.CreateLocalizedFormatter() formatter.Category = NumberFormatCategory.Number formatter.DecimalDigits = 1 formatter.GroupSeparatorEnabled = True formatter.NegativePattern = NumberFormatNegativePattern.NegativeSign formatter.ShortFormattingEnabled = False vizL.YAxis.Scale.Formatting.RealFormatter = formatter vizL.ShowMarkers = True vizC.RowAxis.Expression = "" vizC.MeasureAxis.Expression = "Sum([Total Value]) As [Total Value]" elif dpMeasure == "%Total Value" and dpSwitch == "Line Chart": vizL.XAxis.Expression = "" vizL.YAxis.Expression='Sum([Total Value]) THEN [Value] / Sum([Value]) OVER (All([Axis.Color]))*100 As [%Total Value]' formatter = DataType.Real.CreateLocalizedFormatter() formatter.Category = NumberFormatCategory.Percentage formatter.DecimalDigits = 1 formatter.GroupSeparatorEnabled = True formatter.NegativePattern = NumberFormatNegativePattern.NegativeSign formatter.ShortFormattingEnabled = False vizL.YAxis.Scale.Formatting.RealFormatter = formatter vizL.ShowMarkers = True vizC.RowAxis.Expression = "" vizC.MeasureAxis.Expression = "Sum([Total Value]) THEN [Value] / Sum([Value]) OVER (All([Axis.Color]))*100 As [%Total Value]" Link to comment Share on other sites More sharing options...
Erik Dahlman Posted March 7, 2019 Share Posted March 7, 2019 I haven't tried this but a guess is that if Total Value is of the datatype currency you need to create a DataType.Currency.CreateLocalizedFormatter() and then set it to theYAxis.Scale.Formatting.CurrencyFormatter. I'm guessing the plot accepts your valid real formatter and then just doesn't use it because the expression is currency. Link to comment Share on other sites More sharing options...
Jagamohan Sahoo Posted March 7, 2019 Author Share Posted March 7, 2019 Thank ypu Erik, for your input here. Let me try & will update. Link to comment Share on other sites More sharing options...
Jagamohan Sahoo Posted March 8, 2019 Author Share Posted March 8, 2019 Hi , I did tried the same , however it still shows in decimal!!! 32.45 or 56.78 like this Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now