Bar Graph

Edwin

Registered User.
Local time
Today, 22:05
Joined
Dec 27, 2000
Messages
19
I came across this Time line db using a box that grows depending on timeline.

Can anyone tell me if it is possible to plot a value using a box that grows in accordance with the value?

This should serve as a replacement for bar graph or an alternative at that.

Please help.


Edwin
 
Thanks

Thank you,

But can i use this in a report to plot the value as an alternative for bar graph?

Regards,

Edwin
 
The example given is used with the on load property of the form.
So , set the on-open property of your report to fire off the progress bar.
 
Thanks

Thanks Rak,

What i need to show on the report is a plot of the value.
Say i have Outlet a with monthly income of 15000, Outlet B with 13000, Outlet C with 23000 and so on and so forth...

Instead of the value, what i would like to show is a bar graph that plots the corresponding value for each outlet.

The x axix of course will show the range from 0 to maximum value which is in this example 23000.

OUTLET 0..............................................23000
A ...............................
B ..........................
C ...............................................

Hope you could help me on this.

Thanks again.

Edwin
 
I have attached an example which might suit your purpose.
Look at the form FormBar , which gives you a sort of bar method calculating
the total of fieldtwo. You could copy this to your report.

Hope this helps.
 
Last edited:
tHANKS

i'll try that.

But i was hoping to get away with the MS Graph due to limitations and have an alternative like a customized bar chart.

Thanks
 
Try a box grow

I was hoping to plot the values by using a box that grows with the value.

I have a a field of OUtlets of 1500 records and corresponding monthly income.

I want to plot the monthly income using a customize bar graph while using a box control that grows its width in accordance with the monthly income value

I guess the scale would follow the maximum monthly income value of the said db.

Please help
 
Dynamic creation of rectangles as chart bars

Your problem is that you need to dynamically create the bar objects individually. Ugly but not impossible. However, dynamic control creation means that the sizing on your form ALSO needs to change. And you need to decide about labeling, which will also be dynamic.

Now, as to how to do it, there is such a thing as opening the "controls" collection of a form section and doing an .AddNew. When you define the control, you can make it a RECTANGLE. (Trust me...). Issues YOU must decide include scaling, labeling, color schemes, and other factors of visual presentation and aesthetics.

For each rectangle you create, you need to resize it according to your scaling data. So here is what you need to know.

Any rectangular object in Access has four critical properties that determine its size and location. These are .TOP and .LEFT (position of the top-left corner) and .HEIGHT and .WIDTH (should be obvious in meaning.) What is NOT so obvious is that the report section, being rectangular, ALSO has these properties. So you can determine the size of the section and then scale the rectangles accordingly. The way this works is a little kinky, though.

The .TOP and .LEFT are relative to the top, left corner of the section. So a rectangle that occupies the top, left corner has 0,0 for its ( .TOP, .LEFT ) properties. The sum of .TOP and .HEIGHT for any control cannot exceed the .HEIGHT of the section. Ditto, the sum of .LEFT and .WIDTH vs. section width.

If you do all of this in relative terms via simple ratio formulas, it hardly matters, but you should know that the size units are called TWIPS and that they are LONG integers. So to scale them involves finding the scaling ratio, converting that to TWIPS, and loading the result to the correct properties.

For instance, if you have a maximum of 10,000 in the thing you want to graph and it is currently at 8,700, you would perhaps compute the correct width as

rect.WIDTH = INT( maxTWIPS * 8700 / 10000 )

Or something close to that. Remember that the control is a LONG integer so you must end up with that data format. Further, negative width would not be good and if you were going to show 0 width, you would do better to not create the rectangle in the first place.

OK, next question: WHEN to do this? On a report, you have an OnFormat event that applies to a section. My best guess is that if you are going to do this on-the-fly, it would have to go into the section's OnFormat event routine.

Which means you need to read up on the following Access elements, all of which can be found in the help files:

Collections (in general) including examples of manipulating same
Report Sections and their properties
Controls (as a collection in a report or form section) and their properties
Rectangles and their properties
Label boxes (which might be how you would tag your bars) and their properties
OnFormat event in reports
Adding a Control
 

Users who are viewing this thread

Back
Top Bottom