随便写了一个charting的class ,用owc画的,总觉得owc画图不是很漂亮,不过还能对付看吧!现在画图的控件也很多,免费的不多,想自己开发一个吧,能力有限,也没那个时间,觉得owc还可以满足对质量不是要求很高的图的要求,主要是免费的,装了office就ok了。

            下面还是给出代码:
owc charting classusing System;
owc charting class
using System.Data;
owc charting class
using System.Configuration;
owc charting class
using System.Web;
owc charting class
using System.Web.Security;
owc charting class
using System.Web.UI;
owc charting class
using System.Web.UI.WebControls;
owc charting class
using System.Web.UI.WebControls.WebParts;
owc charting class
using System.Web.UI.HtmlControls;
owc charting class
using OWC = Microsoft.Office.Interop.Owc11;
owc charting class

 

大家要注意:字符串strCategory 和 字符串数组strValues 项都是以"\t"分隔的字符串,但最后不能以"\t"结束。
例如:strCategory = "周一\t周二\t周三\t周四\t周五\t周六\t周日"

其中的颜色和图的底色都是可以自己改变的,这个主要起到起步的作用,希望谁看到能画出更漂亮的图。

类的使用:

owc charting classDrawChart dc = new DrawChart(m_strSeries, m_strCategory, m_strValues, m_strChartTitle, m_strAbsolutePath,
owc charting class                m_strPhysicalPath, m_strFileName, m_nCount, m_chartType);
owc charting class            divChart.InnerHtml 
= dc.Draw();//divChart是在html页中随便一个div,当然runat=server了

相关文章: