CHART CONTROL IN C#
In this example, we will see how we can present the data in a visual form.
First, add one chart and one button from the toolbox and follow these steps.
Step 1- Go to the chart properties.
Step 2- Go to series collection editor change the name series as Age.
Step 3-Go to the Form1.cs code and copy the following code.
public Form1()
{
InitializeComponent();
}
private void fillChart()
{
chart1.Series["Age"].Points.AddXY("Rahul", "25");
chart1.Series["Age"].Points.AddXY("Ram", "45");
chart1.Series["Age"].Points.AddXY("Brijesh", "37");
chart1.Series["Age"].Points.AddXY("Neraj", "39");
chart1.Series["Age"].Points.AddXY("Alok", "28");
chart1.Series["Age"].Points.AddXY("AMAR", "55");
chart1.Titles.Add("AGE DETAILS");
}
Step 4-Go to the button1_click event and copy the following code.
private void button1_Click(object sender, EventArgs e)
{
fillChart();
}
In this example, we will see how we can present the data in a visual form.
First, add one chart and one button from the toolbox and follow these steps.
Step 1- Go to the chart properties.
Step 2- Go to series collection editor change the name series as Age.
Step 3-Go to the Form1.cs code and copy the following code.
public Form1()
{
InitializeComponent();
}
private void fillChart()
{
chart1.Series["Age"].Points.AddXY("Rahul", "25");
chart1.Series["Age"].Points.AddXY("Ram", "45");
chart1.Series["Age"].Points.AddXY("Brijesh", "37");
chart1.Series["Age"].Points.AddXY("Neraj", "39");
chart1.Series["Age"].Points.AddXY("Alok", "28");
chart1.Series["Age"].Points.AddXY("AMAR", "55");
chart1.Titles.Add("AGE DETAILS");
}
Step 4-Go to the button1_click event and copy the following code.
private void button1_Click(object sender, EventArgs e)
{
fillChart();
}
No comments:
Post a Comment