C# WPF 通过 ZedGraph 绘制柱状图
作者:互联网
首先参考我以前的博客介绍如何使用ZedGraph点击,查看
参考:https://blog.csdn.net/lan_liang/article/details/7528837
private void Window_Loaded(object sender, RoutedEventArgs e)
{
zedGraphControl1.GraphPane.CurveList.Clear();
zedGraphControl1.GraphPane.GraphObjList.Clear();
GraphPane myPane = zedGraphControl1.GraphPane;
myPane.Title.Text = "统计消费者"; //设计图表的标题
myPane.XAxis.Title.Text = "男/女"; //X轴标题
myPane.YAxis.Title.Text = "人数"; //Y轴标题
PointPairList PPLa = new PointPairList();
PointPairList PPLb = new PointPairList();
for (int i = 1; i < 2; i++)
{
PPLa.Add(i, i + 3);
PPLb.Add(i + 1, i + 4);
}
BarItem myBara = myPane.AddBar("A", PPLa, System.Drawing.Color.Red);
BarItem myBarb = myPane.AddBar("B", PPLb, System.Drawing.Color.Blue);
zedGraphControl1.AxisChange();
zedGraphControl1.Refresh();//这句话非常重要,否则不会立即显示
}
标签:PPLa,ZedGraph,C#,PointPairList,柱状图,GraphPane,zedGraphControl1,Title,myPane 来源: https://blog.csdn.net/weixin_42974146/article/details/94396140