How to Create a pie chart and a column chart in WinForm of C #

Source: Internet
Author: User

When our software requires various pie charts and bar charts to represent data, we may think of using graphical controls or third-party controls in Offices, but most of the third-party controls need to be registered now, some free controls have developer tags. However, graphical controls using Offices cannot be well controlled in the program, and the ease of use is also low, so here I will show how to use GDI + in C # To connect the pie chart and bar chart to the database to display data.
Using System;
Using System. IO; // used for File Access
Using System. Data; // used for Data access
Using System. Drawing; // provides basic functions for Drawing GDI + graphics.
Using System. Drawing. Text; // provides advanced functions for Drawing GDI + graphics.
Using System. Drawing. Drawing2D; // provides advanced 2D and vector graphics Functions.
Using System. Drawing. Imaging; // provides advanced functions for Drawing GDI + graphics.
Namespace BaseLayer
{
Public class PieChart
{
Public PieChart ()
{
}
// Render is the big title of the graph. The title of the graph, the width of the graph, the graph length, the dataset of the pie chart, and the data to be expressed by the dataset of the pie chart.
Public Image Render (string title, string subTitle, int width, int height, DataSet chartData, int DataLine)
{
Const int SIDE_LENGTH = 400;
Const int PIE_DIAMETER = 200;
DataTable dt = chartData. Tables [0];

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.