日期:2014-05-18 浏览次数:20455 次
string xdata=string.Empty; string ydata=string.Empty; string zdata=string.Empty; string zdata1=string.Empty; string zdata2=string.Empty; string xdata2=string.Empty; xdata="374,296,240,100,300,200"; ydata="9,7,15,10,0,6"; zdata="0.0374,0.069,0.084,0.065,0,0.023"; zdata1="0.05,0.05,0.05,0.05,0.05,0.05"; OWC10.ChartSpaceClass myspace=new OWC10.ChartSpaceClass(); //myspace.Border.Color="Red" ; // 这样就看不到框线了.. //添加图表 //OWC10.ChChart mychart=myspace.Charts.Add(0); OWC10.ChChart mychart=myspace.Charts.Add(0); //指定图的类型 //mychart.Type=OWC10.ChartChartTypeEnum.chChartTypeColumnClustered; mychart.Type=OWC10.ChartChartTypeEnum.chChartTypeColumnClustered; //是否有图例 mychart.HasLegend=true; //是否有title mychart.HasTitle=true; mychart.Title.Caption="公司所有人员省别分析图"; mychart.Title.Font.Bold=true; //为x轴加说明 // mychart.Axes[0].HasTitle=true; // //mychart.Axes[0].Title.Caption="省别"; // mychart.Axes[0].Font.Color="Blue"; // mychart.Axes[0].HasTickLabels=true; //为y轴加说明 //mychart.Axes[1].HasTitle=true; //mychart.Axes[1].Title.Caption="人数"; mychart.Axes[1].Font.Color="Blue"; //mychart.Axes[1].MajorGridlines.Line.Color="Red"; //格线颜色 //mychart.Axes[1].MajorGridlines.Line.DashStyle=OWC10.ChartLineDashStyleEnum.chLineLongDash; //格线颜色 mychart.Axes[1].MajorGridlines.Line.DashStyle=OWC10.ChartLineDashStyleEnum.chLineLongDash; //格线颜色 mychart.Axes[1].MajorUnit=50; //mychart.Axes[1].MajorTickMarks=OWC10.ChartTickMarkEnum.chTickMarkAutomatic; mychart.Axes[1].MajorTickMarks=OWC10.ChartTickMarkEnum.chTickMarkAutomatic; //把资料读入 string picname="项目"; string picname1="生产数"; string picname2="不良数"; string picname3="返修率"; string picname4="目标不良率"; mychart.SeriesCollection.Add(0); mychart.SeriesCollection[0].DataLabelsCollection.Add(); mychart.SeriesCollection[0].DataLabelsCollection[0].HasValue=true; mychart.SeriesCollection[0].DataLabelsCollection[0].Interior.Color="yellow"; //数值的背景色 mychart.SeriesCollection.Add(1); mychart.SeriesCollection[1].Ungroup(true); OWC10.ChAxis seAxes=mychart.Axes.Add(mychart.SeriesCollection[1].get_Scalings(OWC10.ChartDimensionsEnum.chDimValues)); seAxes.Position = OWC10.ChartAxisPositionEnum.chAxisPositionRight; seAxes.HasMajorGridlines = false; seAxes.NumberFormat = "0.00%"; seAxes.MajorUnit = 0.01; seAxes.MajorTickMarks=OWC10.ChartTickMarkEnum.chTickMarkAutomatic; mychart.SeriesCollection[1].DataLabelsCollection.Add(); mychart.SeriesCollection[1].DataLabelsCollection[0].HasValue=true; mychart.SeriesCollection.Add(2); mychart.SeriesCollection[2].DataLabelsCollection.Add(); //mychart.SeriesCollection[2].DataLabelsCollection[0].HasValue=true; mychart.SeriesCollection[2].Type=OWC10.ChartChartTypeEnum.chChartTypeLine; //mychart.SeriesCollection[3].DataLabelsCollection[0].HasPercentage=true;