Search the web
Sign In
New User? Sign Up
statistica · STATISTICA group
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Set graph colors via VB   Message List  
Reply | Forward Message #652 of 1897 |
Hello All,

I am working on a VB application that allows a user to change many options
on a 3D XYZ Surface plot. I am unable to figure out how to change the
colors for each of the surfaces. I can record a Statistica-VB macro while I
change these on an existing plot (right-click, graph properties, plot:
fitting, surface specs, defining colors), but these steps do not show up in
the macro text.

Any assistance you can give would be most beneficial. I am using Statistica
6.0 and VB 6.0, some sample code showing my current status is below.

Thank you.
-Chad Voelker

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Private Function ObtainGraph(tGraph As tGraphPrefs, dStarting As Date,
dEnding As Date, lInterval As Long) As String()
Dim appStatistica As STATISTICA.Application

'Create a Statictica Spreadsheet
Set appStatistica = CreateObject("STATISTICA.Application")
Dim sprData As New Spreadsheet
Set sprData = appStatistica.ActiveSpreadsheet


'Place data in the Statictica Spreadsheet
sprData.SetSize 9, 3

sprData.Value(1, 1) = 10
sprData.Value(1, 2) = 10
sprData.Value(1, 3) = 100

'code removed for brevity

'Set the X and Y axis labels
sprData.VariableName(1) = "X Position"
sprData.VariableName(2) = "Y Position"
'Set the Z axis label = to the type of graph
If (tGraph.eType = AirSpeed) Then
sprData.VariableName(3) = "AirSpeed"
Else
sprData.VariableName(3) = "Temperature"
End If

'Create new Statictica Analysis
Dim dataAnalysis As Analysis

If (tGraph.eDimension = ThreeD) Then
Set dataAnalysis = appStatistica.Analysis(sc3dSurfacePlots, sprData)
Else
Set dataAnalysis = appStatistica.Analysis(sc3dContourPlots, sprData)
End If
With dataAnalysis.Dialog
'Always going to use three columns (X position, Y position, Value)
.Variables = "1 | 2 | 3"

'Obtain interpolation method from graph preferences
Dim scFit As eInterpolation
scFit = tGraph.eInterploationMethod
'Using graph preferences, set the type of interpolation
If (scFit = LINEAR) Then
.FitType = scXYZFitLinear
ElseIf (scFit = QUADRATIC) Then
.FitType = scXYZFitQuadratic
ElseIf (scFit = DWEIGHTEDLS) Then
.FitType = scXYZFitDistanceWeightedLeastSquares
ElseIf (scFit = NEWEIGHTEDLS) Then
.FitType = scXYZFitNegExponWeightedLeastSquares
ElseIf (scFit = SPLINE) Then
.FitType = scXYZFitSpline
End If

'Use graph preferences to decide whether or not to show raw data points
.ShowRawDataPoints = tGraph.bShowActualPoints

'We do not want to display multiple statistics in the graph
.DisplayMultiple_r_z_xy_p = False
End With

With dataAnalysis.Dialog.Options
'Set up title so that display what user entered (using graph prefs)
.DisplayDefaultTitle = False
.TitlePosition = scTitleTop
.Title = tGraph.sTitle

'Display Sub Title
.DisplayDefaultFootnote = True
.Footnote = tGraph.sSubTitle

'Use the spreadsheet headers (Set on spreadsheet above)
.DisplayCaseLabels = scCaseLabelOff
.CaseLabelsVariable = "1"

'We want to display axis text
.DisplayTextValuesAsAxisValues = True

'We want to use standard coordinates and axis
.CoordinateSystem = scCoordinateStandard
.XYAxisPosition = scAxisStandard

'Do not display the chart fit type
.DisplayFitExpressionInTitle = scFitOptionOff

'We want to leave the polynomial order to quadratic for all graphs
.PolynomialOrder = scQuadraticOrder

'All of the axis types should be linear scale
.AxisType(scX) = scLinearScale
.AxisType(scY) = scLinearScale
.AxisType(scZ) = scLinearScale
.AxisType(scV) = scLinearScale

End With

'Get graph object from Statistica
Dim theGraph As Graph
Set theGraph = dataAnalysis.Dialog.Graphs(1)
'Get the graph's layout
Dim theLayout As Layout3DScatterplot
Set theLayout = theGraph.Content
'Set the point of view for the graph's layout
If (tGraph.eDimension = ThreeD) Then
theLayout.PointOfView.HorizontalAngle = tGraph.iHorizontal
theLayout.PointOfView.VerticalAngle = tGraph.iVertical
Else
theLayout.PointOfView.HorizontalAngle = 90
theLayout.PointOfView.VerticalAngle = 90
End If
'Color *****does not work*****
'testLayout.Functions.Item(1).Surface.Style.Colors.Color(1).Color =
RGB(255, 10, 255)
'.Surface.BackColor = RGB(255, 10, 255)
'.Colors.Item.Color = RGB(255, 10, 255)
'testPlot.Item(1).Area.BackgroundColor.Color = RGB(255, 10, 255)
theGraph.Visible = True
'Temporarily display statistica
'dataAnalysis.RouteOutput(dataAnalysis.Dialog.Graphs).Visible = True

'Output graph to temporary location
appStatistica.Graphs(1).SaveAs "c:\temp\graphoutput.jpg", True

Dim sLocations(0) As String
sLocations(0) = "c:\temp\graphoutput.jpg"
ObtainGraph = sLocations

End Function
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



Mon Mar 4, 2002 4:46 am

voelkerc@...
Send Email Send Email

Forward
Message #652 of 1897 |
Expand Messages Author Sort by Date

Hello All, I am working on a VB application that allows a user to change many options on a 3D XYZ Surface plot. I am unable to figure out how to change the ...
Voelker, Chad
voelkerc@...
Send Email
Mar 4, 2002
4:49 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help