您的位置:首页 > 运维架构

OpenFlashChart

2009-09-03 12:25 218 查看
这几天琢磨了下OpenFlashChart这个控件。能画出很漂亮的图形报表。



有点小心得。



1。要先加载dll文件。http://teethgrinder.co.uk/open-flash-chart/.



2。在配置文件中要加上一句话,要不是用不了的:

<httpHandlers>



<add path="ofc_handler.ofc" verb="*" type="OpenFlashChart.WebHandler.ofcHandler, OpenFlashChart" />



</httpHandlers>



3。添加引用:



using OpenFlashChart;
using ToolTip = OpenFlashChart.ToolTip;
using ToolTipStyle = OpenFlashChart.ToolTipStyle;



4。代码:

private void LineMonth(string Mark, string Year)
{

OpenFlashChart.OpenFlashChart chat = new OpenFlashChart.OpenFlashChart();
List<string> list = new List<string>();
for (int i = 1; i <= 12; i++)
{
list.Add(i + "月");
}


OpenFlashChart.Line line1 = new Line();



//饼图 OpenFlashChart.Pie line1= new Pie();
//柱图 OpenFlashChart.Bar line1 = new Bar();

//水晶柱 OpenFlashChart.BarGlass line1 = new BarGlass();

ArrayList l2 = new ArrayList();


xy_basicinfo xy = new xy_basicinfo();
int[] count = new int[12];
count= xy.SelectCountByYear("2009");

for (int i = 1; i <= 12; i++)
{

l2.Add(Convert.ToDouble(count[i-1]));
}


line1.Values = l2; //给线负值



line1.Colour = "#2156B7";
line1.Tooltip = "报名人数:#val#人";//鼠标点在上面的时候显示的字

chat.AddElement(line1);

NewMethod(list, chat, Mark, Year);//方法2

OpenFlashChartControl1.EnableCache = false;
OpenFlashChartControl1.Chart = chat;

}



private void NewMethod(List<string> list, OpenFlashChart.OpenFlashChart c, string i, string year)//方法2
{
c.Title = new Title(i + year + "年招生信息");

c.Y_Axis.SetRange(0, 6000, 1);//设置 纵坐标的 起始值,最大值,第3个参数我换过 但是没看出什么差别

c.Y_Axis.Steps = 100;

c.X_Axis.Offset = true;

c.X_Axis.SetLabels(list);

c.Tooltip = new ToolTip("全局提示:#val#");

c.Tooltip.Shadow = true;

c.Tooltip.Colour = "#e43456";

c.Tooltip.MouseStyle = ToolTipStyle.CLOSEST;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: