Problem description:
Use the ZedGrap control in C # To draw a chart
ZedGrap introduction:
Install the ZedGrap Control
ZedGraph control dll file:
Add the ZedGraph control. First, add the ZedGrap. dll file to the newly created C # image project.
Note:
In the project reference, right-click and select Add reference. In the "add reference" dialog box that appears, select Browse to add ZedGraph. dll file
Note:
The successfully added ZedGraph. dll file will appear in the reference
Note:
As shown in, right-click the blank area in the toolbox and select "select item" from the displayed menu. The window for selecting toolbox items appears.
Note:
As shown in, in the select Toolbox window that appears, Click Browse to find the added ZedGraph. dll file.
Note:
As shown in, add ZedGraph. dll
Note:
After successfully adding the ZedGraph. dll file, you will see the ZedGraphControl control in the toolbox. Now you can use the ZedGrapControl control normally, which is similar to the common space.
(1) Use the ZedGraphControl Control
Drag the ZedGrapControl control in the toolbox
(2) set the basic information of the ZedGrapControl Control
Note:
These are common classes and variables in ZedGrap, such as GraphPane and PointPairList.
Note:
GraphPane in the ZedGrapControl space returns a GraphPane object, and PointPairList is the container of the vertex in the chart.
Note:
The code above indicates the ZedGraph settings, including the chart title, X-axis name, Y-axis name, Y-axis step size, X-axis step size, Y-axis maximum coordinate value, and minimum coordinate value, fill color of the coordinate axis, set the color and name of the curve in the coordinate
(3) add coordinate points in ZedGraph
Note:
The above Code adds coordinate points to ZedGraph. Note that after adding coordinates, you need to re-draw the coordinate axes.
(4) References: