用ZedGraph画柱状图,结果 Y轴数字上有多余的数字,纵向的,特别小,不知是什么缘故,图片如下:代码如下: public void CreateBarChart(ZedGraphWeb zgw,
Graphics g,
MasterPane masterPane)
{
GraphPane myPane = masterPane[0];
myPane.CurveList.Clear();
myPane.GraphObjList.Clear();
//设置图表的说明文字
myPane.Title.Text = this.ChartTitle;
myPane.Title.FontSpec.FontColor = Color.Black;
//设置横座标的说明文字
myPane.XAxis.Title.Text = this.XTitle;
myPane.XAxis.Title.FontSpec.Size = 15;
//设置纵座标说明文字
myPane.YAxis.Title.Text = this.YTitle;
myPane.YAxis.Title.FontSpec.Size = 15;
//设置基于X轴排列柱状图
myPane.BarSettings.Base = BarBase.X;
//设置X轴大小步长均为1
myPane.XAxis.Scale.MajorStep = 1;
myPane.XAxis.Scale.MinorStep = 1;
//设置Y轴大步长自动
myPane.YAxis.Scale.MajorStepAuto = true;
myPane.YAxis.Scale.MinorStepAuto = true;
//设置格子
myPane.XAxis.MajorGrid.IsVisible = true;
myPane.YAxis.MajorGrid.IsVisible = true;
//显示坐标轴
myPane.XAxis.IsVisible = true;
myPane.YAxis.IsVisible = true;
//图例的显示位置
myPane.Legend.Position = LegendPos.Top; //myPane.YAxis.MajorTic.IsBetweenLabels = false;
BarItem myCurve = myPane.AddBar(this.YTitle, this.XArray, this.YArray, Color.Blue); //设置Bar颜色
myCurve.Bar.Fill = new Fill(Color.Blue, Color.White, Color.Blue, 0); //设置背景色
myPane.Chart.Fill = new Fill(Color.FromArgb(255, 255, 166), Color.FromArgb(255, 255, 166), 45.0f); //在柱状的顶端显示数值
BarItem.CreateBarLabels(myPane, false, null); masterPane.AxisChange(g); }
Graphics g,
MasterPane masterPane)
{
GraphPane myPane = masterPane[0];
myPane.CurveList.Clear();
myPane.GraphObjList.Clear();
//设置图表的说明文字
myPane.Title.Text = this.ChartTitle;
myPane.Title.FontSpec.FontColor = Color.Black;
//设置横座标的说明文字
myPane.XAxis.Title.Text = this.XTitle;
myPane.XAxis.Title.FontSpec.Size = 15;
//设置纵座标说明文字
myPane.YAxis.Title.Text = this.YTitle;
myPane.YAxis.Title.FontSpec.Size = 15;
//设置基于X轴排列柱状图
myPane.BarSettings.Base = BarBase.X;
//设置X轴大小步长均为1
myPane.XAxis.Scale.MajorStep = 1;
myPane.XAxis.Scale.MinorStep = 1;
//设置Y轴大步长自动
myPane.YAxis.Scale.MajorStepAuto = true;
myPane.YAxis.Scale.MinorStepAuto = true;
//设置格子
myPane.XAxis.MajorGrid.IsVisible = true;
myPane.YAxis.MajorGrid.IsVisible = true;
//显示坐标轴
myPane.XAxis.IsVisible = true;
myPane.YAxis.IsVisible = true;
//图例的显示位置
myPane.Legend.Position = LegendPos.Top; //myPane.YAxis.MajorTic.IsBetweenLabels = false;
BarItem myCurve = myPane.AddBar(this.YTitle, this.XArray, this.YArray, Color.Blue); //设置Bar颜色
myCurve.Bar.Fill = new Fill(Color.Blue, Color.White, Color.Blue, 0); //设置背景色
myPane.Chart.Fill = new Fill(Color.FromArgb(255, 255, 166), Color.FromArgb(255, 255, 166), 45.0f); //在柱状的顶端显示数值
BarItem.CreateBarLabels(myPane, false, null); masterPane.AxisChange(g); }
请各位高手帮忙
这句话就是显示你那个小格子值的