Generating charts and graphs without Excel
Hi
I'm trying to accomplish one of the following:
a) Generate charts and graphs in Excel without using any macros
or
b) Come up with a way to generate charts and graphs without using Excel at all.
Does anybody have any idea if that's possible and if there are any alternatives to using Excel?
Re: Generating charts and graphs without Excel
Welcome to VBForums :wave:
a) You can create a macro to do it, and then move the code from a macro into your program, see my Excel tutorial (link in my signature) for an explanation of how to do it.
b) Find/buy a component that does it (I recommend a search of our CodeBank/UtilityBank forums), or write your own.
3 Attachment(s)
Re: Generating charts and graphs without Excel
You're posting in VB6 and Earlier, so I'm not sure why you're asking about Excel here...
What are you actually after? A way to chart data and view it, some way to print charts?
The MSChart control (MSCHRT20.OCX) plots several basic kinds of charts and meets a lot of needs for things below publication grade images.
Re: Generating charts and graphs without Excel
If you run this sample in the VB6 IDE it may fail the first time with a "collating sequence" error. Just run it again.
This is a long-standing bug in the IDE itself when using certain MDAC/DAC components. It won't happen in a compiled program.
Re: Generating charts and graphs without Excel
kaam
In addition to the ways listed above, there is always the "brute force"
method, namely, use a PictureBox and the Line method. It takes a fair
amount of work, but you will have complete control over the look-and-feel
of the chart.
Spoo
Re: Generating charts and graphs without Excel
si_the_geek: my macros would look different each time. The spreadsheets I'm generating are based on 50+ collections and data from the access database that user entered previously into the program. A component that does what I need would be great. I did some research, but with no results.
dilettante: yes, I'm looking for a way to display charts and print them out too. Thank you for the sample.
spo: thank you, but the brute force method you described simply won't work. We're talking about a huge amount of coding, it's a large project.
Re: Generating charts and graphs without Excel
Quote:
Originally Posted by
kaamiljj
si_the_geek: my macros would look different each time. The spreadsheets I'm generating are based on 50+ collections and data from the access database that user entered previously into the program.
Without knowing how your current code works (and what you want to graph) I can't be sure, but there is a very good chance that you can use just one 'macro' with minor modifications.
However, depending on the circumstances using a separate component (like the one dilettante suggested) rather than Excel may be a better idea.
Re: Generating charts and graphs without Excel
If the users would all have Office installed... it includes a fancier chart component you can use from a VB6 program too. It can't be redistributed though.
Most charting controls have fairly complicated object models to learn.
Re: Generating charts and graphs without Excel
I made this bar chart using the shape control and some labels. It just takes a little arithmetic to set the height of the bars based on the data.
http://www.vbforums.com/images/ieimages/2007/04/1.gif
As you can see, I flunked all the comprehensive exams using random responses to the questions. :rolleyes: