[收藏]ASP.Net生成静态HTML页 选择自 coofucoo 的 Blog
新建Visual C#项目——ASP.NET Web应用程序,将下列代码插入PageLoad事件处理函数中:
OWC.ChartSpace objCSpace = new OWC.ChartSpaceClass();
OWC.WCChart objChart = objCSpace.Charts.Add(0);
objChart.Type = OWC.ChartChartTypeEnum.chChartTypeColumnClustered;
objChart.HasLegend = true;
objChart.HasTitle = true;
objChart.Title.Caption = "上半年月收入图";
objChart.Axes[0].HasTitle = true;
objChart.Axes[0].Title.Caption = "万元";
objChart.Axes[1].HasTitle = true;
objChart.Axes[1].Title.Caption = "月份";
objChart.SeriesCollection.Add(0);
objChart.SeriesCollection[0].SetData(OWC.ChartDimensionsEnum.chDimSeriesNames,
+(int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral,"上半年收入");
objChart.SeriesCollection[0].SetData(OWC.ChartDimensionsEnum.chDimCategories,
+(int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral,
"Jan"+'\t'+"Feb"+'\t'+"Mar"+'\t'+"Apr"+'\t'+"May"+'\t'+"Jun"+'\t');
objChart.SeriesCollection[0].SetData(OWC.ChartDimensionsEnum.chDimValues,
(int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral,
"100"+'\t'+"20"+'\t'+"50"+'\t'+"60"+'\t'+"240"+'\t'+"20"+'\t');
objCSpace.ExportPicture(Server.MapPath("")+@"\tmpFile.gif","GIF",400,300);
Bitmap myPalette = new Bitmap(Server.MapPath("")+@"\tmpFile.gif",true);
myPalette.Save(Response.OutputStream,System.Drawing.Imaging.ImageFormat.Gif);