I am trying to create a graph that will show the progress of a workout. Every five button clicks a tick should be added to the graph. This is a example of how it should look.
1 http://img22.imageshack.us/img22/7633/clickgraph.png
For demonstration purposes I am using a button click, In production the clicks will be every twenty revolutions of a wheel.
private int counter = 0;
private void button1_Click(object sender, EventArgs e)
{
counter++;
// code will go here
}
Thanks in advance
You can use either a
Bitmap Buffer
or apanel
to draw on. Here is a headstart: Just a sample. reference.This solution is based on
WinForms
&Panel_Paint()
. You may try to add vertical Progress Label and Chart's Y Axis value labeling.Code:
Output Form:
I'm not much of an ASP.NET guy but here's an algorithm you can use to draw the squares
You can determine if you have a multiple of five with
%
is the modulo operator which returns the remainder of an integer division. E.g.13 % 5 = 3
and13 / 5 = 2
because2 * 5 + 3 = 13
.clicks % 5
will be zero forclicks = 0, 5, 10, 15, ...