Reputation: 97
I'm trying to create a button in Spotfire that will change the Y-Axis in my chart to and from log- to linear-scale. I also have a line in the chart that is plotted from column values in a data table, and hence when the Y-Axis scale changes, I also need to change the line to a log scale.
Here is a picture of the property I want to change:
Here is a snippet of the code I have so far:
#import namespaces
from Spotfire.Dxp.Application.Visuals import VisualContent
from Spotfire.Dxp.Application.Visuals import AxisRange
from Spotfire.Dxp.Application.Visuals import FittingModels
#set variables
oil = oil_rate_time.As[VisualContent]()
islog = oil.YAxis.UseLogTransform
if islog:
oil.YAxis.UseLogTransform = False
else:
oil.YAxis.UseLogTransform = True
oil.ColumnValuesLine.YColumnReference
The last line is giving me the error that ColumnValuesLine is not an attribute in the ScatterPlot object.
Actual error text: (Traceback (most recent call last): File "Spotfire.Dxp.Application.ScriptSupport", line unknown, in ExecuteForDebugging File "", line 25, in AttributeError: 'ScatterPlot' object has no attribute 'ColumnValuesLine')
Thanks for the help!
Upvotes: 1
Views: 1401
Reputation: 97
In case anyone wanted to know the answer, this is how I did it:
#import namespaces
from Spotfire.Dxp.Application.Visuals import *
from Spotfire.Dxp.Data import *
#set variables
oil = oil_rate_time.As[ScatterPlot]()
islog = oil.YAxis.TransformType
tctable = tc_Table
if islog == AxisTransformType.None:
oil.YAxis.TransformType = AxisTransformType.Log10
oil.FittingModels[0].YColumnReference = tctable.Columns[18]
else:
oil.YAxis.TransformType = AxisTransformType.None
oil.FittingModels[0].YColumnReference = tctable.Columns[9]
Upvotes: 2