Live Charts in C# is an opensource tool containing multiple chart controls like Line chats, Pie Chart, location Chart e.t.c. Live Charts in C# are simple, flexible, interactive & powerful data visualization tool.
In this tutorial we will learn How to create Cartesian Chart in WinForm App C#.
Tools Required:
- Visual Studio 2010 or later version.
- Live Chart DLL for chart controls but for this video we’ll use Nuget Package Manager for installation of Live Charts.
Steps to Follow:
- Create a new Windows forms application project in visual studio.
- Go to solution explorer and right click on project file and click on Manage Nuget Package Manager.
- Click on Browse button and type “Live Charts” in search bar.
- Now install the Live Charts and Live Charts WinForms. Make sure you have the internet connectivity on your PC.
- After successful installation, Rebuild your solution file from solution explorer.
- Go to the design view of your form. Open up the toolbox and you’ll find the chart controls here. If the chart controls are not added automatically, then go to the File Explorer, Bin\Debug folder of your project. Here you’ll find LiveCharts.WinForms.dll file. Just drag and drop it into your tool box.
- Now add the Cartesian chart to you form and resize it according to your requirement.
- Press F7 key to open up the code view of your form and inside constructor of class, add these lines of code:
cartesianChart1.Series = new SeriesCollection
{
new LineSeries
{
Values = new ChartValues<ObservablePoint>
{
new ObservablePoint(0,10), //First Point of First Line
new ObservablePoint(4,7), //2nd POint
new ObservablePoint(5,3), //------
new ObservablePoint(7,6),
new ObservablePoint(10,8)
},
PointGeometrySize = 25
},
new LineSeries
{
Values = new ChartValues<ObservablePoint>
{
new ObservablePoint(0,2), //First Point of 2nd Line
new ObservablePoint(2,5), //2nd POint
new ObservablePoint(3,6), //------
new ObservablePoint(6,8),
new ObservablePoint(10,5)
},
PointGeometrySize = 15
},
new LineSeries
{
Values = new ChartValues<ObservablePoint>
{
new ObservablePoint(0,4), //First Point of 3rd Line
new ObservablePoint(5,5), //2nd POint
new ObservablePoint(7,7), //------
new ObservablePoint(9,10),
new ObservablePoint(10,9)
},
PointGeometrySize = 15
}
};
Instead of fixed number you can get values from database and pass as parameters of ObservablePoint class.
Video Tutorial:
Watch full video tutorial to learn how to implement the above concept in visual C#.
Source Code:
I hope you enjoyed this tutorial. Thanks for visiting us. Please don’t forget to subscribe our official YouTube Channel C# Ui Academy
Well I truly liked studying it. This information procured by you is very constructive for accurate planning.
its informative article thx
bookmarked!!, I really like your website!
Hi, I do think this is an excellent website. I stumbledupon it 😉 I’m going to revisit once again since I book marked it. Money and freedom is the best way to change, may you be rich and continue to guide other people.
I have been exploring for a little bit for any high-quality articles or blog posts on this kind of area . Exploring in Yahoo I at last stumbled upon this website. Reading this info So i am happy to convey that I have an incredibly good uncanny feeling I discovered just what I needed. I most certainly will make sure to don抰 forget this web site and give it a glance regularly.
May I simply say what a relief to find someone who actually understands what they’re talking about online. You definitely understand how to bring an issue to light and make it important. More and more people need to check this out and understand this side of your story. I was surprised that you are not more popular because you most certainly have the gift.
I’m very pleased to discover this web site. I want to to thank you for your time just for this wonderful read!! I definitely appreciated every bit of it and i also have you book marked to check out new stuff in your website.
I’m honestly astonished. Cheers!