C# graph-drawing API
C#
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
demo
src
.gitattributes
.gitignore
LICENCE.md
README.md

README.md

Graph

Graph is a simple C# graph-drawing API.

Usage

  1. Add src/Graph.cs to your project.

  2. Initialise a new instance of Graph(PictureBox, int), passing it the PictureBox in which to draw, and the maximum number of points that should be visible along the x-axis at any one time.

    Graph graph = new Graph(pictureBox, 50);

Properties

You can set a few properties on your Graph object that will modify its behaviour.

Display (TextDisplay)

Default: TextDisplay.Nothing

The statistic to display on the top-left of the graph, if anything. This is an enum with values Nothing (no display), Peak (the highest point visible on the graph at this instant), and Average (the average y-value visible on the graph at this instant).

TextColor (Color)

Default: Color.Black

The color of the text displayed in the top-left corner, if there is any.

TextFont (Font)

Default: new Font("sans-serif", 12, FontStyle.Regular, GraphicsUnit.Pixel)

The font of the text displayed in the top-left corner, if there is any.

LineColor (Color)

Default: Color.Firebrick

The color of the line drawn on the graph.

Thickness (int)

Default: 2

The thickness of the line drawn on the graph.

Methods

AddPoint(int)

The one and only method you'll need. Adds a y-axis value to the graph.

Note that only positive values are supported. The point of origin of the graph is always the bottom-left corner.

Bugs or contributions

Open an issue or send a pull request.

Licence

MIT.