VB.net boxplot DATA_1D

Q&A for Visual Basic, Visual Basic .NET, and PowerBasic developers using DPlot
Post Reply
GregoryG
Posts: 4
Joined: Mon Dec 08, 2014 7:51 am

VB.net boxplot DATA_1D

Post by GregoryG »

Greetings: Sorry for a mistaken post to the excel subject


I'm trying to build a boxplot DATA_1D in vb.net. DPlot (not my own program) crashes on me. I've looked through the programmers guide, example projects and forums and I've not found a boxplot example. Here is the snippet of the code I'm sending.


Try

dMyPlot.Initialize()
dMyPlot.Version = DPLOT_DDE_VERSION
dMyPlot.DataFormat = DATA_1D
dMyPlot.ScaleCode = 1 ' Start with linear linear
dMyPlot.MaxCurves = intCountDataSets
dMyPlot.MaxPoints = intTotalDataCount
dMyPlot.NumCurves = intCountDataSets

For intI As Integer = 0 To intCountDataSets - 1
dMyPlot.NP(intI) = intDataCount(intI)
dMyPlot.LineType(intI) = LINESTYLE_NONE
Next

intDocNum = DPlot_Plot8(dMyPlot, dX(0), dY(0), strPlotCommands)


bDplotPlotExists = True

Catch ex As Exception
bDplotPlotExists = False
End Try
End If

Here is the string of commands I'm sending with strPlotCommands

[TickMarks(1,80,40)][LogTicks(0)][ManualScale(0,1E-06,4,1)][Scale(2)][XAxisLabel("Analysis Results")][YAxisLabel("Dilution factor (the ratio of runoff to downstream stormflow), unitless")][TextFont(1,8,400,0,0,0,0,"Univers 57 Condensed")][TextFont(2,6,400,0,0,0,0,"Univers 57 Condensed")][TextFont(3,6,400,0,0,0,0,"Univers 57 Condensed")][TextFont(4,8,400,0,0,0,0,"Univers 57 Condensed")][TextFont(5,8,400,0,0,0,0,"Univers 57 Condensed")][TextFont(6,6,700,0,0,0,0,"Univers 57 Condensed")][TextFont(7,9,400,0,0,0,0,"Univers 57 Condensed")][LineWidth(0,6.9444)][LineWidth(-1,6.9444)][LineWidth(-2,6.9444)][TickMarks(1,80,40)][Legend(0,"Explanation")][Legend(1,"Highway Example Analysis (I-81)")][Legend(2,"Highway Example Analysis (I-81) Metric")][Legend(3,"Highway Example Analysis (I-81) Metric2")][LegendShow(1)][LegendParams(,,1,1,0.98,0.02,1,2,-1)][GridLines(2)][ShowCaption(0)][Size(0,6.5,6.5)][AppMinimize()]

Any help would be appreciated.
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

Unless I miss something, you have not assigned the data values. So DPlot is getting a lot of undefined numbers (probably but not necessarily 0's). If that is the problem then there is likely an untrapped divide by 0 error in DPlot where it attempts to scale everything.
Visualize Your Data
support@dplot.com
GregoryG
Posts: 4
Joined: Mon Dec 08, 2014 7:51 am

Post by GregoryG »

Hi Dave:
I'm defining the data to be graphed graph elsewhere and calling the code I showed as such

Public Sub New(ByVal bBoxPlot As Boolean, ByVal intCountDataSets As Integer, ByVal intTotalDataCount As Integer,
ByVal bCaption As Boolean, ByVal strCaption As String,
ByVal intMyAxisType As Integer,
ByVal intDataCount() As Integer, ByVal strExplanationText() As String,
ByVal dX() As Double, ByVal dY() As Double, strPlotCommands As String)

For the scatter plot I get errors like "cannot graph zeroes on log scale" or "probability needs to be between 0 and 100" from DPLot if I use anything except 0 in

intDocNum = DPlot_Plot8(dMyPlot, dX(0), dY(0), strPlotCommands)

I tried the number of datasets, the number of datasets minus one (for a zero based array), the total data count and the total data count minus one.

within my program in vb.net I can just pass dX, and dY and it knows they are arrays, if I try this with the DPLOT_Plot8 call to GLOBAL.VB, then I get an error message in the Visual Studio coding window "value of type Double() cannot be converted to double". dX(0), d(Y) seems to be telling DPlot_Plot8 that dX and dY are one-dimensional arrays.

When I tried boxplot with the above option, I got
"Unhandled exception at 0x0069FD79 in DPLOT.EXE: 0xC000041D: An unhandled exception was encountered during a user callback"

I got this from DPlot code when visual studio offered a debug option for dplot.exe (don't worry the source did not show just the error).

If I'm doing a 1D plot (boxplot), then in the command
DPlot_Plot8(dMyPlot, dX(0), dY(0), strPlotCommands) is it using dX or dY as the variable to plot. Does it ignore dX or is dX supposed to be a group number (for example if I have 5 data sets is dx supposed to be 1,2,3,4, & 5 because that is what is on the X axis--5 sets of values? For the scatter, the dX values are the array of probabilities for each dataset.


I tried to change the function call in Global VB DPlot_Plot8 so it is x() and y(), which fixed the programming interface error, but broke the code when I tried to run the program and call DPlot_Plot8.

I also tried turning off Option Strict & Option Explicit to no avail

Thanks

Greg
PS the "Notify me when a reply is posted" did not work for me I did not get an email and I checked the SPAM so it did not go there
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

If I'm doing a 1D plot (boxplot), then in the command
DPlot_Plot8(dMyPlot, dX(0), dY(0), strPlotCommands) is it using dX or dY as the variable to plot. Does it ignore dX...
Yes. See http://www.dplot.com/lib/index.htm?dplot_plot.htm
Visualize Your Data
support@dplot.com
Post Reply