【 tulaoshi.com - ASP.NET 】
新建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);
运行可以生成如下柱状图显示在页面上:
但是我觉得月份坐标和图例上的字体都太小了,该怎么调整?我试着改变输出图像大小但是字体并没有跟着改变,小弟初学.NET和C#,请众位高手不吝赐教!