DPlot and Programs

Q&A for Visual Basic, Visual Basic .NET, and PowerBasic developers using DPlot
Blueb
Posts: 4
Joined: Tue Jul 08, 2003 9:15 am
Location: Vancouver Island, Canada

DPlot and Programs

Post by Blueb »

This isn't specific to VB (in fact I use PureBasic).....

I have just purchased DPlot and have a few questions.

If I create an EXE and would like to display a DPlot chart (without the menu choices and buttons) in my program, is it possible to add only the required DLL's with my exe?

In other words, only what's necessary to display a chart without having the user install the 'Viewer Install Program'?

Regards,
--Bob
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

Bob,
There are no "plotting DLL's" to use. Your best bet is to use DPlot Jr along with DPLOTLIB.DLL. You can launch DPlot Jr in a hidden state and have your program send data to be plotted and retrieve a bitmap of that plot. There's a fair example of this in the DPlot Jr distribution along with the source code - see btest2.exe in particular.

I'm not familiar with PureBasic and it's possible that there will be issues with the API to the DPLOTLIB routines. If you download DPlot Jr and have trouble getting the DPLOTLIB routines to work, let me know and I'll look into obtaining PureBasic.
Blueb
Posts: 4
Joined: Tue Jul 08, 2003 9:15 am
Location: Vancouver Island, Canada

Post by Blueb »

Ok, Thanks.

It'll take a few days to convert the VB include file over to Pure, then I'll try to use with DPlot Jr.

Bob
guibson
Posts: 54
Joined: Wed Mar 10, 2004 9:20 pm

TextPointLabel command

Post by guibson »

Hi,

I try to use de TextPointLabel command but the documentation is a little bit confuse for me. Can you show me a synthaxe exemple for this command? I'm using vb but the exemple can be just the string itself.
________
GEORGE W. WALKER
Last edited by guibson on Fri Feb 11, 2011 10:47 pm, edited 1 time in total.
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

Sure. Here's a simple case - you want to label the 32nd point in the 2nd curve with the label "Howdy", with the label offset from the data point 5 X units to the left and 5 Y units up.

In a macro you'd use:

Code: Select all

[SelectCurve(2)]
[TextPointLabel(32,-5,5,1,1,8,"Howdy")]
One thing many VB users get confused about is that character strings in DPlot commands are delineated with "double quotation marks", but so is the command itself. If you do this in VB:

Code: Select all

ret=DPlot_Command(DocNum,"[SelectCurve(2)][TextPointLabel(32,-5,5,1,1,8,"Howdy")]")
you'll get a syntax error. Instead you have to break the command up and add quotation marks, as in:

Code: Select all

ret=DPlot_Command(DocNum,"[SelectCurve(2)][TextPointLabel(32,-5,5,1,1,8," & chr$(34) & "Howdy" & chr$(34) & ")]")
Edit: The above shows my inexperience with VB. This is equivalent and much easier:

Code: Select all

ret=DPlot_Command(DocNum,"[SelectCurve(2)][TextPointLabel(32,-5,5,1,1,8,""Howdy"")]")
In both cases the 6th parameter ( the 8 ) tells DPlot that the X and Y coordinates are relative to the data point's coordinates, rather than an absolute position.

If instead you had used

Code: Select all

ret=DPlot_Command(DocNum,"[SelectCurve(2)][TextPointLabel(32,-5,5,1,1,0," & chr$(34) & "Howdy" & chr$(34) & ")]")
or

Code: Select all

ret=DPlot_Command(DocNum,"[SelectCurve(2)][TextPointLabel(32,-5,5,1,1," & chr$(34) & "Howdy" & chr$(34) & ")]")
(Options omitted), then the label would be placed at X=-5, Y=5. Note that no part of a label will be drawn if the point determined by X and Y is off of the plot, even though the referenced data point may be visible.

If instead of "Howdy" we want to label the point with it's amplitude, use

Code: Select all

ret=DPlot_Command(DocNum,"[SelectCurve(2)][TextPointLabel(32,-5,5,1,1,8," & chr$(34) & "$Y" & chr$(34) & ")]")
which is also what you get if the label is omitted:

Code: Select all

ret=DPlot_Command(DocNum,"[SelectCurve(2)][TextPointLabel(32,-5,5,1,1,8," & chr$(34) & chr$(34) & ")]")
Please let me know if this doesn't clear it up for you.
Last edited by DPlotAdmin on Thu May 12, 2005 5:36 pm, edited 1 time in total.
Visualize Your Data
support@dplot.com
guibson
Posts: 54
Joined: Wed Mar 10, 2004 9:20 pm

