//指定图表是否需要图例标注
InsertChart.HasLegend = true;
InsertChart.HasTitle = true;//为图表添加标题
InsertChart.Title.Caption = "2007年本人每个月花销流水账";//标题名称
//为x,y轴添加图示说明
InsertChart.Axes[0].HasTitle = true;
InsertChart.Axes[0].Title.Caption = "月份(月)";//月份
InsertChart.Axes[1].HasTitle = true;
//InsertChart.Axes[1].Scaling.SplitMinimum = 200;
InsertChart.Axes[1].Title.Caption = "数量(元)";
//InsertChart.Axes[1].
//显示Y轴刻度标签
InsertChart.Axes[1].HasTickLabels = true ;
//不显示Y轴主要刻度标记
//InsertChart.Axes[1].MajorTickMarks = ChartTickMarkEnum.chTickMarkNone;
//Y轴主要网络线
InsertChart.Axes[1].HasMajorGridlines = false;
InsertChart.Axes[1].HasAutoMajorUnit = true;
//坐标轴上显示的数据格式设置
InsertChart.Axes[1].NumberFormat = "0.00%";
//坐标轴刻度宽度
//InsertChart.Axes[1].TickLabelSpacing =1;
//InsertChart.Axes[1].Title.Position = ChartTitlePositionEnum.chTitlePositionBottom;
//给y轴添加一个对应的平行轴
InsertChart.Axes.Add(InsertChart.Axes[1].Scaling);
InsertChart.Axes[2].Position = ChartAxisPositionEnum.chAxisPositionLeft ;
InsertChart.Axes[2].CrossingAxis = InsertChart.Axes[1];
InsertChart.Axes[2].HasTitle = true;
InsertChart.Axes[2].Title.Caption = "金额(元)";
//绘图区背景颜色
InsertChart.PlotArea.Interior.Color = "white";
//图表工作区边框颜色
InsertChart.Border.Color = "blue";
//InsertChart.
// 添加一个series系列
InsertChart.SeriesCollection.Add(0);
// 设置次坐标轴,系列2的累积百分比依据次坐标轴填充
InsertChart.SeriesCollection.Add(1);
InsertChart.SeriesCollection[1].Ungroup(true);
//给定series系列的名字
InsertChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimSeriesNames, +(int)ChartSpecialDataSourcesEnum.chDataLiteral, strSeriesName);
//给定分类
InsertChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimCategories, +(int)ChartSpecialDataSourcesEnum.chDataLiteral, strXdata);
//给定值
InsertChart.SeriesCollection[0].SetData(ChartDimensionsEnum.chDimValues, (int)ChartSpecialDataSourcesEnum.chDataLiteral, strYdata);
//曲线的颜色
InsertChart.SeriesCollection[1].Line.Color = "blue";
//绘制第二条图形
InsertChart.SeriesCollection[1].SetData(ChartDimensionsEnum.chDimSeriesNames, +(int)ChartSpecialDataSourcesEnum.chDataLiteral, strSeriesName);
InsertChart.SeriesCollection[1].SetData(ChartDimensionsEnum.chDimCategories, +(int)ChartSpecialDataSourcesEnum.chDataLiteral, strXdata);
InsertChart.SeriesCollection[1].SetData(ChartDimensionsEnum.chDimValues, (int)ChartSpecialDataSourcesEnum.chDataLiteral, strYdata1);
//输出文件.
string strAbsolutePath = (Server.MapPath(".")) + "\\image\\ShowData1.gif";
laySpace.ExportPicture(strAbsolutePath, "GIF", 400, 250);
//创建GIF文件的相对路径.
string strRelativePath = "./image/ShowData1.gif";
//把图片添加到placeholder中,并在页面上显示
string strImageTag = "<IMG SRC='" + strRelativePath + "'/>";
//this.Image1.ImageUrl = strImageTag;
this.PlaceHolder1.Controls.Add(new LiteralControl(strImageTag));
}
#endregion
数据库设计:
自己随便创建一个库,第一列为X轴数据(日期),第二、三列为Y轴数据,随便插入几条记录就可以了。
请大家指导,如果还有其它什么好的方法,希望大家能共同交流。