Are examples available for the new Visual c# 2005? I want to make sure that I link to dplot correctly.
Thanks,
Dean
Visual C# 2005
Moderator: DPlotAdmin
- DPlotAdmin
- Posts: 2312
- Joined: Tue Jun 24, 2003 9:34 pm
- Location: Vicksburg, Mississippi
- Contact:
Dean,
Unfortunately I'm a bit of a dinosaur and haven't tried C# 2005 yet. Linking should not be a problem. I'd be very surprised if the dplotlib.lib in the c\msvc folder doesn't work. But the interface stuff found in dplot.h, i.e.
Unfortunately I'm a bit of a dinosaur and haven't tried C# 2005 yet. Linking should not be a problem. I'd be very surprised if the dplotlib.lib in the c\msvc folder doesn't work. But the interface stuff found in dplot.h, i.e.
will likely require some changes. I'll post something when I've finally made the move. Sorry I can't give a better answer right now.int __stdcall DPlot_Plot(DPLOT *DPlot, float *x, float *y, LPSTR commands);
Visualize Your Data
support@dplot.com
support@dplot.com
I am also a dinsoaur, but I have had a shot at this c# stuff with dplot and here is what I found. Hope it helps. Sorry about the scrambly formatting.
Csharp tricks
Discovered while trying to write a simplified mplot (which calls dplotlib) in csharp.
Dplotlib.dll is an ordinary windows dll. Not a dotnet created dll.
In order to use dplotlib.dll, one needs to set up a dplot object, and some constants, and also “declare” the calls to the dplotlib dll. This text is about how you create a class library as a dotnet dll and use it to define the objects and constants required by this other dll
For other languages, an example is supplied with dplotlib and one just copies it. There is a VB.net example which includes a module, module1 in plotglobals.vb. There is no c# example.
As there is no c# example, and .net is “designed from the ground up” to allow calls between stuff in different languages one concludes that it should be possible to use the stuff in plotglobals.vb to create a thing which is useable in c#.
I tried just copying plotglobals.vb into the directory and adding it to the project.. Didn’t produce the goods.
What seems to work is converting the module into a class, as shown below, in a vb project which is opened as make a class library. Building this results in a dll. In the c# project, use menu “project/add reference” to browse to this dll and add it. Then you still have to put in a “using” statement to use the namespace of this classlibrary in your c# project.
Now we get to the tricky bit. Once you have done the above, it is possible to use the class inside the c# ide. The intellisense works and you get to see all the constants and properties and methods OK. However, when you build and run, you get a rude message about how it cannot find plotglobals, or one of its dependencies. Now this is weird, because in the ide, when you look at the references, one of the properties of the plotglobals refernce is its absolute path, and it is there OK. So why doesn’t the thing find it at execution time.
The answer is partly revealed by inspecting the “manifest” of the exe produced from c#, To see the manifest, execute
C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin>ildasm
and use the file menu in it to open the exe.
In the manifest, you can see plotglobals referred to without any path. Now, the fat book “professional c# 2005” says that when you use add reference, the target dll is copied to the output directory of the project you did the add reference in. This isn’t true. But it should be. If you manually copy the dll into the right spot, then the error about not finding it goes away.
Here is the vb plotglobals class definition. There are more clues after this
Imports System.Runtime.InteropServices
' DPlot-specific stuff
'
Public Class mod1
Public Const DPLOT_DDE_VERSION As Short = 3 ' Version 3 structure allows up to 100 data sets per plot
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi)> Public Structure DPLOT
Dim Version As Integer ' version number of this structure, should be set by caller to DPLOT_DDE_VERSION
Dim hwnd As Integer ' handle of client application window
Dim DataFormat As Integer ' XY pairs, DX and Y, etc. See DATA_ constants
Dim MaxCurves As Integer ' DataFormat Description
' DATA_XYXY Max. number of curves, <= 100
' DATA_DXY ..
' DATA_XYYY ..
' DATA_3D Number of grid cells in X direction,
' = number of data columns-1
' DATA_3DR not used
' DATA_1D Max. number of groups, <= 100
' DATA_3DS Max. number of data sets, <= 100
Dim MaxPoints As Integer ' DATA_XYXY Max. number of points/curve
' DATA_DXY ..
' DATA_XYYY ..
' DATA_3D Number of grid cells in Y direction,
' = number of data rows-1
' DATA_3DR Number of X,Y,Z triplets
' DATA_1D Max. number of points/group
' DATA_3DS Max. number of points/data set
Dim NumCurves As Integer ' Actual number of curves/groups, always 1 for
' DATA_3D or DATA_3DR
Dim ScaleCode As Integer ' scaling code for XY plots (Linear, Log, etc.)
Dim LegendX As Single ' left coord of legend, expressed as a ratio
' of plot size (0->1) (CAN be negative and/or > 1,
' but exact placement is then a bit hard to predict)
Dim LegendY As Single ' top coord of legend, again expressed as a ratio
' of plot size
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=100)> Public NP() As Integer
' Actual number of points in each curve/group. Not used for DATA_3D.
' Cannot exceed MaxPoints.
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=100)> Public LineType() As Integer ' Line types (see codes below)
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=100)> Public SymbolType() As Integer ' Symbol types (see codes below)
Dim SizeofExtraInfo As Integer
' Extra information following X,Y data. No need to
' fill in this member for DPLOTLIB calls
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=8080)> Public Legend As String
' Legend(0->79) is the caption for the legend
' Legend(n*80->n*80+79) is the caption for the n'th curve
' Ideally this would be dimensioned as Legend(0 to 100) as String*80,
' but I don't see a way to do that. Same problem exists for the Label array (next).
' Fortunately we can get around this mess with individual DPlot commands.
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=4000)> Public Label As String
' Strings displayed beside the last data point
' in a curve, 40 characters per curve
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=80)> Public Title1 As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=80)> Public Title2 As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=80)> Public Title3 As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=80)> Public XAxis As String ' X Axis label.
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=80)> Public YAxis As String ' Y Axis label.
Public Sub Initialize()
ReDim NP(99)
ReDim LineType(99)
ReDim SymbolType(99)
End Sub
End Structure
Public Structure DPLOT_PLOTMETRICSEX
Dim size As Integer ' size of this structure, should be filled in by the caller
Dim hll As Integer ' horizontal and
Dim vll As Integer ' vertical coordinates of the lower left corner of the plot, in pixels
Dim hur As Integer ' horizontal and
Dim vur As Integer ' vertical coordinates of the upper right corner of the plot, in pixels
Dim xlo As Single ' value of x at the left plot extent
Dim ylo As Single ' value of y at the bottom plot extent
Dim xhi As Single ' value of x at the right plot extent
Dim yhi As Single ' value of z at the top plot extent
Dim stretch_x As Single
Dim stretch_y As Single
Dim stretch_z As Single
Dim scale As Single
Dim azimuth As Single
Dim elevation As Single
End Structure
Declare Function DPlot_AddData Lib "c:\dplotx\dplotlib.dll" (ByVal DocNum As Integer, ByVal DataType As Integer, ByVal NumPts As Integer, ByVal Curve As Integer, ByRef x As Single, ByRef y As Single) As Integer
Declare Function DPlot_GetBitmap Lib "c:\dplotx\dplotlib.dll" (ByVal DocNum As Integer, ByVal cx As Integer, ByVal cy As Integer) As IntPtr
Declare Function DPlot_GetBitmapEx Lib "c:\dplotx\dplotlib.dll" (ByVal DocNum As Integer, ByVal cx As Integer, ByVal cy As Integer, ByRef DPM As DPLOT_PLOTMETRICSEX) As IntPtr
Declare Function DPlot_GetEnhMetaFile Lib "c:\dplotx\dplotlib.dll" (ByVal DocNum As Integer, ByVal cx As Single, ByVal cy As Single) As Integer
Declare Function DPlot_Plot Lib "c:\dplotx\dplotlib.dll" (ByRef d As DPLOT, ByRef x As Single, ByRef y As Single, ByVal cmds As String) As Integer
Declare Function DPlot_Plot8 Lib "c:\dplotx\dplotlib.dll" (ByRef d As DPLOT, ByRef x As Double, ByRef y As Double, ByVal cmds As String) As Integer
Declare Function DPlot_Command Lib "c:\dplotx\dplotlib.dll" (ByVal DocNum As Integer, ByVal Command_Renamed As String) As Integer
Declare Function DPlot_Request Lib "c:\dplotx\dplotlib.dll" (ByVal DocNum As Integer, ByVal Item As String, ByVal Value As String, ByRef MaxCount As Integer) As Integer
Declare Sub DPlot_SetErrorMethod Lib "c:\dplotx\dplotlib.dll" (ByVal method As Integer)
Declare Function DPlot_Start Lib "c:\dplotx\dplotlib.dll" (ByVal Minimize As Integer, ByRef WasActive As Integer) As Integer
Declare Sub DPlot_Stop Lib "c:\dplotx\dplotlib.dll" ()
' XY Scaling codes:
Public Const SCALE_LINEARX_LINEARY As Short = 1
Public Const SCALE_LINEARX_LOGY As Short = 2
Public Const SCALE_LOGX_LINEARY As Short = 3
Public Const SCALE_LOGX_LOGY As Short = 4
Public Const SCALE_TRIPARTITE As Short = 5
Public Const SCALE_LINEARX_PROBABILITY As Short = 6
Public Const SCALE_GRAINSIZE_DIST As Short = 7
Public Const SCALE_POLAR As Short = 8
Public Const SCALE_BARCHART As Short = 9
Public Const SCALE_LOGX_PROBABILITY As Short = 10
Public Const SCALE_PROBX_LINEARY As Short = 11
Public Const SCALE_PROBX_LOGY As Short = 12
Public Const SCALE_PROBX_PROBY As Short = 13
' Unit-specific scaling codes ... combine with above values using OR operator
Public Const UNITS_DEFAULT As Short = 0
Public Const UNITS_TRIPARTITE_INCHES As Short = UNITS_DEFAULT ' Velocity (Y) in inches/sec
Public Const UNITS_TRIPARTITE_FEET As Short = &H100S ' feet/sec
Public Const UNITS_TRIPARTITE_MILLIMETERS As Short = &H200S ' mm/sec
Public Const UNITS_TRIPARTITE_CENTIMETERS As Short = &H300S ' cm/sec
Public Const UNITS_TRIPARTITE_METERS As Short = &H400S ' meters/sec
Public Const UNITS_GRAINSIZE_MILLIMETERS As Short = UNITS_DEFAULT ' Grain sizes (X) in mm
Public Const UNITS_GRAINSIZE_INCHES As Short = &H100S ' inches
Public Const UNITS_POLAR_RADIANS As Short = UNITS_DEFAULT ' Rotation (X) in radians
Public Const UNITS_POLAR_DEGREES As Short = &H100S ' degrees
Public Const UNITS_USERDEFINED As Short = &H7F00S
' Data organization following DPLOT structure:
Public Const DATA_XYXY As Short = 0 ' One or more sets of X,Y data
Public Const DATA_DXY As Short = 1 ' One or more X,Y curves. Constant spacing in X and same number of points in all curves.
Public Const DATA_XYYY As Short = 2 ' One or more X,Y curves. All curves have the same X values.
Public Const DATA_3D As Short = 3 ' Z values on a rectangular grid
Public Const DATA_3DR As Short = 4 ' Random X,Y,Z values
Public Const DATA_IMAGE As Short = 5 ' Used only by DPlot - there's no way to SEND DPlot an image
Public Const DATA_1D As Short = 6 ' One or more groups of Y values.
Public Const DATA_3DS As Short = 7 ' 3D scatter plot
' Line styles:
Public Const LINESTYLE_NONE As Short = 0
Public Const LINESTYLE_SOLID As Short = 1
Public Const LINESTYLE_LONGDASH As Short = 2
Public Const LINESTYLE_DOTTED As Short = 3
Public Const LINESTYLE_DASHDOT As Short = 4
Public Const LINESTYLE_MEDDASH As Short = 5
Public Const LINESTYLE_DASHDOTDOT As Short = 6
Public Const LINESTYLE_DASHDOTDOTDOT As Short = 7
' Symbol styles
Public Const SYMBOLSTYLE_NONE As Short = 0
Public Const SYMBOLSTYLE_DOT As Short = 1
Public Const SYMBOLSTYLE_CROSS As Short = 2
Public Const SYMBOLSTYLE_ASTERISK As Short = 3
Public Const SYMBOLSTYLE_X As Short = 4
Public Const SYMBOLSTYLE_SQUARE As Short = 5
Public Const SYMBOLSTYLE_DIAMOND As Short = 6
Public Const SYMBOLSTYLE_TRIANGLE As Short = 7
Public Const SYMBOLSTYLE_OCTAGON As Short = 8
Public Const SYMBOLSTYLE_ITRIANGLE As Short = 9
Public Const SYMBOLSTYLE_HEXAGON As Short = 10
Public Const SYMBOLSTYLE_PENTAGON As Short = 11
Public Const SYMBOLSTYLE_STAR As Short = 12
Public Const SYMBOLSTYLE_FILL As Short = &H100S ' May be combined with other styles
End Class
Inside the c# app, you can declare a dplot object like this
dplotglobs.mod1.DPLOT dp = new mod1.DPLOT();
dplotglobs is the namespace of the vb plotglobals code, which you set in project properties in VB
And here is the dplot object being used in c#
dp.Initialize();
dp.Version = mod1.DPLOT_DDE_VERSION;
dp.DataFormat = mod1.DATA_XYXY;
dp.MaxCurves = 1; // Must be >= number of curves we plot
dp.MaxPoints = j + 10; // Anything >= NP will do
dp.NumCurves = 1;
dp.ScaleCode = mod1.SCALE_LINEARX_LINEARY;
dp.LegendX = 0.05F;
dp.LegendY = 0.05F;
dp.NP[0] = j - 3;
dp.LineType[0] = mod1.LINESTYLE_SOLID;
dp.Title1 = "Time series plot";
dp.Title2 = "";
dp.XAxis = "Date" + (char)0;
dp.YAxis = "Some units" + (char)0;
string cmds = "[ClearEditFlag()][DocMaximize()][NumberFormat(0,6)]";
int DocNum = mod1.DPlot_Plot(ref dp, ref x[1], ref y[1], ref cmds);
Note that we have to use mod1.DATA_XYXY rather than just XYXY, because our class is called mod1
Csharp tricks
Discovered while trying to write a simplified mplot (which calls dplotlib) in csharp.
Dplotlib.dll is an ordinary windows dll. Not a dotnet created dll.
In order to use dplotlib.dll, one needs to set up a dplot object, and some constants, and also “declare” the calls to the dplotlib dll. This text is about how you create a class library as a dotnet dll and use it to define the objects and constants required by this other dll
For other languages, an example is supplied with dplotlib and one just copies it. There is a VB.net example which includes a module, module1 in plotglobals.vb. There is no c# example.
As there is no c# example, and .net is “designed from the ground up” to allow calls between stuff in different languages one concludes that it should be possible to use the stuff in plotglobals.vb to create a thing which is useable in c#.
I tried just copying plotglobals.vb into the directory and adding it to the project.. Didn’t produce the goods.
What seems to work is converting the module into a class, as shown below, in a vb project which is opened as make a class library. Building this results in a dll. In the c# project, use menu “project/add reference” to browse to this dll and add it. Then you still have to put in a “using” statement to use the namespace of this classlibrary in your c# project.
Now we get to the tricky bit. Once you have done the above, it is possible to use the class inside the c# ide. The intellisense works and you get to see all the constants and properties and methods OK. However, when you build and run, you get a rude message about how it cannot find plotglobals, or one of its dependencies. Now this is weird, because in the ide, when you look at the references, one of the properties of the plotglobals refernce is its absolute path, and it is there OK. So why doesn’t the thing find it at execution time.
The answer is partly revealed by inspecting the “manifest” of the exe produced from c#, To see the manifest, execute
C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin>ildasm
and use the file menu in it to open the exe.
In the manifest, you can see plotglobals referred to without any path. Now, the fat book “professional c# 2005” says that when you use add reference, the target dll is copied to the output directory of the project you did the add reference in. This isn’t true. But it should be. If you manually copy the dll into the right spot, then the error about not finding it goes away.
Here is the vb plotglobals class definition. There are more clues after this
Imports System.Runtime.InteropServices
' DPlot-specific stuff
'
Public Class mod1
Public Const DPLOT_DDE_VERSION As Short = 3 ' Version 3 structure allows up to 100 data sets per plot
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi)> Public Structure DPLOT
Dim Version As Integer ' version number of this structure, should be set by caller to DPLOT_DDE_VERSION
Dim hwnd As Integer ' handle of client application window
Dim DataFormat As Integer ' XY pairs, DX and Y, etc. See DATA_ constants
Dim MaxCurves As Integer ' DataFormat Description
' DATA_XYXY Max. number of curves, <= 100
' DATA_DXY ..
' DATA_XYYY ..
' DATA_3D Number of grid cells in X direction,
' = number of data columns-1
' DATA_3DR not used
' DATA_1D Max. number of groups, <= 100
' DATA_3DS Max. number of data sets, <= 100
Dim MaxPoints As Integer ' DATA_XYXY Max. number of points/curve
' DATA_DXY ..
' DATA_XYYY ..
' DATA_3D Number of grid cells in Y direction,
' = number of data rows-1
' DATA_3DR Number of X,Y,Z triplets
' DATA_1D Max. number of points/group
' DATA_3DS Max. number of points/data set
Dim NumCurves As Integer ' Actual number of curves/groups, always 1 for
' DATA_3D or DATA_3DR
Dim ScaleCode As Integer ' scaling code for XY plots (Linear, Log, etc.)
Dim LegendX As Single ' left coord of legend, expressed as a ratio
' of plot size (0->1) (CAN be negative and/or > 1,
' but exact placement is then a bit hard to predict)
Dim LegendY As Single ' top coord of legend, again expressed as a ratio
' of plot size
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=100)> Public NP() As Integer
' Actual number of points in each curve/group. Not used for DATA_3D.
' Cannot exceed MaxPoints.
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=100)> Public LineType() As Integer ' Line types (see codes below)
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=100)> Public SymbolType() As Integer ' Symbol types (see codes below)
Dim SizeofExtraInfo As Integer
' Extra information following X,Y data. No need to
' fill in this member for DPLOTLIB calls
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=8080)> Public Legend As String
' Legend(0->79) is the caption for the legend
' Legend(n*80->n*80+79) is the caption for the n'th curve
' Ideally this would be dimensioned as Legend(0 to 100) as String*80,
' but I don't see a way to do that. Same problem exists for the Label array (next).
' Fortunately we can get around this mess with individual DPlot commands.
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=4000)> Public Label As String
' Strings displayed beside the last data point
' in a curve, 40 characters per curve
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=80)> Public Title1 As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=80)> Public Title2 As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=80)> Public Title3 As String
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=80)> Public XAxis As String ' X Axis label.
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=80)> Public YAxis As String ' Y Axis label.
Public Sub Initialize()
ReDim NP(99)
ReDim LineType(99)
ReDim SymbolType(99)
End Sub
End Structure
Public Structure DPLOT_PLOTMETRICSEX
Dim size As Integer ' size of this structure, should be filled in by the caller
Dim hll As Integer ' horizontal and
Dim vll As Integer ' vertical coordinates of the lower left corner of the plot, in pixels
Dim hur As Integer ' horizontal and
Dim vur As Integer ' vertical coordinates of the upper right corner of the plot, in pixels
Dim xlo As Single ' value of x at the left plot extent
Dim ylo As Single ' value of y at the bottom plot extent
Dim xhi As Single ' value of x at the right plot extent
Dim yhi As Single ' value of z at the top plot extent
Dim stretch_x As Single
Dim stretch_y As Single
Dim stretch_z As Single
Dim scale As Single
Dim azimuth As Single
Dim elevation As Single
End Structure
Declare Function DPlot_AddData Lib "c:\dplotx\dplotlib.dll" (ByVal DocNum As Integer, ByVal DataType As Integer, ByVal NumPts As Integer, ByVal Curve As Integer, ByRef x As Single, ByRef y As Single) As Integer
Declare Function DPlot_GetBitmap Lib "c:\dplotx\dplotlib.dll" (ByVal DocNum As Integer, ByVal cx As Integer, ByVal cy As Integer) As IntPtr
Declare Function DPlot_GetBitmapEx Lib "c:\dplotx\dplotlib.dll" (ByVal DocNum As Integer, ByVal cx As Integer, ByVal cy As Integer, ByRef DPM As DPLOT_PLOTMETRICSEX) As IntPtr
Declare Function DPlot_GetEnhMetaFile Lib "c:\dplotx\dplotlib.dll" (ByVal DocNum As Integer, ByVal cx As Single, ByVal cy As Single) As Integer
Declare Function DPlot_Plot Lib "c:\dplotx\dplotlib.dll" (ByRef d As DPLOT, ByRef x As Single, ByRef y As Single, ByVal cmds As String) As Integer
Declare Function DPlot_Plot8 Lib "c:\dplotx\dplotlib.dll" (ByRef d As DPLOT, ByRef x As Double, ByRef y As Double, ByVal cmds As String) As Integer
Declare Function DPlot_Command Lib "c:\dplotx\dplotlib.dll" (ByVal DocNum As Integer, ByVal Command_Renamed As String) As Integer
Declare Function DPlot_Request Lib "c:\dplotx\dplotlib.dll" (ByVal DocNum As Integer, ByVal Item As String, ByVal Value As String, ByRef MaxCount As Integer) As Integer
Declare Sub DPlot_SetErrorMethod Lib "c:\dplotx\dplotlib.dll" (ByVal method As Integer)
Declare Function DPlot_Start Lib "c:\dplotx\dplotlib.dll" (ByVal Minimize As Integer, ByRef WasActive As Integer) As Integer
Declare Sub DPlot_Stop Lib "c:\dplotx\dplotlib.dll" ()
' XY Scaling codes:
Public Const SCALE_LINEARX_LINEARY As Short = 1
Public Const SCALE_LINEARX_LOGY As Short = 2
Public Const SCALE_LOGX_LINEARY As Short = 3
Public Const SCALE_LOGX_LOGY As Short = 4
Public Const SCALE_TRIPARTITE As Short = 5
Public Const SCALE_LINEARX_PROBABILITY As Short = 6
Public Const SCALE_GRAINSIZE_DIST As Short = 7
Public Const SCALE_POLAR As Short = 8
Public Const SCALE_BARCHART As Short = 9
Public Const SCALE_LOGX_PROBABILITY As Short = 10
Public Const SCALE_PROBX_LINEARY As Short = 11
Public Const SCALE_PROBX_LOGY As Short = 12
Public Const SCALE_PROBX_PROBY As Short = 13
' Unit-specific scaling codes ... combine with above values using OR operator
Public Const UNITS_DEFAULT As Short = 0
Public Const UNITS_TRIPARTITE_INCHES As Short = UNITS_DEFAULT ' Velocity (Y) in inches/sec
Public Const UNITS_TRIPARTITE_FEET As Short = &H100S ' feet/sec
Public Const UNITS_TRIPARTITE_MILLIMETERS As Short = &H200S ' mm/sec
Public Const UNITS_TRIPARTITE_CENTIMETERS As Short = &H300S ' cm/sec
Public Const UNITS_TRIPARTITE_METERS As Short = &H400S ' meters/sec
Public Const UNITS_GRAINSIZE_MILLIMETERS As Short = UNITS_DEFAULT ' Grain sizes (X) in mm
Public Const UNITS_GRAINSIZE_INCHES As Short = &H100S ' inches
Public Const UNITS_POLAR_RADIANS As Short = UNITS_DEFAULT ' Rotation (X) in radians
Public Const UNITS_POLAR_DEGREES As Short = &H100S ' degrees
Public Const UNITS_USERDEFINED As Short = &H7F00S
' Data organization following DPLOT structure:
Public Const DATA_XYXY As Short = 0 ' One or more sets of X,Y data
Public Const DATA_DXY As Short = 1 ' One or more X,Y curves. Constant spacing in X and same number of points in all curves.
Public Const DATA_XYYY As Short = 2 ' One or more X,Y curves. All curves have the same X values.
Public Const DATA_3D As Short = 3 ' Z values on a rectangular grid
Public Const DATA_3DR As Short = 4 ' Random X,Y,Z values
Public Const DATA_IMAGE As Short = 5 ' Used only by DPlot - there's no way to SEND DPlot an image
Public Const DATA_1D As Short = 6 ' One or more groups of Y values.
Public Const DATA_3DS As Short = 7 ' 3D scatter plot
' Line styles:
Public Const LINESTYLE_NONE As Short = 0
Public Const LINESTYLE_SOLID As Short = 1
Public Const LINESTYLE_LONGDASH As Short = 2
Public Const LINESTYLE_DOTTED As Short = 3
Public Const LINESTYLE_DASHDOT As Short = 4
Public Const LINESTYLE_MEDDASH As Short = 5
Public Const LINESTYLE_DASHDOTDOT As Short = 6
Public Const LINESTYLE_DASHDOTDOTDOT As Short = 7
' Symbol styles
Public Const SYMBOLSTYLE_NONE As Short = 0
Public Const SYMBOLSTYLE_DOT As Short = 1
Public Const SYMBOLSTYLE_CROSS As Short = 2
Public Const SYMBOLSTYLE_ASTERISK As Short = 3
Public Const SYMBOLSTYLE_X As Short = 4
Public Const SYMBOLSTYLE_SQUARE As Short = 5
Public Const SYMBOLSTYLE_DIAMOND As Short = 6
Public Const SYMBOLSTYLE_TRIANGLE As Short = 7
Public Const SYMBOLSTYLE_OCTAGON As Short = 8
Public Const SYMBOLSTYLE_ITRIANGLE As Short = 9
Public Const SYMBOLSTYLE_HEXAGON As Short = 10
Public Const SYMBOLSTYLE_PENTAGON As Short = 11
Public Const SYMBOLSTYLE_STAR As Short = 12
Public Const SYMBOLSTYLE_FILL As Short = &H100S ' May be combined with other styles
End Class
Inside the c# app, you can declare a dplot object like this
dplotglobs.mod1.DPLOT dp = new mod1.DPLOT();
dplotglobs is the namespace of the vb plotglobals code, which you set in project properties in VB
And here is the dplot object being used in c#
dp.Initialize();
dp.Version = mod1.DPLOT_DDE_VERSION;
dp.DataFormat = mod1.DATA_XYXY;
dp.MaxCurves = 1; // Must be >= number of curves we plot
dp.MaxPoints = j + 10; // Anything >= NP will do
dp.NumCurves = 1;
dp.ScaleCode = mod1.SCALE_LINEARX_LINEARY;
dp.LegendX = 0.05F;
dp.LegendY = 0.05F;
dp.NP[0] = j - 3;
dp.LineType[0] = mod1.LINESTYLE_SOLID;
dp.Title1 = "Time series plot";
dp.Title2 = "";
dp.XAxis = "Date" + (char)0;
dp.YAxis = "Some units" + (char)0;
string cmds = "[ClearEditFlag()][DocMaximize()][NumberFormat(0,6)]";
int DocNum = mod1.DPlot_Plot(ref dp, ref x[1], ref y[1], ref cmds);
Note that we have to use mod1.DATA_XYXY rather than just XYXY, because our class is called mod1
- DPlotAdmin
- Posts: 2312
- Joined: Tue Jun 24, 2003 9:34 pm
- Location: Vicksburg, Mississippi
- Contact:
You're hired
Thanks very much for the detailed post. I still don't have C# but should have it in my hands soon. I'm sure your work will come in handy for myself and others.
Thanks very much for the detailed post. I still don't have C# but should have it in my hands soon. I'm sure your work will come in handy for myself and others.
Visualize Your Data
support@dplot.com
support@dplot.com
-
- Posts: 2
- Joined: Fri Dec 16, 2005 2:59 pm
Visual C# 2005
Your prescription works just fine, thanks.
In my earlier post, I said
"when you use add reference, the target dll is copied to the output directory of the project you did the add reference in. This isn’t true. But it should be. If you manually copy the dll into the right spot, then the error about not finding it goes away. "
In fact the copy will occur on a normal system if you have copy local set to True in the properties of the reference (highlight the reference to see its properties in the properties window).
It didn't happen on my system because I had a user environement variable OUTDIR set to some other directory, and in fact all of the final assembly output of anything.net 2005 was going into this directory, including the referenced dlls. OUTDIR seems to override anything you specify in your project.
This seems to be an undocumented "feature".
"when you use add reference, the target dll is copied to the output directory of the project you did the add reference in. This isn’t true. But it should be. If you manually copy the dll into the right spot, then the error about not finding it goes away. "
In fact the copy will occur on a normal system if you have copy local set to True in the properties of the reference (highlight the reference to see its properties in the properties window).
It didn't happen on my system because I had a user environement variable OUTDIR set to some other directory, and in fact all of the final assembly output of anything.net 2005 was going into this directory, including the referenced dlls. OUTDIR seems to override anything you specify in your project.
This seems to be an undocumented "feature".