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 7642923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:18:53+00:00 2026-05-31T09:18:53+00:00

Here is my code: I am trying to get the CSV files from a

  • 0

Here is my code:

I am trying to get the CSV files from a folder. After that, I fetch the data from these files and store them in zedX and zedY lists. I pass these two arrays into zedgraphControl.

I am getting the plot accurately. But, there is a linear line joining from 0 to the last point in my graph. How should I remove this?

        //I am taking in a folder which have CSV files containing a data. So, iterating over files in the outer loop
        for (int i = 0; i < inputFolder.Count; i++)
        {
            //Lists to contain the data
            List<Double> zedXList = new List<double>();
            List<Double> zedYList = new List<double>();

            //Arrays to be passed into zedgraph
            double[] zedX = new double[thisbin.IndLists[i].Count()];
            double[] zedY = new double[thisbin.IndLists[i].Count()];

            for (int l = 0; l < thisbin.IndLists[i].Count(); l++)
            {
                zedX[l] = 0;
                zedY[l] = 0;
            }
            //In the inner loop I fetch the data from the file and store it in lists
            for (int j = 0; j < thisbin.IndLists[i].Count(); j++)
            {
                if (j % 2 == 0)
                {
                    zedXList.Add(thisbin.IndLists[i][j]);
                }
                if (j % 2 != 0)
                {
                    zedYList.Add(thisbin.IndLists[i][j]);
                }
            }

            //from the lists I pass the data into arrays, in order to pass it into zedgraph
            for (int k = 0; k < zedXList.Count(); k++)
            {
                zedX[k] = Convert.ToDouble(zedXList[k]);
                zedY[k] = Convert.ToDouble(zedYList[k]);

            }

            //zedgraph plot
            string title = "PLOT-" + Convert.ToString(i + 1);
            TabPage myTabPage = new TabPage(title);
            var zed = new ZedGraphControl();
            zed.Dock = DockStyle.Fill;
            zed.Size = new System.Drawing.Size(575, 312);
            zed.GraphPane.CurveList.Clear();
            var Indpane2 = zed.GraphPane;
            Indpane2.Title.Text = "PLOT" + Convert.ToString(i + 1);
            Indpane2.XAxis.Title.Text = "m/z";
            Indpane2.YAxis.Title.Text = "Intensity";
            var ind2 = new PointPairList(zedX, zedY);
            var IndCurve2 = Indpane2.AddCurve(title, ind2, Color.OrangeRed, SymbolType.Default);
            Indpane2.AxisChange();

            myTabPage.Controls.Add(zed);
            tabControl1.TabPages.Add(myTabPage);

            IndCurve2.Line.IsVisible = true;
            IndCurve2.Line.Width = 2.0F;
            zed.Invalidate();
            zed.Refresh();
        }
  • 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-31T09:18:55+00:00Added an answer on May 31, 2026 at 9:18 am

    A simple logical mistake. The lenght of zedX and zedY must be only the half of the length of thisbin.IndLists, because you alternate the assignment of the values. So the rest of your curve-arrays remains zero, so the last points of the curves are [0,0].
    So you have to do this:

    double[] zedX = new double[thisbin.IndLists[i].Count()/2];  
    double[] zedY = new double[thisbin.IndLists[i].Count()/2]; 
    

    instead of this:

    double[] zedX = new double[thisbin.IndLists[i].Count()];  
    double[] zedY = new double[thisbin.IndLists[i].Count()];`
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get some form data from POST method. Here's the code
Firstly here is the code that im trying to get to work- private: System::Void
I am trying to get the code found here: http://snipplr.com/view/26643/mbprogresshud-with-an-asynchronous-nsurlconnection-call/ to work in my
I am trying to test some of these code here http://ha.ckers.org/xss.html on my code.
I am trying to use the jQuery CSV plugin, as documented here: http://code.google.com/p/js-tables/wiki/CSV According
I'm trying to use the OleDb CSV parser to load some data from a
I'm trying to load data from a CSV on my Windows PC into a
I am trying to parse a CSV file generated from an Excel spreadsheet. Here
Here's my updated code trying to get my form to send me the email.
I am trying to fetch the data from a google docs spreadsheet and I

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.