This article shows how to draw a Line or Multiple Line Charts using the MSChart control and also applying some important properties like Tool Tip, Legends, Line width, Shadow, 3D etc. A simple SQL Script which returns output for Category wise UnitPrice details which are plotted on a Chart Control. The sample code attached project was made using VS 2010 with the SQL Script. The project contains two web pages with samples of Single Line Chart and Multiple Line Charts. Prerequisite: VS 2008/2010, SQL Server.
On Page Load an SQL Connection is made and using SqlDataReader data is get fetched from database.
If any rows are found, then the chart is plotted by creating a Chart Area, Series and plotting points for Series.
Using two different SQL scripts and plotting two different Line Charts. For plotting multiple chart types we need to create multiple Series also on a single Chart Area.
This article shows how to draw a Line chart or Multiple Line Chart by using MSChart. Hope you all liked it; the sample code is attached for download and testing the code. Post your comments and rate the article. Post your queries to our Forum Section.
C# Corner. All contents are copyright of their authors.