急,Owc11控件Y轴日期显示问题
我用Owc11控件在做统计图时,Y轴取出的数据是日期型,但在统计图中显示时却显示数字型(自动取年,舍去月日),很是不解,请高手指点?非常谢谢!!!(如2007-09-09 显示为2007)ChartSpace objCSpace= new ChartSpaceClass();
//'在ChartSpace对象中添加图表,Add方法返回chart对象
ChChart objChart= objCSpace.Charts.Add(0);
//'指定图表的类型。类型由OWC.ChartChartTypeEnum枚举值得到
//'objChart.Type = ChartChartTypeEnum.chChartTypeColumnClustered
//'objChart.Type = ChartChartTypeEnum.chChartTypeLine
objChart.Type = ChartChartTypeEnum.chChartTypeLineMarkers;
//'指定图表是否需要图例
objChart.HasLegend = true;
//'给定标题
objChart.HasTitle = true;
objChart.Title.Caption = "计划与实际对比曲线图";
//'给定x,y轴的图示说明
objChart.Axes[1].HasTitle = true;
objChart.Axes[1].Title.Caption = "工期";
objChart.Axes[0].HasTitle = true;
objChart.Axes[0].Title.Caption = "项目名称";
//'计算数据
//'*categories 和 values 可以用tab分割的字符串来表示*
String[] strSeriesName = { "计划工期", "实际工期" };
DataView gv;
gv = yy(Label_filter.Text);
String strCategory="";
for (int i=0;i<gv.Count;i++)
{
strCategory += gv[i]["mc"] + "\t";
}
String strValue = "";
String strValue1 = "";
DataView gv1;
//this.Response.Write(Label_filter.Text);
////return;
gv1 = num(Label_filter.Text);
for (int i = 0; i < gv1.Count; i++)
{
strValue += DateTime.Parse(gv1[i]["totalnum"].ToString()).ToString("yyyy-MM-dd") + "\t";
}
DataView gv2;
gv2 = num1(Label_filter.Text);
for (int i = 0; i < gv2.Count; i++)
{
strValue1 += DateTime.Parse(gv2[i]["totalnum"].ToString()).ToString("yyyy-MM-dd") + "\t";
}
String[] lbaue = {strValue, strValue1};
int inti = 0;
for ( inti = 0;inti<2;inti++)
{
//'添加一个series
objChart.SeriesCollection.Add(inti);
//'给定series的名字
objChart.SeriesCollection[inti].SetData(Microsoft.Office.Interop.Owc11.ChartDimensionsEnum.chDimSeriesNames,
+(int)Microsoft.Office.Interop.Owc11.ChartSpecialDataSourcesEnum.chDataLiteral, strSeriesName[inti]);
//'给定分类
objChart.SeriesCollection[inti].SetData(Microsoft.Office.Interop.Owc11.ChartDimensionsEnum.chDimCategories,
+(int)Microsoft.Office.Interop.Owc11.ChartSpecialDataSourcesEnum.chDataLiteral,lbaue[inti]);
//给定值
objChart.SeriesCollection[inti].SetData
(Microsoft.Office.Interop.Owc11.ChartDimensionsEnum.chDimValues,
(int)Microsoft.Office.Interop.Owc11.ChartSpecialDataSourcesEnum.chDataLiteral, lbaue[inti]);
//'給定值
//'objChart.SeriesCollection(inti).Interior.Color = "LightSeaGreen"
objChart.SeriesCollection[inti].DataLabelsCollection.Add();
}
string Myload = System.Configuration.ConfigurationManager.AppSettings["PhysicalPath"].ToString();
//'输出成GIF文件.'Server.MapPath(".") +
String strAbsolutePath= "d:\\tjbb\\upload\\test.gif" ;
String strAbsolutePath = Myload;
objCSpace.ExportPicture(strAbsolutePath, "GIF", 900, 540);
//'创建GIF文件的相对路径.
String strRelativePath= "../upload/";
//'把图片添加到placeholder.
String strImageTag= "<IMG SRC='" + strRelativePath + "'/>";
PlaceHolder1.Controls.Add(new LiteralControl(strImageTag));
--------------------编程问答-------------------- 在数据库里把 2007-09-09 转换为 2007/09/09 ,看看怎么样
补充:.NET技术 , C#