Discussion on object-oriented programming ideas from the production of a Public opinion survey (III.)

Source: Internet
Author: User
Programming | Objects now do you find that you can use this class to conduct a public opinion investigation? But there's no page HTML in this class.

Output, so now the problem is to do the page display layer, but now faced with a problem, that is how to show the findings of the problem,

The more popular approach is to use graphs to indicate that you can select bars, pie charts, or line charts as needed, and so on if the survey

Class can be done, but it is too bad, should be done alone so a chart class, you can draw this chart, the following is the

The definition of a class:

Namespace Myclass.util
{
Using System;
Using System.Collections;
Using System.Drawing;



<summary>
MyChart is a statistical graph class that can generate pie, bar, and line charts
</summary>
public class Mychart:object
{

<summary>
Enum type
</summary>
<remarks>
Three types, pie chart is pie, bar is bar, line chart is curve
</remarks>
public enum ChartType
{
Pie = 0,
Bar = 1,
Curve = 2
};

<summary>
Statistics Chart Title
</summary>
private string M_strtitle;

<summary>
An array of chart items, array elements are Chartitem classes
</summary>
<remarks>
Percentage of all chart items and equal to 100.
</remarks>
Private ArrayList M_arritems;

<summary>
Unit of measurement
</summary>
private string M_strunit;

<summary>
Generate the width of the statistics chart
</summary>
<remarks>
The default is 200
</remarks>
private int m_intwidth;

<summary>
To generate the height of the statistics graph
</summary>
<remarks>
The default is 200
</remarks>
private int m_intheight;

<summary>
Generate a background color for a statistics chart
</summary>
Private System.Drawing.Color M_objbackcolor;

<summary>
Statistical chart types
</summary>
<remarks>
Default is pie chart
</remarks>
Private ChartType M_intcharttype;

<summary>
Total
</summary>
private int m_inttotalcount;

<summary>
Total, Read only
</summary>
public int TotalCount
{
Get
{
return m_inttotalcount;
}
}

<summary>
Title of the statistics chart
</summary>
public string Title
{
Get
{
return m_strtitle;
}
Set
{
M_strtitle = value;
}
}

<summary>
An array of statistical chart items
</summary>
<remarks>
This property is read-only, to add items, use the AddItem function
</remarks>
Public ArrayList Items
{
Get
{
return m_arritems;
}
}

<summary>
Statistics Chart width
</summary>
public int Width
{
Get
{
return m_intwidth;
}
Set
{
M_intwidth = value;
}
}

<summary>
Unit of measurement
</summary>
public string Unit
{
Get
{
return m_strunit;
}
Set
{
M_strunit = value;
}
}
<summary>
Statistics Chart Height
</summary>
public int Height
{
Get
{
return m_intheight;
}
Set
{
M_intheight = value;
}
}

<summary>
Statistics Chart Background color
</summary>
Public System.Drawing.Color BackColor
{
Get
{
return m_objbackcolor;
}
Set
{
M_objbackcolor = value;
}
}


<summary>
Chart type, this determines what form the resulting picture takes
</summary>
<remarks>
Pie: Pie chart
Bar: Bar Chart
Curve: Line chart
Public ChartType Type
{
Get
{
return m_intcharttype;
}
Set
{
M_intcharttype = value;
}
}
<summary>
Constructors
</summary>


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.