Reputation: 7678
How can I make a little line graph with .net like shown in the sites below?
or
( http://bandcamp.com/img/schwing.gif )
Thanks for your input.
Upvotes: 0
Views: 249
Reputation: 19881
Consideration: Graph must be drawn on UI thread, so how responsive do you want the graph (real-time or delayed)?
Layout a graph (I do this on paper) to determine X and Y ranges, limitations, etc. This will help you get a clear vision of what you want.
Putting this together without a way to test, but this might get you going in the right direction. I haven't ever created anything quite like a 'sparkline'.
Point newPoint;
Point lastPoint;
void SetNewPoint( Point NewPoint );
{
newPoint = NewPoint;
myPicBox.Refresh ( ); // include the Rectangle area to refresh
}
void myPicBox_Paint ( object sender, PaintEventArgs e)
{
// grab Graphics handle
// paint line from lastPoint to newPoint
// you will have to keep a collection of points if redrawing the entire graph
}
Upvotes: 0
Reputation: 505
These little line graphs are called sparklines - this is the keyword you need. There are plenty of ways, doing it on a client with jQuery or hacking ASP.NET Charting or even DYI with System.Drawing.
Upvotes: 3