I have daily numbers stored in a table. I can use a stored procedure to pull the data. My supervisor has asked me to add a button to my system that will display a line chart reflecting trends in those numbers.
I'm not sure where to start. Can anyone help with this?
RiverGuy is GDI+ happy, and much more experienced with it than I am. But using the CR wizard, you could have a report put together in pretty short order. and a Crystal Report Viewer is just a matter of adding a control to a form, like a text box or any other control. It's all included in .Net.
On the otherhand, I was thinking about swaping some of out web based reports (currently in CR) to be code based, so if you do find some nice tricks for using the GDI to create your charts, I may be interested in your code
The thing I don't like about CR is that it "looks like a report." I mean that it looks like something that is to be printed--you can't mesh it very easily with the flow of your application GUI. It's great for actual reports, but not for just one chart.
There are also companies out there that make .Net charting components. You might do a search for them. I'm not sure if they are free or not.
Rick, read this. It's not a line chart, but its got the concepts of using GDI+. Its in ASP.Net, but the code is portable to WinForms.
The MicroSoft Chart Control has a wide variety of graphing options available, ready-made, such as bar/pictograph, line, area, step, combination, pie, XY(scatter) graphs, and so on. Axes and labels can be customized.
One catch, the MSChart control is NOT automatically in the toolbox of VB.net, even though it is available and free.
To add the control in the toolbox, you'd have to do the following standard procedure:
1. Open the customize toolbox dialog.
2. Select the COM components tab, and scroll down until the Microsoft Chart Control 6.0 (SP4) (OLEDB) appears. Check the check box associated with the control. Click the OK button to add the MSChart control to the toolbox.
If the MSChart control together with its many features work for you, then you could leave CR and GDI+ to do some more serious tasks.
When a beginner who has VB6 experience first time opens .NET and just going about making a form up he/she could notice there is no Line in the .NET toolbox. What happened, where did it go?
There is a difference from VB6 forms that Windows Forms .NET does not support the Line control.
The Line class is based on System.Drawing namespace that provides access to GDI+ basic graphics functionality. A Line control is a graphical control that displays a horizontal, vertical, or diagonal one-pixel-wide line that can't be changed directly. The Line control can be changed dynamically at run time.
The control class Line that is implemented in both languages (VB.Net and C#) is derived from System.Windows.Forms.Control. It overrides the OnPaint method to draw itself. The class will draw the line depending on its properties.
Line controls can be displayed on forms, in picture boxes, and in another visual controls. You can move or resize your Line object by altering its X_Left, X_Right, Y_Left, and Y_Right properties. Also you can setup its Color property.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.