Basic Tutorials-section II: ModInitialSampleDemo.cs Introduction

Source: Internet
Author: User
Tags sin

In order to explain the convenience, I enclose the source code and the effect chart first.

The code is as follows:

Using System;

Using System.Drawing;

Using System.Collections;

Using Zedgraph;

Namespace Zedgraph.demo

{

<summary>

Summary description for Simpledemo.

</summary>

public class Modinitialsampledemo:demobase

{

Public Modinitialsampledemo (): Base ("Code Project Modified Initial Sample",

"Modified Initial Sample", demotype.tutorial)

{

Graphpane Mypane = base. Graphpane;

Set up the title and axis labels

Mypane.title = "My Test graphn (for CodeProject Sample)";

MyPane.XAxis.Title = "My X Axis";

MyPane.YAxis.Title = "My Y Axis";

Make up some data arrays based on the Sine function

Pointpairlist List1 = new Pointpairlist ();

Pointpairlist list2 = new Pointpairlist ();

for (int i=0; i<36; i++)

{

Double x = (double) i + 5;

Double y1 = 1.5 + Math.sin ((double) I * 0.2);

Double y2 = 3.0 * (1.5 + math.sin (double) I * 0.2));

List1. ADD (x, y1);

List2. ADD (x, y2);

}

Generate a red curve with diamond

Symbols, and "Porsche" in the legend

LineItem Mycurve = Mypane.addcurve ("Porsche",

List1, Color.Red, Symboltype.diamond);

Generate a blue curve with circle

Symbols, and "Piper" in the legend

LineItem myCurve2 = Mypane.addcurve ("Piper",

List2, Color.Blue, symboltype.circle);

Change the color of the title

MyPane.FontSpec.FontColor = Color.green;

ADD gridlines to the plot, and make them gray

MyPane.XAxis.IsShowGrid = true;

MyPane.YAxis.IsShowGrid = true;

MyPane.XAxis.GridColor = Color.lightgray;

MyPane.YAxis.GridColor = Color.lightgray;

Move the legend location

Base. Pane.Legend.Position = ZedGraph.LegendPos.Bottom;

Make both curves thicker

MyCurve.Line.Width = 2.0F;

MyCurve2.Line.Width = 2.0F;

Fill the area under the curves

MyCurve.Line.Fill = new Fill (Color.White, color.red, 45F);

MyCurve2.Line.Fill = new Fill (Color.White, Color.Blue, 45F);

Increase the symbol sizes, and fill them with solid white

MyCurve.Symbol.Size = 8.0F;

MyCurve2.Symbol.Size = 8.0F;

MyCurve.Symbol.Fill = new Fill (color.red);

MyCurve2.Symbol.Fill = new Fill (color.white);

Add a background gradient fill to the axis frame

Mypane.axisfill = new Fill (Color.White,

Color.FromArgb (255, 255, 210), -45f);

ADD a caption and an arrow

Textitem myText = new Textitem ("Interestingnpoint", 23F, 7F);

MyText.FontSpec.FontColor = color.red;

MyText.Location.AlignH = Alignh.center;

MyText.Location.AlignV = Alignv.top;

MYPANE.GRAPHITEMLIST.ADD (MyText);

Arrowitem Myarrow = new Arrowitem (color.red, 12F, 7F, 5F, 20F, 8F);

MYPANE.GRAPHITEMLIST.ADD (Myarrow);

Base. Zedgraphcontrol.axischange ();

}

}

}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.