Click here to Skip to main content
15,897,090 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to use the chart control in vb.net or c#?
And If I Know well Visual Basic Programming, does it mean that i know and C Sharp programming?
Posted
Comments
[no name] 6-Sep-12 7:41am    
You start by reading the documentation, http://msdn.microsoft.com/en-us/library/dd456632.aspx

C#
using System;
using System.Windows.Forms;
using System.Windows.Forms.DataVisualization.Charting;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
    public Form1()
    {
        InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        // Data arrays.
        string[] seriesArray = { "Cats", "Dogs" };
        int[] pointsArray = { 1, 2 };

        // Set palette.
        this.chart1.Palette = ChartColorPalette.SeaGreen;

        // Set title.
        this.chart1.Titles.Add("Pets");

        // Add series.
        for (int i = 0; i < seriesArray.Length; i++)
        {
        // Add series.
        Series series = this.chart1.Series.Add(seriesArray[i]);

        // Add point.
        series.Points.Add(pointsArray[i]);
        }
    }
    }
}
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900