Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1013431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:06:03+00:00 2026-05-16T10:06:03+00:00

For my project, I need to add and update real-time data to my dual

  • 0

For my project, I need to add and update real-time data to my dual y-axis graph. The Y and Y2 values share the same X value, and I created it already. Now I have a function that adds the new point pairs to the curve lists.

Here is my problem: My Y and Y2 values are always added to the curve list of the first curve. How can I get the Y2 value added to the second curve list in my graph?

Here is my function code:

    private void AddDataToGraph(ZedGraphControl zg1, XDate xValue, double yValue1, double yValue2)
    {
        // Make sure that the curvelist has at least one curve.
        if (zg1.GraphPane.CurveList.Count <= 0)
            return;

        // Get the first CurveItem in the graph.
        LineItem curve = zg1.GraphPane.CurveList[0] as LineItem;

        if (curve == null)
            return;

        // Get the PointPairList.
        IPointListEdit list = curve.Points as IPointListEdit;
        IPointListEdit list2 = curve.Points as IPointListEdit;

        // If this is null, it means the reference at curve.Points does not
        // support IPointListEdit, so we won't be able to modify it.
        if (list == null || list2 == null)
            return;

        // Add new data points to the graph.
        list.Add(xValue, yValue1);
        list2.Add(xValue, yValue2);

        // Force redraw.
        zg1.Invalidate();
    }

How can he Y2 values be added to the 2nd curve list?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T10:06:04+00:00Added an answer on May 16, 2026 at 10:06 am

    Found a possible solution myself. Here are my code changes:

    private void AddDataToGraph(ZedGraphControl zg1, XDate xValue, double yValue1, double yValue2)
        {
            // Make sure that the curvelist has at least one curve
            if (zg1.GraphPane.CurveList.Count <= 0)
                return;
    
            // Get the first CurveItem in the graph
            LineItem curve = zg1.GraphPane.CurveList[0] as LineItem;
            LineItem curve2 = zg1.GraphPane.CurveList[1] as LineItem;
    
            if (curve == null || curve2 == null)
                return;
    
            // Get the PointPairList
            IPointListEdit list = curve.Points as IPointListEdit;
            IPointListEdit list2 = curve2.Points as IPointListEdit;
            // If this is null, it means the reference at curve.Points does not
            // support IPointListEdit, so we won't be able to modify it
            if (list == null || list2 == null)
                return;
    
            // add new data points to the graph
            list.Add(xValue, yValue1);
            list2.Add(xValue, yValue2);
    
            // force redraw
            zg1.Invalidate();
        }
    

    The important thing is to use the index in the “CurveList[i]”. So [0] is my curve with the Y values and [1] is my curve with the Y2 values, and so on.

    I hope this helps anybody who has the same or similar problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Need to add two same name .csproj class libraries in my solution.Have two project
My android app project need to add a new function of saving the click
I need to add CRRedist2008_x86.msi to my deployment project as it is a requirement
Do I need to add the @2x version to the project in Xcode or
I want to use MAF in my project because I need a robust add-in
I am working on the project and now I need to add a foreign
Could somebody give me a pointer on why I need to add my project
I'm trying to create an NSService in a Bundle project. I need to add
I'm using a CBGV CreateView in a Django project. I need to add some
my project need to read multiple web pages at a time(eg: for a particular

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.