Automation Example - ScatterPlot

 

This is an example for ScatterPlot.

'********************************************************************************************

' ScatterPlotModule.bas

' This script loads a data file and adds a scatter plot to it.

' It then changes all the properties of the scatter plot.

'

'                                    -by SKP 4/2010

'

'********************************************************************************************

Sub Main

 

 'Declares VoxlerApp as an object

  Dim VoxlerApp As Object

 

 'Creates an instance of the Voxler application object

 'and assigns it to the variable named "VoxlerApp"

  Set VoxlerApp = CreateObject("Voxler.Application")

 

 'Make Voxler visible

  VoxlerApp.Visible = True

 

 'Access CommandApi

  Set CommandApi = VoxlerApp.CommandApi

 

 'Create a new Voxler document

  CommandApi.Construct ("New")

  CommandApi.DoOnce()

 

 'Load the data file

  CommandApi.Construct("Import")

  CommandApi.Option("AutoConnect", "False")

  CommandApi.Option ("DefaultPosition", "True")

  CommandApi.Option ("Path", VoxlerApp.Path+"\Samples\GoldConcentration.dat")

  CommandApi.Option ("Options", "Defaults=1;EatWhitespace=1;Delimiter=Space,tab,comma,semicolon;TextQualifier=doublequote,quote")

  CommandApi.Option ("Filter", "dat")

  CommandApi.Option ("GuiEnabled", "False")

  CommandApi.Do()

 

 'Add a scatter plot

  CommandApi.Construct("CreateModule")

  CommandApi.Option ("AutoConnect", "False")

  CommandApi.Option ("SourceModule", "GoldConcentration.dat ")

  CommandApi.Option ("Type", "ScatterPlot")

  CommandApi.Do()

 

 'Connect the isosurface and data modules

  CommandApi.Construct ("ConnectModules")

  CommandApi.Option ("SourceModule", "GoldConcentration.dat ")

  CommandApi.Option ("TargetModule", "ScatterPlot")

  CommandApi.Do()

 

 'This section changes the symbol

 'This is a number between 0 and 30.  0 is the top marker in the list.  30 is the bottom marker in the list.

  CommandApi.Construct ("ModifyModule")

  CommandApi.Option ("Module", "ScatterPlot")

  CommandApi.Option ("ScatterPlotMarker", "17")

  CommandApi.Do()

 

 'This changes the symbol size for symbol marker numbers 0 to 29.

 'This is a number between 0 and 2. 0 is the smallest, 2 is the largest sized symbol.

  CommandApi.Option ("ScatterPlotSizeMarker", "2")

  CommandApi.Do()

 

  Wait (4)

 

 'This changes the symbol to the last symbol

  CommandApi.Option ("ScatterPlotMarker", "30")

 CommandApi.Do()

 

 'This changes the symbol size for marker number 30

 'This is a number between 0 and 48.  The larger the number, the larger the symbol.

  CommandApi.Option ("ScatterPlotSizePoint", "3.7")

  CommandApi.Do()

 

 'This changes the density of points to 50%

 'This is a number between 0 and 7.

 '0 = 100%, 1 = 50%, 2 = 33%, 3 = 25%, 4 = 20%, 5 = 10%, 6 = 5%, 7 = 1%

  CommandApi.Option ("ScatterPlotDensity", "3")

  CommandApi.Do()

 

 'This shows lines connecting the scatter points

  CommandApi.Option ("ScatterPlotShowLines", "True")

  CommandApi.Do()

 

 'This changes the line width of the scatter plot lines

  CommandApi.Option ("ScatterPlotLineWidth", "3.2")

  CommandApi.Do()

 

 'This changes the color method to Fixed

  CommandApi.Option ("ScatterPlotColorMethod", "0")

  CommandApi.Do()

 

 'This changes the color of the fixed scatter plot points

  CommandAPi.Option ("ScatterPlotColorFixed", "Magenta")

  CommandApi.Do()

 

  Wait (2)

 

 'This changes the color method to By Data

  CommandApi.Option ("ScatterPlotColorMethod", "1")

  CommandApi.Do()

 

 'This changes the color map being used to the "Rainbow" map

  CommandApi.Option ("ScatterPlotColormap", "Rainbow")

  CommandApi.Do()

 

 'This changes the color component, when the data set has more than one component

  CommandApi.Option ("ScatterPlotColorComponent", "2")

  CommandApi.Do()

 

 'Display the ScatterPlot legend

  CommandApi.Option ("ScatterPlotLegendEnable", "True")

  CommandApi.Do()

 

 'Change the legend orientation

 '0 is for horizontal, 1 is for vertical

  CommandApi.Option ("ScatterPlotLegendOrientation", "0")

  CommandApi.Do()

 

 'Change the legend X position

 'Ranges from 0-1

  CommandApi.Option ("ScatterPlotLegendXPos", "0.3")

  CommandApi.Do()

 

 'Change the legend Y position

 'Ranges from 0-1

  CommandApi.Option ("ScatterPlotLegendYPos", "0.9")

  CommandApi.Do()

 

 'Change the legend width

 'Ranges from 0-200

  CommandApi.Option ("ScatterPlotLegendWidth", "20")

  CommandApi.Do()

 

 'Change the legend length

 'Ranges from 0-1024

  CommandApi.Option ("ScatterPlotLegendLength", "400")

  CommandApi.Do()

 

 'Change the legend title

  CommandApi.Option ("ScatterPlotLegendTitle", "Legend Title")

  CommandApi.Do()

 

 'Change the legend title font size

 'Ranges from 4-72

  CommandApi.Option ("ScatterPlotLegendTitleHeight", "20")

  CommandApi.Do()

 

 'Change the number of labels displayed in a legend

  CommandApi.Option ("ScatterPlotLegendNumLabels", "3")

  CommandApi.Do()

 

 'Change the legend to use custom labels

  CommandApi.Option ("ScatterPlotLegendUseCustomLabels", "True")

  CommandApi.Do()

 

 'Set the custom labels for the legend

  CommandApi.Option ("ScatterPlotLegendCustomLabels", "1.7:low, 2.1:medium, 2.9:intermediate, 3.2:elevated, 3.7:high")

  CommandApi.Do()

 

 'Set the height for the legend labels

  CommandApi.Option ("ScatterPlotLegendLabelHeight", "8")

  CommandApi.Do()

 

 'Set the label format type for the legend

  CommandApi.Option ("ScatterPlotLabelFormatType", "0")

  CommandApi.Do()

 

 'Set the number of digits to display on the labels

  CommandApi.Option ("ScatterPlotLabelFormatNumDigits", "2")

  CommandApi.Do()

 

 'Set the legend label prefix

  CommandApi.Option ("ScatterPlotLabelFormatPrefix", "pre-")

  CommandApi.Do()

 

 'Set the legend label postfix

  CommandApi.Option ("ScatterPlotLabelFormatPostfix", "-post")

  CommandApi.Do()

 

 'Set the legend font

  CommandApi.Option ("ScatterPlotLegendFont", "Arial")

  CommandApi.Do()

 

 'Turn on or off antialiasing for the legend

  CommandApi.Option ("ScatterPlotLegendAntialias", "True")

  CommandApi.Do()

 

 'Set the line and text color for the legend

  CommandApi.Option ("ScatterPlotLegendFGColor", "Blue")

  CommandApi.Do()

 

 'Set the background color for the legend

  CommandApi.Option ("ScatterPlotLegendBGColor", "10% Gray")

  CommandApi.Do()

 

 'Turn on or off the display of the legend background

  CommandApi.Option ("ScatterPlotLegendShowBackground", "True")

  CommandApi.Do()

 

End Sub

 

 

See Also

Automation Model

ScatterPlot