RE: TextPointLabel command

Post by guibson »

Thank you for response. It's nice when we use a package and there is help! I now understand the command and check the help file because there is an error for TextPointLabel command...
I can now see the label but is there a manner to control the arrow associated?
________
Honda cb250
Last edited by guibson on Fri Feb 11, 2011 10:47 pm, edited 1 time in total.
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

What error do you mean? Perhaps I've overlooked something, but it all looks correct to me.

There's no way to specify the arrow, no. Perhaps next time.
Visualize Your Data
support@dplot.com
guibson
Posts: 54
Joined: Wed Mar 10, 2004 9:20 pm

ContourCustomColors command

Post by guibson »

Hi,

Can you show me an exemple using the ContourCustomColors method? I'm with vb6.

Thanks a lot!
________
Buy Vapormatic
Last edited by guibson on Fri Feb 11, 2011 10:47 pm, edited 1 time in total.
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

Make sure you use [ContourColorScheme(2)] in conjunction with ContourCustomColors or you won't get the expected results. Other than that it's fairly straightforward. You can define up to 16 colors, and the color palette that DPlot generates will be interpolated from those colors. If you specify the same number of contour levels as the number of colors, then the colors used in the plot will be exactly the colors specified with ContourCustomColors. Say you want low values to be blue (255*65536=16711680), high values to be red (255), with green in the middle (255*256=65280). So you'd use:

[ContourColorScheme(2)][ContourCustomColors(16711680,65280,255)]

If you set the number of contour levels to 3, you'll get blue, green, and red lines or bands. If instead you use 5 levels then you'll see, from low to high, (r,g,b)=(0,0,255), (0,127,127),(0,255,0),(127,127,0),(255,0,0)
Visualize Your Data
support@dplot.com
guibson
Posts: 54
Joined: Wed Mar 10, 2004 9:20 pm

Re : ContourCustomColors command

Post by guibson »

Thanks a lot, it runs very, very well!!!
________
Ford gyron history
Last edited by guibson on Fri Feb 11, 2011 10:47 pm, edited 1 time in total.
guibson
Posts: 54
Joined: Wed Mar 10, 2004 9:20 pm

Symbol on a 3D Plot

Post by guibson »

Hi,

Is it possible to put one symbol for a particular point on a 3D Plot with a command?

Thanks for your great job!
________
NEVADA MARIJUANA DISPENSARY
Last edited by guibson on Fri Feb 11, 2011 10:47 pm, edited 1 time in total.
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

No, sorry. A couple of other users have asked for the ability to plot symbols at all data points, and that feature will definitely be added in the near future. I'll also be adding the "point label" feature to 3D plots, but I haven't considered adding symbols at specific points. I'll put this one in the "give it some thought" list.
Visualize Your Data
support@dplot.com
guibson
Posts: 54
Joined: Wed Mar 10, 2004 9:20 pm

Superpose a circle on a bitmap from DPlot Jr.

Post by guibson »

Hi,

We can? t put a symbol on a 3D plot. So, I want to put a circle on a bitmap received from Dplot. The exemple you use give us the value of X and Y relative to the cursor position on the plot. I want to do the opposite. I know the X and Y values and want to translate it to X and Y screen coordinates. Is it possible to do it with the DPLOT_PLOTMETRICS structure?

Thanks and have a good day.
________
Honda cbr900rr history
Last edited by guibson on Fri Feb 11, 2011 10:47 pm, edited 1 time in total.
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

Sorry, but for 3D plots that information isn't of much use. I could add a command to return X and Y display coordinates for a given X,Y,Z... trouble is in determining what device we're asking the question about. If you're simply producing a plot in DPlot then it is simple, but I don't think that's what you're interested in. I think it might be better to expand DPLOT_PLOTMETRICS to include scaling information for 3D plots, and your program could then figure out the placement on its own.
Visualize Your Data
support@dplot.com
guibson
Posts: 54
Joined: Wed Mar 10, 2004 9:20 pm

Image scale

Post by guibson »

Hi,

I have a problem with the plot scale. 2 plots with the same scale don't look the same. The only difference is the data. How can fix the plot? I send 2 exemples.

First plot.
Image

Second plot with the same scale.
Image[/img]
________
Dodge charger (1999 concept) history
Last edited by guibson on Fri Feb 11, 2011 10:47 pm, edited 1 time in total.
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

Check a couple of settings:

Select Options>Contour Options. Check the settings for the X and Y scale factors (middle of the dialog at the bottom).

Select Options>Extents/Tick Marks/Size. If "Specify plot size" is checked, make sure you use the same values on both plots.

