Previn Chetty 3 Posted January 22, 2019 Share Posted January 22, 2019 Hi Guys, I was wondering if there is a method to change the default shape used on the ShapeBy on a scatterPlot. I have a dropdown that changes the Marker value (column that's used). When I change it, the shape defaults. I need the shape to stay fixed on TriangleUP. Is there a method to do this through Spotfire Or will I need to get this done through an IronPython script If so, how would I do this I have tried adding this but it does not seem to work. This should kick off each time I change the MarkerBy. #set shapeby MyChart.ShapeAxis.DefaultShape = MarkerShape(MarkerType.TriangleUp) Spotfire V7.12 Link to comment Share on other sites More sharing options...
Kirsten Smith (she/her) Posted January 22, 2019 Share Posted January 22, 2019 Click on Tools/Options/Scatter Plot to set the default shape for Scatter Plots. This will not change any existing scatter plots but should come into effect when you create a new scatter plot. Link to comment Share on other sites More sharing options...
Previn Chetty 3 Posted January 24, 2019 Author Share Posted January 24, 2019 Thanks Kirsten! Wow that was so much easier than I thought! Link to comment Share on other sites More sharing options...
Previn Chetty 3 Posted January 24, 2019 Author Share Posted January 24, 2019 This hasn't fully solved my problem. Looks like the only option I have is a script. Does anyone know how to change the ShapeBy through a script This is my current Script (for information purposes): ***I'm new to Python*** from Spotfire.Dxp.Application.Visuals import * from Spotfire.Dxp.Data import DataPropertyClass #get a reference to your viz script parameter myChart = MyChart = vis.As[scatterPlot]() #read min,max from document properties Xmin = Document.Data.Properties.GetProperty(DataPropertyClass.Document, "LIFX").Value Xmax = Document.Data.Properties.GetProperty(DataPropertyClass.Document, "UIFX").Value Ymin = Document.Data.Properties.GetProperty(DataPropertyClass.Document, "LIFY").Value Ymax = Document.Data.Properties.GetProperty(DataPropertyClass.Document, "UIFY").Value Outlier = Document.Data.Properties.GetProperty(DataPropertyClass.Document, "Outliers").Value #apply zoom range if Outlier == 'Hide': MyChart.XAxis.ManualZoom = False MyChart.YAxis.ManualZoom = False MyChart.YAxis.Range = AxisRange(Ymin,Ymax); MyChart.XAxis.Range = AxisRange(Xmin,Xmax); else: MyChart.YAxis.Range = AxisRange('Automatic','Automatic'); MyChart.XAxis.Range = AxisRange('Automatic','Automatic'); MyChart.XAxis.ManualZoom = True MyChart.YAxis.ManualZoom = True #set shapeby MyChart.ShapeAxis.DefaultShape = MarkerShape(MarkerType.TriangleUp) Link to comment Share on other sites More sharing options...
Previn Chetty 3 Posted February 18, 2019 Author Share Posted February 18, 2019 Here is the solution that worked for me. Hope it helps someone in future. This IronPython script changed the ShapeBy for me each time I changed the "MarkerBy"(shape would reset to the default). from Spotfire.Dxp.Application.Visuals import ScatterPlot,MarkerShape,MarkerType,CategoryKey vis = v.As[scatterPlot]() #params shape = Document.Properties["ShapeByType"] category = Document.Properties["ShapeByCategory"] markerType = getattr(MarkerType,shape) vis.ShapeAxis.ShapeMap[category] = MarkerShape(markerType) #list available shapes to copy and add data table from clipboard to populate shape dropdown: shapes = [a for a in dir(MarkerType) if not callable(getattr(MarkerType,a)) and not '__' in a ] 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