Codeproject is good, but some details are different.
Private void zgcreategraph (zedgraph. Web. zedgraphweb webobject, system. Drawing. Graphics g, zedgraph. masterpane pane)
{
// Obtain a graphpane reference
Graphpane mypane = pane [0];
// Set the title
Mypane. Title. Text = "my test bar graph ";
Mypane. xaxis. Title. Text = "label ";
Mypane. yaxis. Title. Text = "My Y axis ";
// Make up some random data points
String [] labels = ", "August September", "August October", "August November", "August December "};
Double [] Y = {100,115, 75, 22, 98, 40, 90,100, 95, 35, 80, 35 };
// Initialize the bar
Baritem mybar;
// Create a column chart
Mybar = mypane. addbar ("Number of cases", null, Y, color. Green );
Mybar. Bar. Fill = New fill (color. Green, color. White, color. Green );
// Create a curve
Lineitem mycurve = mypane. addcurve ("Number of cases", null, Y, color. Black, symboltype. Circle );
Mycurve. Line. Fill = New fill (color. White, color. lightskyblue,-45f );
// Set the curve style
Mycurve. symbol. size = 8.0f;
Mycurve. symbol. Fill = New fill (color. White );
Mycurve. Line. width = 2.0f;
// Specify that each bar is displayed between two labels.
Mypane. xaxis. majortic. isbetweenlabels = true;
// Set the X axis Scale
Mypane. xaxis. Scale. textlabels = labels;
// Set the X axis scale type
Mypane. xaxis. type = axistype. text;
// Set the chart Style
Mypane. Chart. Fill = New fill (color. White, color. fromargb (255,255,166), 90f );
Mypane. Fill = New fill (color. fromargb (250,250,255 ));
// Display
Pane. axischange ();
}
In this method, there are three parameters passed by the control. that is to say, the control has a render event, and the events are automatically delegated with these three parameters. this is very different from winform.
In addition, when Asp.net is lowered, it may prompt that a PNG file cannot be found, which is also a good solution. In the project, create a directory according to what it says, in fact, this error is equivalent to telling you that zedgraph requires a temporary directory, but you have not created it.