Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
3550
How to make line chart?
posted

I want a 2D line chart for a list of points with x, y values.

I want 1 line, that goes threw the points, but I get 4 lines, 1 for each point.

I want the points to be in the right place, according to their numerical value. So that (1,1) point

Will be in 1 on x axis, 1 on y axis,  and (7,9)  point Will be in 7 on x axis, 9 on y axis.

I have this code.

List<Point> pointLs = new List<Point>();
            pointLs.Add(new Point(1,1));
            pointLs.Add(new Point(2, 4));
            pointLs.Add(new Point(7, 9));
            pointLs.Add(new Point(12, 20));
            ultraChart1.DataSource = pointLs;
            this.ultraChart1.DataBind(); 

public class Point {
        public Point(double x, double y) {
            mX = x;
            mY = y;
        }
        private double mX;

        private double mY;

        public double Y
        {
            get { return mY; }
            set { mY = value; }
        }

        public double X
        {
            get { return mX; }
            set { mX = value; }
        }
       
    }    


Parents Reply Children