ron quach 2 Posted April 5, 2023 Share Posted April 5, 2023 from Spotfire.Dxp.Application.Visuals import CategoryKeyfrom Spotfire.Dxp.Application.Visuals import CombinationChartmyCategoryKey1=CategoryKey("Sum(ColA)")#Perform sortingvis.As[CombinationChart]().SortBy=myCategoryKey1 Link to comment Share on other sites More sharing options...
Heleen Snelting Posted April 5, 2023 Share Posted April 5, 2023 Hi @ron quach would it be possible to share the dxp? Include a small dummy dataset representative of what you are using? It will then be easier for anyone looking at this to provide more specific script troubleshooting suggestions. Its not clear what type of error messages you are getting for example.Thanks!Heleen Link to comment Share on other sites More sharing options...
ron quach 2 Posted April 5, 2023 Author Share Posted April 5, 2023 Hi Hellen,Here is the sample dxp. The script will sort the combo chart "Sort x-axis by" ok with myCategoryKey1=CategoryKey("Sum(Out)"),but it incorrectly sorts if I use myCategoryKey2=CategoryKey("Sum(Out)/Sum(In)") . Sum(Out)/Sum(In) = Yield %.ThanksRonUse Script it has incorrect Sort by Yield% or Sum(Out)/Sum(In) Use "sort x-asis by" has correct sort by Yield% or Sum(Out)/Sum(In) Link to comment Share on other sites More sharing options...
Gaia Paolini Posted April 6, 2023 Share Posted April 6, 2023 myCategoryKey=CategoryKey('Yield %') Link to comment Share on other sites More sharing options...
ron quach 2 Posted April 6, 2023 Author Share Posted April 6, 2023 Thanks Gaia. It works. I want to select any Y-Axis value, IN, OUT, Yield %, from the list box ${SortOpitons} then sort it, but it does not work.Please help.ThanksRonScriptfrom Spotfire.Dxp.Application.Visuals import CategoryKeyfrom Spotfire.Dxp.Application.Visuals import CombinationChart#Define sorting myCategoryKey# myCategoryKey1=CategoryKey("Sum(Out)")myCategoryKey2=CategoryKey("${SortOpitons}")#Perform sortingvis.As[CombinationChart]().SortBy=myCategoryKey2 Link to comment Share on other sites More sharing options...
Gaia Paolini Posted April 11, 2023 Share Posted April 11, 2023 The document property needs to go into the script as an input parameter. I changed the values assigned to the drop down list (I don't think the as [..] construct works (there is no need for that anyway), and Yield % needs to be referred as such, re: my previous answer (I am not sure why, but since it works manually, it will work in a script).Attached the modified dxp. Link to comment Share on other sites More sharing options...
ron quach 2 Posted April 12, 2023 Author Share Posted April 12, 2023 I cannot open your dxp. Please check if my doc property as script input parameter is correct.ThanksRon Link to comment Share on other sites More sharing options...
Gaia Paolini Posted April 12, 2023 Share Posted April 12, 2023 This is the setting inside the drop down list:This is the script: the sort input variable was correctly defined but it does not need to be surrounded by quotes: Link to comment Share on other sites More sharing options...
ron quach 2 Posted April 12, 2023 Author Share Posted April 12, 2023 Hi Gaia, I followed yours, but it is still did not work. I attach dxp for you to check.thanksRon Link to comment Share on other sites More sharing options...
Gaia Paolini Posted April 13, 2023 Share Posted April 13, 2023 I think the issue is still what you choose as value (Expression) in your dropdown. You need to look at what the manual options are and set them exactly the same way in your dropdown -> script.So if you open your chart's Properties, go to Appearance, you see what is listed under Sort x-axis by: That is what you want to use in your dropdown. I see your options are now 'IN', 'OUT' and 'Yield %'.I don't mean the Display Name (what people see), I mean the actual Expression (what is sent to the script.) Link to comment Share on other sites More sharing options...
ron quach 2 Posted April 13, 2023 Author Share Posted April 13, 2023 It works now. Thank you very much Gaia It is trickly. I thought sorting X-Axis in the appearance need the formula like Y-Axis in combo chart. 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