using ZedGraph; GraphPane myPane = zedGraphControl1.GraphPane; myPane.Title.Text = "Simple Bar Chart"; myPane.XAxis.Title.Text = "X Axis"; myPane.YAxis.Title.Text = "Y Axis"; double[] x = { 1, 2, 3, 4, 5 }; double[] y = { 10, 20, 30, 40, 50 }; BarItem myBar = myPane.AddBar("My Bar", x, y, Color.Blue); zedGraphControl1.AxisChange();
GraphPane myPane = zedGraphControl1.GraphPane; myPane.Title.Text = "Multiple Bars"; myPane.XAxis.Title.Text = "X Axis"; myPane.YAxis.Title.Text = "Y Axis"; double[] x1 = { 1, 2, 3, 4, 5 }; double[] y1 = { 10, 20, 30, 40, 50 }; BarItem bar1 = myPane.AddBar("Bar 1", x1, y1, Color.Blue); double[] x2 = { 1, 2, 3, 4, 5 }; double[] y2 = { 20, 30, 40, 50, 60 }; BarItem bar2 = myPane.AddBar("Bar 2", x2, y2, Color.Red); zedGraphControl1.AxisChange();This example demonstrates how to create multiple BarItem objects and specify different colors for each bar. Package library: ZedGraph.