473,404 Members | 2,195 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Unneeded line after drawing graph on picture box

Mas Juliza Alias
Hi,
I have a problem with the graph I drawn on a picture box for quite a while. I have two curves, elevation-storage and elevation-area curves which need to be drawn on a single graph. I managed to draw it nicely if the curves are drawn separately, but somehow when the curves are merged together (by merging the same codes as they are drawn separately) there is an unneeded line appears diagonally from min value to the max value of x,y. How can I eliminated it? Attached is the project I coded so far. Your help is highly appreciated. Thank You.
Attached Files
File Type: zip graph.zip (6.4 KB, 148 views)
Mar 8 '12 #1

✓ answered by Guido Geurs

You are using the command = picture1.line -(...) !
The string "-" is for the function=

Step= Optional.Keyword specifying that the starting point coordinates are relative to the CURRENT graphics position given by the CurrentX and CurrentY properties.

The last thing you have done BEFORE to start drawing the graphic line is setting the X line for "Area".
So the last coordinates are in the right-upper corner.
The first point of the data = (0,0).
With the command .line -(0,0) you are drawing a line from the upper-right corner to 0,0.

So before you start drawing the curves, you have to reset the CurrentX and CurrentY.

Expand|Select|Wrap|Line Numbers
  1. Sub AreaGraph()
  2. Dim j As Integer
  3.    'area curve
  4.    With Form1.Picture1
  5.       .CurrentX = 0
  6.       .CurrentY = 0
  7.    End With
  8.    With Form1.MSFlexGrid1
  9.       For j = 1 To .Rows - 1
  10.          Form1.Picture1.Line -(.TextMatrix(j, 1), .TextMatrix(j, 0)), vbGreen
  11.       Next
  12.    End With
  13. End Sub
Also attached is your code with some modifications in calling the subroutines.

2 2270
Guido Geurs
767 Expert 512MB
You are using the command = picture1.line -(...) !
The string "-" is for the function=

Step= Optional.Keyword specifying that the starting point coordinates are relative to the CURRENT graphics position given by the CurrentX and CurrentY properties.

The last thing you have done BEFORE to start drawing the graphic line is setting the X line for "Area".
So the last coordinates are in the right-upper corner.
The first point of the data = (0,0).
With the command .line -(0,0) you are drawing a line from the upper-right corner to 0,0.

So before you start drawing the curves, you have to reset the CurrentX and CurrentY.

Expand|Select|Wrap|Line Numbers
  1. Sub AreaGraph()
  2. Dim j As Integer
  3.    'area curve
  4.    With Form1.Picture1
  5.       .CurrentX = 0
  6.       .CurrentY = 0
  7.    End With
  8.    With Form1.MSFlexGrid1
  9.       For j = 1 To .Rows - 1
  10.          Form1.Picture1.Line -(.TextMatrix(j, 1), .TextMatrix(j, 0)), vbGreen
  11.       Next
  12.    End With
  13. End Sub
Also attached is your code with some modifications in calling the subroutines.
Mar 9 '12 #2
problem solved. Thank YOU!
Apr 24 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Frank | last post by:
I've written a jsp that retrieves data from a sybase table via the sql JSTL. Two colums of data are returned, date and value. Currently the data is placed in an HTML table. Does anyone know of...
8
by: Andrew Poulos | last post by:
Is there a small graphics library that I can use? All I need to do is draw a line of a nominated thickness and colour between two specified points and to, at some later time, "delete" the line? ...
0
by: Tomi Holger Engdahl | last post by:
I am looking for a solution to add on-line drawing tool to a phpBB discussion board. The idea would be that the users can draw their own simple drawings with the tool and attach them easily as...
1
by: Anupam Soni CMC Ltd. | last post by:
Hi All, I have drawn Pie/Bar using some values now I want to capture any segment of Pie or Block of Bar graph if user click on that area. Plz suggest how can I do that . I have to show...
1
by: gsidhu | last post by:
I need to know the midpoint line drawing program to draw lines in all the eight directions.
10
by: James Stroud | last post by:
Hello All, I'm looking for a program to do line-drawings in 3d, with output to postscript or svg or pdf, etc. I would like to describe a scene with certain 1-3d elements oriented in 3d space...
2
by: mattc66 via AccessMonster.com | last post by:
Does anyone know of some simple line drawing add-on apps. I just need to be able to do some simple line drawing with dims. 4 walls and a door and allow the user to type the dims for the walls. All...
11
by: ravindarjobs | last post by:
hi friends, i have just moved from vba to java. i am quite new to java. but unexpectedly i was given a task to build a chart for a table stored in oracle database. we have to use only swings...
1
by: kuttipullaiamlukuku | last post by:
I need to draw graph in .net windows application... please any one help me.... thanks in advance.
1
by: DBC User | last post by:
Hi all, I would like to see if it is possible to draw unrooted and rooted tree in c#, I checked the zedgraph and it is only like line, bar or chart not a free form graphs. Is it possible to do...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.