Title 创建图表对象; private SoftwareFX.ChartFX.Chart chart1; this.chart1 = new SoftwareFX.ChartFX.Lite.Chart(); 定制位置、大小等信息,这里不需编码,通过拖入控件,并设置属性即可完成。 this.chart1.Location = new System.Drawing.Point(8, 16); this.chart1.Name = "chart1"; this.chart1.Size = new System.Drawing.Size(408, 208); this.chart1.TabIndex = 0; OpenData方法用于设定数据规模,COD.Values表示使用实际数值。2表示有两项业务指标,4表示横轴上有4个坐标,也就是每项业务有4个值 chart1.Value[]用于设定所有数值;chart1.CloseData方法用于关闭chart1对象的数据,和opendata方法配合使用。 chart1.OpenData(COD.Values, 2, 4); chart1.Value[0, 0] = 100; chart1.Value[1, 0] = 200; chart1.Value[0, 1] = 300; chart1.Value[1, 1] = 400; chart1.Value[0, 2] = 500; chart1.Value[1, 2] = 600; chart1.Value[0, 3] = 700; chart1.Value[1, 3] = 800; chart1.CloseData(COD.Values); chart1.Titles[0].Text 用于设定表的标题。 chart1.PointLabels =true表示每个图元素上都显示具体数值。chart1.SerLegBox = true;表示 显示图元素的说明,这里就是业务A,B,C chart1.Titles[0].Text = "业务统计图"; chart1.PointLabels = true; chart1.SerLegBox = true; chart1.SerLeg[0] = "业务 A"; chart1.SerLeg[1] = "业务 B"; chart1.Gallery = Gallery.Bar;//柱状图 chart1.Gallery = Gallery.Pie;//饼状图 chart1.Gallery = Gallery.Lines;//折线图 chart1.Chart3D = true;//开启3D效果 相关文章: