直播中
輸出,所以現(xiàn)在的問(wèn)題就是做頁(yè)面顯示層了,但現(xiàn)在又面臨一個(gè)問(wèn)題,那就是如何顯示調(diào)查結(jié)果的問(wèn)題,
比較流行的做法是用圖表來(lái)表示,可以根據(jù)需要選擇條形圖、餅性圖或折線圖等等,那么如果在這個(gè)調(diào)查
類里來(lái)做也可以,但實(shí)在太不上算,應(yīng)該單獨(dú)做這么一個(gè)圖表類,可以根據(jù)條件畫這種圖表,下面就是這
個(gè)類的定義:
namespace MyClass.Util
{
using System;
using System.Collections ;
using System.Drawing ;
/// <summary>
/// MyChart是一個(gè)統(tǒng)計(jì)圖類,可以生成餅形圖、條形圖和折線圖
/// </summary>
public class MyChart : object
{
/// <summary>
/// 枚舉類型
/// </summary>
/// <remarks>
/// 三種類型,餅形圖是pie , 條形圖是bar , 折線圖是curve
/// </remarks>
public enum ChartType
{
Pie = 0 ,
Bar = 1 ,
Curve = 2
};
/// <summary>
/// 統(tǒng)計(jì)圖標(biāo)題
/// </summary>
private string m_strTitle ;
/// <summary>
/// 統(tǒng)計(jì)圖項(xiàng)目數(shù)組,數(shù)組元素是ChartItem類
/// </summary>
/// <remarks>
/// 所有統(tǒng)計(jì)圖項(xiàng)目的百分比和等于100。
/// </remarks>
private ArrayList m_arrItems ;
/// <summary>
/// 計(jì)量單位
/// </summary>
private string m_strUnit ;
/// <summary>
/// 生成統(tǒng)計(jì)圖的寬度
/// </summary>
/// <remarks>
/// 默認(rèn)是200
/// </remarks>
private int m_intWidth ;
/// <summary>
/// 生成統(tǒng)計(jì)圖的高度
/// </summary>
/// <remarks>
/// 默認(rèn)是200
/// </remarks>
private int m_intHeight ;
/// <summary>
/// 生成統(tǒng)計(jì)圖的背景色
/// </summary>
private System.Drawing.Color m_objBackColor ;
/// <summary>
/// 統(tǒng)計(jì)圖類型
/// </summary>
/// <remarks>
/// 默認(rèn)是餅形圖
/// </remarks>
private ChartType m_intChartType ;
/// <summary>
/// 總數(shù)
/// </summary>
private int m_intTotalCount ;
/// <summary>
/// 總數(shù),只讀
/// </summary>
public int TotalCount
{
get
{
return m_intTotalCount ;
}
}
/// <summary>
/// 統(tǒng)計(jì)圖的標(biāo)題
/// </summary>
public string Title
{
get
{
return m_strTitle ;
}
set
{
m_strTitle = value ;
}
}
/// <summary>
/// 統(tǒng)計(jì)圖項(xiàng)數(shù)組
/// </summary>
/// <remarks>
/// 這個(gè)屬性只讀,若要添加項(xiàng)目,用AddItem函數(shù)
/// </remarks>
public ArrayList Items
{
get
{
return m_arrItems ;
}
}
/// <summary>
/// 統(tǒng)計(jì)圖寬度
/// </summary>
public int Width
{
get
{
return m_intWidth ;
}
set
{
m_intWidth = value ;
}
}
/// <summary>
/// 計(jì)量單位
/// </summary>
public string Unit
{
get
{
return m_strUnit ;
}
set
{
m_strUnit = value ;
}
}
/// <summary>
/// 統(tǒng)計(jì)圖高度
/// </summary>
public int Height
{
get
{
return m_intHeight ;
}
set
{
m_intHeight = value ;
}
}
/// <summary>
/// 統(tǒng)計(jì)圖背景色
/// </summary>
public System.Drawing.Color BackColor
{
get
{
return m_objBackColor ;
}
set
{
m_objBackColor = value ;
}
}
/// <summary>
/// 圖表類型,這個(gè)決定生成的圖片采用什么形式
/// </summary>
/// <remarks>
/// Pie : 餅形圖
/// Bar: 條形圖
/// Curve: 折線圖
public ChartType Type
{
get
{
return m_intChartType ;
}
set
{
m_intChartType = value ;
}
}
/// <summary>
/// 構(gòu)造函數(shù)
/// </summary>