I'm trying to paint a simple bar chart via C#
but I've never experimented with the Graphics and Drawing namespaces. I thought of generating a "start" and "end" graphic and then repeating an image somehow (to show a "length") but I have no idea how to do this.
I'd be really happy if you can point me in the right direction and/or if you have sample code to do this.
What's wrong with using a simple loop?
Based on reply from Paul Sasik, I've created a bit different simple bar-chart. I hope this might help others.
I've got to agree with Eros. There are lots of very good graphing libraries to accomplish what you want. The best I've come across:
why dont you give http://zedgraph.org/wiki/index.php?title=Main_Page a try. The time required to build (and test) your own graph controls will be too much
Alex, here is a very simple example to get you started. To test the code, just add a panel control to your form and create a paint event handler for it. (Double click on the panel in the designer should do it by default.) Then replace the handler code with th code below.
The code draws five bars of arbitrary length across the panel and the bar widths and heights are related to the panel widths and heights. The code is arbitrary but is a good and simple way to introduce .Net drawing capabilities.