Results 1 to 4 of 4

Thread: Copy a Chart

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2011
    Posts
    53

    Question Copy a Chart

    Hello

    I would like to copy a chart to another form. I have a MainForm which displays several charts. However I have another form which I would like to copy some of the graphs from MainForm to this new form (GraphCompare) so that the charts can be compared easily by the user. I am unsure on how to do the actual copying part.

    so far I have this:
    Code:
            Dim Chart56 As New Chart
            Chart56 = Chart1
            GraphCompare.Panel1.Controls.Add(Chart56)
            GraphCompare.Show()
    Cheers
    TKP

  2. #2
    Frenzied Member
    Join Date
    Feb 2008
    Location
    Texas
    Posts
    1,288

    Re: Copy a Chart

    You could add a FlowLayoutPanel to your form that you want to send them to and just initialize it with one and have a AddChart() sub to keep adding more.

    vb Code:
    1. Dim chartviewer as new ChartViewerForm(me.Chart1) 'or whatever your for name is, same for the chart.
    2. chartviewer.Show
    3.  
    4. if chartviewer.visible then
    5.  
    6.    chartviewer.addchart(me.chart2)
    7.    chartviewer.addchart(me.chart3)
    8.  
    9. end if

    ChartViewer Class:

    vb Code:
    1. public class chartviewer
    2.  
    3.  public sub new(c as chart)
    4.  
    5.     me.flowlayoutpanel1.controls.add(c)
    6.  
    7.  end sub
    8.  
    9.  public sub addchart(c as chart)
    10.  
    11.    me.flowlayoutpanel1.controls.add(c)
    12.  
    13.  end sub
    14.  
    15. end class

    Something along those lines,

    Justin
    You down with OOP? Yeah you know me!
    MCAD and MCMICKEYMOUSE (vb.net)

    ----

    If it even kinda helps... rate it : )

    Edit a Multi-page .tif file and save.

  3. #3
    Hyperactive Member pourkascheff's Avatar
    Join Date
    Apr 2020
    Location
    LocalHost
    Posts
    384

    Re: Copy a Chart

    May dusts be removed from this thread. My approach achieved an answer here if you still have any troubles implementing this idea. If you don't, we glad to take a look to your idea. Don't forget to mark this topic as resolved. peace/

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,423

    Re: Copy a Chart

    Quote Originally Posted by pourkascheff View Post
    May dusts be removed from this thread. My approach achieved an answer here if you still have any troubles implementing this idea. If you don't, we glad to take a look to your idea. Don't forget to mark this topic as resolved. peace/
    If they haven’t found a working solution in 12 years, they’ve probably abandoned their project…

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width