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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:39:33+00:00 2026-05-26T13:39:33+00:00

I am trying to use the CSV below for drawing a plot: 2.364258,3.005366 2.723633,3.009784

  • 0

I am trying to use the CSV below for drawing a plot:

2.364258,3.005366
2.723633,3.009784
3.083008,3.012145
3.442383,3.012705
3.801758,3.010412
4.160156,3.010703
4.518555,3.011985
4.876953,3.012547
5.235352,3.009941
5.592773,3.011252
5.951172,3.010596
6.30957,3.011951
6.667969,3.010613
7.026367,3.008634
7.384766,3.009744
7.743164,3.01062
8.101563,3.00942
8.459961,3.009438
8.818359,3.009478
9.177734,3.010827

What I did so far is that I tried to make a Class to do this! this is the part when I try to draw the curve:

class Plotter
    {
        #region Fields and variables

        private Bitmap plot;
        private Graphics g;

        public string PlotType {get; set;}        

        private int iWidth; //Width of the box
        private int iHeight; //

        private float xMax; //maximum range on X axis
        private float yMax; //maximum range on Y axis

        private PointF[] points;

        #endregion    

        #region Constructors

        /// <summary>
        /// Constructor of class
        /// </summary>
        /// <param name="iWidth">Width of image in pixels</param>
        /// <param name="iHeight">Height of image in pixels</param>
        /// <param name="xMax">Maximum value of the values on X</param>
        /// <param name="yMax">Maximum value of the values on Y</param>
        /// <param name="pairs">Pairs of data in an array of PointF[] this is raw data!!</param>
        public Plotter(int iWidth, int iHeight, float xMax, float yMax, PointF[] points)
        {
            this.iWidth = iWidth;
            this.iHeight = iHeight;
            this.xMax = xMax;
            this.yMax = yMax;

            this.points = points;

            plot = new Bitmap(iWidth, iHeight); 
        }

        public Bitmap DrawPlot()
        {
            Pen blackPen = new Pen(Color.Black, 1);
            g = Graphics.FromImage(plot);

            PointF[] p = new PointF[points.GetLength(0)];

            //Try to scale input data to pixel coordinates
            foreach (PointF point in points)
            {
                int i = 0;

                p[i].X = point.X * iWidth;
                p[1].X = point.Y * iHeight;

            }

            g.DrawCurve(blackPen, p, 0);

            return plot;
        }

What I get at the end is jsut a stright line! that I think has been drawn on X{0,0} and Y{0,0} to X{0, 400} and Y{0,0}

Can you help me correct the mistakes please?

P.S: http://itools.subhashbose.com/grapher/index.php this site can draw the plot I need pretty good from the CSV data I have (if you need to check).

Thanks!

  • 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-26T13:39:33+00:00Added an answer on May 26, 2026 at 1:39 pm

    This seems to be your problem:

    foreach (PointF point in points)
    {
      int i = 0;
    
      p[i].X = point.X * iWidth;
      p[1].X = point.Y * iHeight;
    }
    

    i is always zero and you are never assigning Y. The “second” assignment isn’t even using i, but the 1 index.

    Quick fix without error checking:

    int i = 0;
    foreach (PointF point in points)
    {
      p[i].X = point.X * iWidth;
      p[i].Y = point.Y * iHeight;
    
      i++;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use the OleDb CSV parser to load some data from a
I am trying to use the jQuery CSV plugin, as documented here: http://code.google.com/p/js-tables/wiki/CSV According
I am trying to use the LINQ to CSV project in silverlight (its a
I was trying to use IBrokers package with the simplest code like below: library(IBrokers)
I'm trying to import a CSV file into an array that I can use
Were trying to use external file (txt or CSV) in order to create a
I'm trying to use map on a csv file in python. However, the line
I am trying to use SOJO to serialize a Java object to CSV. The
I'm trying to use the csv module to read a utf-8 csv file, and
I am trying to use a CSV parser which I found on the net

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.