Results 1 to 4 of 4

Thread: [RESOLVED] Copying a chart series to another

  1. #1

    Thread Starter
    Hyperactive Member pourkascheff's Avatar
    Join Date
    Apr 2020
    Location
    LocalHost
    Posts
    384

    Resolved [RESOLVED] Copying a chart series to another

    Consider you have an array of charts, filled with one series of x,y points and you want to clone a specific one in another large chart (in another form) to perform a sort of magnification operation for selected member of that array.

    What is the proper approach to achieve such thing?

    How about a for loop to add points from here to another?
    Code:
    For i=0 to Me.Chart1.Series(0).Points.All then
                Form2.Chart1.Series(0).add = Me.Chart1.Series(0).Points(i)
            Next
    Codes are wrong. Only for understanding

    Or is there a property/method thing to shortcut looping?
    Code:
    Form2.Chart1 = Me.Chart1
    Codes are wrong. Only for understanding

    Don't know either ways. I just assumed they're possible ways.
    Thanks in advance/.
    Last edited by pourkascheff; Oct 4th, 2023 at 04:41 AM. Reason: minor syntax

  2. #2
    Fanatic Member Delaney's Avatar
    Join Date
    Nov 2019
    Location
    Paris, France
    Posts
    846

    Re: Copying a chart series to another

    you have to do it the hard way : transfer the serie in a list

    use a list of tuple or use a list of pointf or create a structure named Points (if you want to use double)
    https://docs.microsoft.com/fr-fr/dot...a-types/tuples
    https://www.dotnetperls.com/tuple-vbnet
    https://docs.microsoft.com/fr-fr/dot...f?view=net-6.0
    The best friend of any programmer is a search engine
    "Don't wish it was easier, wish you were better. Don't wish for less problems, wish for more skills. Don't wish for less challenges, wish for more wisdom" (J. Rohn)
    “They did not know it was impossible so they did it” (Mark Twain)

  3. #3

    Thread Starter
    Hyperactive Member pourkascheff's Avatar
    Join Date
    Apr 2020
    Location
    LocalHost
    Posts
    384

    Re: Copying a chart series to another

    Quote Originally Posted by Delaney View Post
    you have to do it the hard way : transfer the serie in a list
    Hello again after a long absence, some lads here in another thread, asked for a same thing in 2011 but no results were also achieved.

    Does chart control have a sort of conventional "datasource" thing to make it equal to another chart in one line code? The point is the latter one (Let's call it the follower) does not need to be real time as the one which are located next to lots of other charts. Only all xy points from the beginning to the moment you "enlarge" it by some sort of double click action.

  4. #4

    Thread Starter
    Hyperactive Member pourkascheff's Avatar
    Join Date
    Apr 2020
    Location
    LocalHost
    Posts
    384

    Re: Copying a chart series to another

    "Eureka". That was easy and in a loop behavior as I mentioned in starting topic, but since I used to show things more complicated than they need to be, I wrote down the idea in DevExpress 3rd party controls:
    Mother form code:
    Code:
        Private Sub XtraForm1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            For i = 0 To 10 'SOME RANDOM POINTS IN MOTHER FORM
                ChartControlMain.Series(0).Points.AddPoint(i.ToString, Rnd())
            Next
        End Sub
        Private Sub ChartControlMain_Click(sender As Object, e As EventArgs) Handles ChartControlMain.Click
            Dim newform As New CHILDFORM
            For i = 0 To ChartControlMain.Series(0).Points.Count - 1
                newform.ChartControlEnlarge.Series(0).Points.Add(ChartControlMain.Series(0).Points(i))
            Next
            newform.ShowDialog()
        End Sub
    case closed. peace/

Tags for this Thread

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