If this only happens on saved or copied bitmaps/metafiles rather than the display, check the settings under Edit>Copy>Dimensions.
Visualize Your Data
support@dplot.com
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Getting pixel coordinates for an input X,Y,Z from a 3D plot

Post by DPlotAdmin »

New DPLOTLIB.DLL (download http://www.dplot.com/lib/dplotlib.zip) will do what you want. This change requires DPlot 1.9.3.8 or later. A VB example using this new feature is available at http://www.dplot.com/lib/btest7.zip.

There is currently no documentation other than what is found in the VB source, but you should be able to follow that easily. One problem we haven't mentioned: there's no way to determine from VB whether the point in question is visible or not. The VB example will draw a circle at the correct location on the screen, but that point on the plot may be obscured by other portions of the plot.
Visualize Your Data
support@dplot.com
guibson
Posts: 54
Joined: Wed Mar 10, 2004 9:20 pm

Re : Getting pixel coordinates for an input X,Y,Z from a 3D

Post by guibson »

It runs well but if we print it, there is no point! Is it possible to plot the point directly in DPlot?

Thanks for your great job!
________
Ferrari 312Pb
Last edited by guibson on Fri Feb 11, 2011 10:47 pm, edited 1 time in total.
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

Print it from DPlot? No, there wouldn't be a point since the point is only drawn in the VB example. You can of course print the bitmap in VB, but the resolution won't be all that good.

Adding symbols to 3D plots in DPlot is on the to-do list, but it will be a while before this is done.
Visualize Your Data
support@dplot.com
guibson
Posts: 54
Joined: Wed Mar 10, 2004 9:20 pm

[DeleteThinTriangles(20)]

Post by guibson »

Hi,

I used the last version of DPlot and when I send the command [DeleteThinTriangles(20)], I received this message : Error processing this command "[DeleteThinTriangles(20)]" .
But when I used the command with th edit menu in DPlot, It works. Here is an exemple of my code :

Code: Select all

Ret = DPlot_Command(DocNum, "[DeleteThinTriangles(20)]")
Thanks and have a good day!
________
Plymouth Arrow History
Last edited by guibson on Fri Feb 11, 2011 10:47 pm, edited 1 time in total.
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

Check the version number on the About box. If it isn't 1.9.3.9, you're not using the beta release that added this command.
Visualize Your Data
support@dplot.com
guibson
Posts: 54
Joined: Wed Mar 10, 2004 9:20 pm

Re

Post by guibson »

I was with the wrong version. Now it's work. Thankyou.

Now, I try to print and send the command

Code: Select all

Ret = DPlot_Command(DocNum, "[FilePrint()]")
and nothing append. I verified the DocNum and it is ok. I verified the print spooler and nothing is send to. What should I check?
________
Herbal vaporizer forum
Last edited by guibson on Fri Feb 11, 2011 10:47 pm, edited 1 time in total.
guibson
Posts: 54
Joined: Wed Mar 10, 2004 9:20 pm

Re

Post by guibson »

I was with the wrong version. Now it's work. Thankyou.

Now, I try to print and send the command

Code: Select all

Ret = DPlot_Command(DocNum, "[FilePrint()]")
and nothing append. I verified the DocNum and it is ok. I verified the print spooler and nothing is send to. What should I check?
________
Chrysler Pl Platform Specifications
Last edited by guibson on Fri Feb 11, 2011 10:47 pm, edited 1 time in total.
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

[FilePrint()] should work if you have a default printer. Another user mentioned a few days ago that this doesn't work correctly for network printers, though I haven't had a chance to confirm this and don't really understand why that wouldn't work. Please let me know what sort of printer setup you have.
Visualize Your Data
support@dplot.com
guibson
Posts: 54
Joined: Wed Mar 10, 2004 9:20 pm

Printing issue

Post by guibson »

Effectively, it does not print on a network printer. I can print if I capture a LPT port to a network printer. If I use the command like this

Code: Select all

Ret = DPlot_Command(DocNum, "[FilePrint(1)]")
there is not printer dialog and no print out. If I use the command like this

Code: Select all

Ret = DPlot_Command(DocNum, "[FilePrint()]")
There is no printer dialog like expected and there is a print out.

Little bit tricky :-)
________
CHRYSLER F PLATFORM
Last edited by guibson on Fri Feb 11, 2011 10:47 pm, edited 1 time in total.
guibson
Posts: 54
Joined: Wed Mar 10, 2004 9:20 pm

Printing issue

Post by guibson »

Effectively, it does not print on a network printer. I can print if I capture a LPT port to a network printer. If I use the command like this

Code: Select all

