---
title: "How to use Chart Controls in Windows Forms Application in .net"  
description: "How to use Chart Controls in Windows Forms Application in .net"  
author: "Anonymous User"  
published: 2016-01-01  
updated: 2023-07-03  
canonical: https://www.mindstick.com/forum/33816/how-to-use-chart-controls-in-windows-forms-application-in-dot-net  
category: ".net"  
tags: [".net"]  
reading_time: 3 minutes  

---

# How to use Chart Controls in Windows Forms Application in .net

I want to use [Chart](https://www.mindstick.com/articles/1509/show-google-analytics-data-in-chart-in-asp-dot-net-mvc) [Controls](https://www.mindstick.com/articles/66/how-to-create-controls-at-run-time-in-csharp-dot-net) in [Windows](https://www.mindstick.com/articles/311752/how-to-install-and-use-the-google-wifi-software-on-a-windows-or-mac-computer) [Forms Application](https://www.mindstick.com/forum/33817/how-to-use-webbrowser-controls-in-windows-forms-application-c-sharp-dot-net) in .net. please give me a demo.

## Replies

### Reply by Aryan Kumar

Sure, here are the steps on how to use chart controls in Windows Forms [application](https://www.mindstick.com/articles/12824/calculator-application-in-android) in .NET:

1. Add a Chart control to your Windows Forms form.
2. Add data to the Chart control.
3. Set the properties of the Chart control.
4. Bind the Chart control to an event handler.
5. In the event handler, write code to handle the events of the Chart control.

Here is an example of the code:

C#

```plaintext
private void Chart1_MouseMove(object sender, MouseEventArgs e)
{
    // Get the mouse position
    Point mousePosition = e.Location;

    // Get the chart point that is under the mouse cursor
    ChartPoint chartPoint = Chart1.GetPointAt(mousePosition);

    // Write code to handle the mouse move event
    // For example, you can display the value of the chart point in a message box
    MessageBox.Show(chartPoint.Value.ToString());
}
```

This code will add a Chart control to your Windows Forms form. The data for the Chart control will be set in the code-behind file. The Chart control will be bound to the `MouseMove` event handler. The `MouseMove` event handler will be triggered when the mouse cursor moves over the Chart control. The code in the `MouseMove` event handler will display the value of the chart point that is under the mouse cursor in a message box.

Here are some of the chart controls that you can use in Windows Forms application in .NET:

- **Line Chart:** A line chart is a graphical representation of data points connected by straight lines.
- **Bar Chart:** A bar chart is a graphical representation of data points displayed as bars.
- **Pie Chart:** A pie chart is a graphical representation of data points displayed as slices of a pie.
- **Scatter Chart:** A scatter chart is a graphical representation of data points displayed as dots.
- **Area Chart:** An area chart is a graphical representation of data points displayed as filled areas.

### Reply by Anonymous User

we will see how to use the Chart control in Windows [Forms](https://www.mindstick.com/interview/34192/what-is-the-purpose-of-the-authentication-mode-forms-element-in-web-config) Applications. As we know Charts and Graphs make data easier to understand.

```
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Windows.Forms.DataVisualization.Charting;namespace WindowsForums{    public partial class Chart : Form    {        public Chart()        {            InitializeComponent();        }        private void Chart_Load(object sender, EventArgs e)        {                        string[] seriesarr = { "Jan", "Feb", "MAR", };            int[] pointsArray = { 1000, 2000,1500 };                        this.chart1.Palette = ChartColorPalette.Pastel;                        this.chart1.Titles.Add("Sales");                         for (int i = 0; i < seriesarr.Length; i++)            {                              Series series = this.chart1.Series.Add(seriesarr[i]);                     series.Points.Add(pointsArray[i]);            }        }    }}
```

![How to use Chart Controls in Windows Forms Application in .net](https://www.mindstick.com/mindstickforums/76b0a73f-8dfe-4f81-a7e3-a4ee123bd383/images/7492aec1-d88e-4e09-8756-9a00e74aa2f2.png)


---

Original Source: https://www.mindstick.com/forum/33816/how-to-use-chart-controls-in-windows-forms-application-in-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
