Dmitrii Nagaev Posted March 29 Share Posted March 29 Hi. I Created a ScatterPlot. Added a Straight Line Fit. How can i get r2 value (0.014) via Iron Python? I just can get Name of value. Thank you. Link to comment Share on other sites More sharing options...
David Boot-Olazabal Posted April 3 Share Posted April 3 Hi Dimitri, So far we haven't been able to find something in iron python code that could do this. To have a better look at your request, could you share your dxp and current iron python script? Kind regards, David Link to comment Share on other sites More sharing options...
Dmitrii Nagaev Posted April 4 Author Share Posted April 4 (edited) Hi, @David Boot-Olazabal Created a demo dxp file. My original task is change Straight Line Fit color if regression (r2 > 0.3). Current value on a tooltip is 0.198 Thank you. demo-regression-scatter-plot.dxp demo-regression-scatter-plot.dxp Edited April 4 by Dmitrii Nagaev Link to comment Share on other sites More sharing options...
Dmitrii Nagaev Posted April 4 Author Share Posted April 4 (edited) I also found: https://docs.tibco.com/pub/doc_remote/sfire_dev/area/doc/api/tib_sfire-analyst_api/html/M_Spotfire_Dxp_Application_Visuals_FittingModels_FittingModel_GetCurve.htm fitting_model.GetCurve('r2') But i got error and can't solve it 😅: Traceback (most recent call last): File "<string>", line 398, in <module> File "<string>", line 320, in run File "<string>", line 198, in set_chart_settings TypeError: cannot access protected member GetCurve without a python subclass of FittingModel IronPython.Runtime.Exceptions.TypeErrorException: cannot access protected member GetCurve without a python subclass of FittingModel Edited April 4 by Dmitrii Nagaev Link to comment Share on other sites More sharing options...
David Boot-Olazabal Posted April 4 Share Posted April 4 Hi Dmitrii, Thank you for the dxp file. One of my colleagues created an iron python script, that solves the enigma of capturing the R2 value. In the attached file, you'll see a second iron python script and the R2 value being displayed in the text area. The solution itself, uses a second data table to store the data from the R2 in, so that it can be pushed to a document property. On such a short notice, this is the best option we can think of for now. But at the same time, we're also looking into making it more user friendly. We will update you if we have found a better way. Kind regards, David demo-regression-scatter-plot.dxp Link to comment Share on other sites More sharing options...
Dmitrii Nagaev Posted April 4 Author Share Posted April 4 (edited) @David Boot-Olazabal sorry, but it doesn't work. I think that you didn't attached Data function, because additional table was created. Could you please add it. Edited April 4 by Dmitrii Nagaev Link to comment Share on other sites More sharing options...
David Boot-Olazabal Posted April 4 Share Posted April 4 Hi Dmitrii, There is no data function in this approach. This second table is created as part of the iron python script. That is why you will see the fx symbol in the data source box. The r2 column holds the output of the r2 value from the line regression, which is better 'readable' in the Fit Results data table. And that should correspond with the r2 value in your scatterplot. Kind regards, David Link to comment Share on other sites More sharing options...
Dmitrii Nagaev Posted April 4 Author Share Posted April 4 Thank you. Then i would say that your collegue didn't save that iron python script. I see just 1 my script. 😅 RunME and RetrieveR2 has the same script in attachment. Link to comment Share on other sites More sharing options...
David Boot-Olazabal Posted April 5 Share Posted April 5 Hi Dmitrii, That would have been me :-). But I can't see the mix up of the two scripts when I open the dashboard. So that is weird... I have adapted the dashboard (v2) in such a way that only the new script is available. It should be fine now. I also would like to inform you, that there is a way to keep the whole process in one script. We have not yet build it, but as soon as it has been fixed, we will update you. Kind regards, David demo-regression-scatter-plot v2.dxp 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