Ret = DPlot_Command(DocNum, "[FilePrint(1)]")
there is not printer dialog and no print out. If I use the command like this

Code: Select all

Ret = DPlot_Command(DocNum, "[FilePrint()]")
There is no printer dialog like expected and there is a print out.

Little bit tricky :-)
________
Jaguar xjr-15
Last edited by guibson on Fri Feb 11, 2011 10:48 pm, edited 1 time in total.
guibson
Posts: 54
Joined: Wed Mar 10, 2004 9:20 pm

Printing issue (suite)

Post by guibson »

Hi,

If we use the FilePrint command to print a 3D graph, it can take an hour for the print out! The file in the spool is 133MB! If we use the printing solution with a metafile, DPlot return a null value with the DPlot_GetEnhMetaFile() function. How can I print a 3D graph?

Thanks for your patience... :wink:
________
STOCKS TO BUY NOW
Last edited by guibson on Fri Feb 11, 2011 10:48 pm, edited 1 time in total.
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

If we use the FilePrint command to print a 3D graph, it can take an hour for the print out! The file in the spool is 133MB!
Just to make you feel better, if you could print a metafile of a 3D plot the spool file would be much, much bigger :-). [edit: actually the spool file would be about the same size either way. The metafile would be enormous, though) There's no mistake. Though I've never waited more than 10 minutes or so, 3D files are huge relative to XY plots. If you can do w/o the resolution, use lower print quality (lower resolution) settings.
Last edited by DPlotAdmin on Wed Apr 07, 2004 1:28 pm, edited 1 time in total.
Visualize Your Data
support@dplot.com
guibson
Posts: 54
Joined: Wed Mar 10, 2004 9:20 pm

Print solution

Post by guibson »

Hi, I solve the printing problem for 3D graph. The solution is not perfect because it print a bitmap but it works.

With the pointer to a bitmap received by the DPlot_GetBitmapEx function, you send this pointer to the following function :

Code: Select all

'Global declaration
Private Declare Function OleCreatePictureIndirect Lib "olepro32.dll" (PicDesc As PicBmp, RefIID As GUID, ByVal fPictureOwnsHandle As Long, IPic As IPicture) As Long

Private Type GUID
    Data1 As Long
    Data2 As Integer
    Data3 As Integer
    Data4(7) As Byte
End Type

Private Type PicBmp
    Size As Long
    Type As Long
    hBmp As Long
    hPal As Long
    Reserved As Long
End Type

'The function
Function CreateBitmapPicture(ByVal hBmp As Long, ByVal hPal As Long) As Picture
    Dim R As Long, Pic As PicBmp, IPic As IPicture, IID_IDispatch As GUID

    'Fill GUID info
    With IID_IDispatch
        .Data1 = &H20400
        .Data4(0) = &HC0
        .Data4(7) = &H46
    End With

    'Fill picture info
    With Pic
        .Size = Len(Pic) ' Length of structure
        .Type = vbPicTypeBitmap ' Type of Picture (bitmap)
        .hBmp = hBmp ' Handle to bitmap
        .hPal = hPal ' Handle to palette (may be null)
    End With

    'Create the picture
    R = OleCreatePictureIndirect(Pic, IID_IDispatch, 1, IPic)

    'Return the new picture
    Set CreateBitmapPicture = IPic
End Function
You have to assign the picture to a picturebox like that :

Code: Select all

Picture1.Picture = CreateBitmapPicture(hBitmap, 0)
'You print the picture with the following command
Printer.PaintPicture Picture1.Picture, 0, 0
Now you take a break and drink a cup of coffee :D
________
AXELA
Last edited by guibson on Fri Feb 11, 2011 10:48 pm, edited 1 time in total.
User avatar
DPlotAdmin
Posts: 2312
Joined: Tue Jun 24, 2003 9:34 pm
Location: Vicksburg, Mississippi
Contact:

Post by DPlotAdmin »

Effectively, it does not print on a network printer. I can print if I capture a LPT port to a network printer. If I use the command like this Code:
Ret = DPlot_Command(DocNum, "[FilePrint(1)]")
there is not printer dialog and no print out. If I use the command like thisCode:
Ret = DPlot_Command(DocNum, "[FilePrint()]")
There is no printer dialog like expected and there is a print out.
FilePrint(1) should now be fixed in the beta version just uploaded. You can get it here: http://www.dplot.com/beta/dplotbeta.exe (link changed to normal download). Please let me know if this fix does not work... but I'm reasonably certain it will.
Last edited by DPlotAdmin on Fri Apr 28, 2006 10:16 pm, edited 1 time in total.
Visualize Your Data
support@dplot.com
Post Reply