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

  • Home
  • SEARCH
  • 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 8128439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:52:54+00:00 2026-06-06T07:52:54+00:00

I have two curves on the zedgraph control, after plotting both the curves… PointPairList

  • 0

I have two curves on the zedgraph control, after plotting both the curves…

PointPairList thresholdList = new PointPairList();
PointPairList powerList = new PointPairList();

private void plotPower()
{
        // Create an object to access ZedGraph Pane
        GraphPane pane = zedGraphControl1.GraphPane;            
        LineItem thresholdLine = new LineItem("thresholdLine");
        LineItem powerLine = new LineItem("powerLine");

        // Set the Threshold Limit
        double thresoldLimit = Convert.ToDouble(numAnalysisThreshold2.Value);

        // Points
        double[] x = new double[]{0, pane.XAxis.Scale.Max};
        double[] y = new double[]{thresoldLimit, thresoldLimit};

        // Set the threshold line curve list
        thresholdList.Add(x, y); 

        // Set the Power Line curve list
        powerdList.Add(XData, YData);

        // Add Curves
        thresholdLine = pane.AddCurve("", thresholdList, Color.Red, SymbolType.None);
        powerLine = pane.AddCurve("", powerList, Color.Red, SymbolType.None);

        // Refresh Chart
        this.Invalidate();
        zedGraphControl1.Refresh();
}

from the above code, I managed to plot the two curves as power line curve over the threshold line curve.

Now my questions is, if I want to bring any one of the curve in front….Is there any method available(ex: bringittoFront()….)…?

Thanks a lot for your time ….:)

  • 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-06-06T07:52:56+00:00Added an answer on June 6, 2026 at 7:52 am

    The GraphPane contains a CurveList property, and the CurveList class is a subclass of List<CurveItem>. If you set the CurveItem.Tag property for each curve that you draw, I believe you should be able to sort the curve items by using the CurveList.Sort(IComparer<CurveItem>) method and using the Tag to represent the sorting order.

    UPDATE JUNE 19

    Simple example: two lines, the blue line2 with line2.Tag = 2 and the red line1 with line1.Tag = 1. In the initialization line2 is added first to the graph pane, so it will be displayed on top.

    void GraphInit()
    {
        var line2 = _graph.GraphPane.AddCurve("Second", 
            new[] { 0.1, 0.5, 0.9 }, new[] { 0.1, 0.5, 0.1 }, Color.Blue);
        line2.Tag = 2;
    
        var line1 = _graph.GraphPane.AddCurve("First", 
            new[] { 0.1, 0.5, 0.9 }, new[] { 0.1, 0.5, 0.9 }, Color.Red);
        line1.Tag = 1;
    
        _graph.Refresh();
    }
    

    Initial display before sorting

    To sort, first implement a class that implements IComparer<CurveItem>, and that sorts the curve items in ascending order based on the numerical value of the CurveItem Tag property:

    class CurveItemTagComparer : IComparer<CurveItem>
    {
        public int Compare(CurveItem x, CurveItem y)
        {
            return ((int)x.Tag).CompareTo((int)y.Tag);
        }
    }
    

    To perform re-sorting and update the graph, implement the following event handler for the Sort button:

    void SortButtonClick(object sender, EventArgs e)
    {
        _graph.GraphPane.CurveList.Sort(new CurveItemTagComparer());
        _graph.Refresh();
    }
    

    Now, when clicking the Sort button, the curves will be sorted such that the curve with the lowest tag value, i.e. line1, will instead be drawn on top. Additionally, note that the curve order in the legend is changed along.

    Graph after Sort button is clicked

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

Sidebar

Related Questions

I have two curves, one inside another, for example ellipse inside circle. I need
I have a parametric curve, say two vectors of doubles where the parameter is
Have two folders with approx. 150 java property files. In a shell script, how
Have two actionsheet buttons and one modalviewcontroller on mainviewcontroller in application. Now for two
I have two tables images2 and image_data So the goal is to have 1
I have two classes (MVC view model) which inherits from one abstract base class.
I have two files client.php and server.php. The client file send a HTTP request
I have two columns say Main and Sub . (they can be of same
I have two tables 1.Products prod_id prod_name 1 honda 2 hero 3 marcedes 4
I have two lists in python and I want to know if they intersect

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.