Add Distribution Fitting & Simulation Features to Your Applications |
||||||||||||||||||||||||||||||
SPA SDK Help Home • Learn More About the SPA SDK | ||||||||||||||||||||||||||||||
Creating GraphsThe SPA SDK allows to create a variety of graph types that can be saved as image files or displayed directly to the users of your applications. Before creating the graphs, you might want to specify some options affecting their appearance, such as the title, size, colors, and fonts. This can be done through the SPAApplication.GraphOptions property. To actually create a graph, call the SPADataSet.Graph method with the following arguments:
Depending on the SPAApplication.GraphOptions.Destination property value, the resulting graph can be saved to an image file, copied to the Clipboard, or returned as a Picture object directly to your application. ExampleSub Test() Dim dataSet As New SPADataSet Dim fitResults() As Variant Dim count As Long Dim data(5) As Double Dim empty() As Double SPAApplication.Initialize ' specify the data data(0) = 1.5 data(1) = 3.2 data(2) = 9.6 data(3) = 4.1 data(4) = 7.8 ' assign the data Call dataSet.Assign(SPADomainContinuous, SPADataSample, data, empty) ' run the fit count = dataSet.Fit(SPADistAll, fitResults) ' show the two best fitting distributions If count > 0 Then fitResults(0).ShowOnGraph = True If count > 1 Then fitResults(1).ShowOnGraph = True ' specify the graph options SPAApplication.GraphOptions.Destination = SPABMPImage ' create the CDF graph and display it in a PictureBox control Set Picture1 = dataSet.Graph(SPAGraphCdf, fitResults) ' change the graph destination SPAApplication.GraphOptions.Destination = SPAJPGFile SPAApplication.GraphOptions.DestinationFileName = "c:\graph.jpg" ' change the number of histogram bins SPAApplication.GraphOptions.NumBins = 10 ' create the empirical PDF graph (the histogram) and save it to a file Call dataSet.Graph(SPAGraphPdf, Null) End Sub |
||||||||||||||||||||||||||||||
Copyright © MathWave Technologies www.mathwave.com |