Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27120

VS 2010 Help - print chart on multiple pages

$
0
0
I need help - I am able to create a graph using chart onto a form from a text file with about 7 million lines.

When I print this graph I only get what I see on the form - how can I print the whole graph across multiple pages?
Please see my code below.

Code:

Private Sub plot_graph()


        Dim complete() As String
        Dim textline As String
       
        Dim objReader As New System.IO.StreamReader(temp & "\temp_log.txt")

        Chart1.Series("Series1").ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.FastLine

        Do While objReader.Peek() <> -1

            textline = Nothing
            complete = Nothing
            textline = textline & objReader.ReadLine() & vbNewLine
            complete = textline.Split(",")

            Chart1.Series("Series1").Points.AddXY(complete(0), complete(1))

        Loop
        Chart1.ChartAreas(0).AxisX.Interval = 200
        Chart1.ChartAreas(0).AxisX.ScaleView.Size = 1500
        objReader.Close()

        My.Computer.FileSystem.DeleteDirectory(tempdir & "\franko_rocks", FileIO.DeleteDirectoryOption.DeleteAllContents)


    End Sub



   



    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

 
        PrintDialog1.Document = PrintDocument1
        PageSetupDialog1.Document = PrintDocument1
        If PageSetupDialog1.ShowDialog() = DialogResult.OK Then

            If PrintDialog1.ShowDialog() = DialogResult.OK Then
                PrintDocument1.Print()

            End If
        ElseIf PageSetupDialog1.ShowDialog() = DialogResult.Cancel Then
            Return
        End If


    End Sub

    Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage

        Dim printFont As New System.Drawing.Font("Ariel", 10)

        Dim myrec As New System.Drawing.Rectangle(10, 30, 1200, 500)

        Chart1.Printing.PrintPaint(e.Graphics, myrec)

    End Sub


Viewing all articles
Browse latest Browse all 27120

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>