Hello all,
I am building an app that requires charting capabilities. Due to budgetary constraints, I cannot purchase a charting tool, and so must rely on free tools. I have tried the MSChart component, but I do not want to use a COM object if I can help it (plus, it sucks!). I have tried various free or "lite" tools, and settled tentatively on SoftwareFX's ChartFX Lite.
OK, so here are my questions:
1) Has anybody ever used ChartFX Lite before? I am able to get the charts built and displayed, but I am having trouble with printing. I can print using the following code:
If I use the CaptureScreen and BltBlt printing method, the PrintDialog box that is displayed is captured along with the chart image and printed out on top of the image. Not good.
If I comment out the CaptureScreen and e.Graphics.DrawImage calls, and use the ChartFX object's Paint method (the commented out line in the PrintDocument1_PrintPage sub), the chart is printed, but with several errors (e.g., too small, line markers not printed, etc.). Does anybody have any experience with this?
2) My second question is, does anybody have any suggestions as to other free or very cheap charting tools for VB .NET?
Sorry for the long-winded post.
Thanks,
JEB
I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson
I am building an app that requires charting capabilities. Due to budgetary constraints, I cannot purchase a charting tool, and so must rely on free tools. I have tried the MSChart component, but I do not want to use a COM object if I can help it (plus, it sucks!). I have tried various free or "lite" tools, and settled tentatively on SoftwareFX's ChartFX Lite.
OK, so here are my questions:
1) Has anybody ever used ChartFX Lite before? I am able to get the charts built and displayed, but I am having trouble with printing. I can print using the following code:
Code:
Private Declare Function BitBlt Lib "gdi32.dll" Alias "BitBlt" (ByVal _
hdcDest As IntPtr, ByVal nXDest As Integer, ByVal nYDest As _
Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal _
hdcSrc As IntPtr, ByVal nXSrc As Integer, ByVal nYSrc As Integer, _
ByVal dwRop As System.Int32) As Long
Dim memoryImage As Bitmap
Private WithEvents PrintDocument1 As Printing.PrintDocument
.....
'in a button's click event:
PrintDocument1 = New Printing.PrintDocument
PrintDialog1.Document = PrintDocument1
PrintDialog1.ShowDialog()
CaptureScreen()
PrintDocument1.Print()
PrintDocument1.Dispose()
PrintDocument1 = Nothing
.........
Private Sub CaptureScreen()
Dim mygraphics As Graphics = Module1.AgyExpCharts(CurrentPage).CreateGraphics()
Dim s As Size = Module1.AgyExpCharts(CurrentPage).Size
memoryImage = New Bitmap(s.Width, s.Height, mygraphics)
Dim memoryGraphics As Graphics = Graphics.FromImage(memoryImage)
Dim dc1 As IntPtr = mygraphics.GetHdc
Dim dc2 As IntPtr = memoryGraphics.GetHdc
BitBlt(dc2, 0, 0, Module1.AgyExpCharts(CurrentPage).Width, _
Module1.AgyExpCharts(CurrentPage).Height, dc1, 0, 0, 13369376)
mygraphics.ReleaseHdc(dc1)
memoryGraphics.ReleaseHdc(dc2)
End Sub
.....
Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, _
ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles _
PrintDocument1.PrintPage
e.Graphics.DrawImage(memoryImage, 0, 0)
[green]'Module1.AgyExpCharts(CurrentPage - 1).Paint(e.Graphics, New Rectangle(0, 0, e.Graphics.ClipBounds.Width, e.Graphics.ClipBounds.Height / 2), SoftwareFX.ChartFX.Lite.Base.PaintFlags.Print)[/green]
End Sub
If I use the CaptureScreen and BltBlt printing method, the PrintDialog box that is displayed is captured along with the chart image and printed out on top of the image. Not good.
If I comment out the CaptureScreen and e.Graphics.DrawImage calls, and use the ChartFX object's Paint method (the commented out line in the PrintDocument1_PrintPage sub), the chart is printed, but with several errors (e.g., too small, line markers not printed, etc.). Does anybody have any experience with this?
2) My second question is, does anybody have any suggestions as to other free or very cheap charting tools for VB .NET?
Sorry for the long-winded post.
Thanks,
JEB
I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson