Home » Category » Microsoft Visual Basic

Microsoft Visual Basic: Zoom or expand a chart

200| Wed, 07 May 2008 12:27:00 GMT| jeff| Comments (0)
Dave,

Would you consider replacing the pictureboxes with other
components?

You may want to look first at controls specifically designed for
charting.
If you have a chart type which is not supported by charting controls
or if charting controls don't support the type of chart you want, then
you might consider an image creation control like MetaDraw.
Our MetaDraw control replaces picturebox and you can create
your chart in very similar fashion but with advantages of
- scrolling
- zooming
- hide / show diferent lines within chart
- allow users to select lines
( useful to show user additional information for
specific data segments )
- dynamically change colors, line thicknesses, etc
- save to variety of file formats
- high resolution printing.
- more

* * Please include a copy of this message with your reply

Jeff Bennett
Jeff...Bennet-Tec.Com

* Bennet-Tec Information Systems, Inc
* 50 Jericho Tpk, Jericho, NY 11753
* Phone 516 997 5596, Fax - 5597
* RELIABLE Components Make You Look Sharp!
* TList/Pro * ALLText HT/Pro * MetaDraw *
* Custom Software Development Services Too.
* WWW.Bennet-Tec.Com

=================== ===================

From: DaveO - view profile
Date: Tues, Mar 28 2006 9:41 am
Email: "DaveO" <jsinv......mweb.co.za>
Groups: microsoft.public.vb.general.discussion

Hi All

Using VB5 sp3 on WinXP Pro

My app has up to 10 charts / graphs on the form as follows :

Vertical scale = 1 to 100
each Horizontal scale has 6000 points

The data is read into arrays ( from a text file or database. )

Currently, I have a picture box inside a second picture box. I then use
the
picture2.line (x1, y1) - (x2, y2) method to draw the 6000 points on the

chart in picture2. I can then move picture2 inside picture1 to 'show' a

different part of the chart.

However, I need to be able to :
1. display different numbers of points ( eg. only the last 500 points,
or
only the last 1000 points of the graph ) - until now done by redrawing
the
entire chart.
2. when viewing the above segment, to be able to scroll the rest of
the
graph - can't be done with the current system - needs the chart (
picture2 )
to be wider than the container picture1.
3. also to zoom with a scroll bar.

I have set up 2 scroll bars. The first scroll bar changes the 'left'
position of picture2 ( inside picture1 ) so that the graph can scroll
horizontally.
But this does not allow for zooming, unless I change the .width of
picture2
and redraw all 6000 points.

The second scroll bar should be used to display the number of visible
points
( eg. picture2.width = picture1.width * ( 6000 / visiblePoints ) )

I have tried the following :
Draw the 6000 points into a hidden picture box.
Use stretchblt to 'copy' the hidden pic into the visible picture2. If I

change the size of picture2, I just re-stretchblt the hidden pic to the
new
resized pic.

Problem is : if I make the hidden pic the width of my form, then when I
zoom
into a smaller graph ( eg. the last 500 points ) the stretchblt
produces a
'chart' with lines as thick as a 2 x 4 plank. If I make the hidden pic
a lot
wider ( so a 500 point view is fine, & a 6000 point view is even finer
), it
bombs out from a lack of memory.

Obviously I am probably on the wrong track so need a bit of latteral
thinking here. Any suggestions ?

I need the solution to work on Win98+ systems.

Regards
Dave

Keywords & Tags: zoom, expand, chart, microsoft, visual basic, vb

URL: http://www.programmerbase.com/visual-basic/560763/
 
«« Prev - Next »» 0 helpful answers below.

Microsoft Visual Basic Hot Answers

Microsoft Visual Basic New questions

Microsoft Visual Basic Related Categories