Solved

Max,Min X-Coordinate

Posted on 2012-03-30
2
430 Views
Last Modified: 2012-04-16
I need to customize code in my vba project for creating charts and thus adjusting the x,y coordinates to fit the chart accordingly into the excel sheet.


for example say if the y coordinate value is exceeding the maximum value , if y=80 and the input is 85 then that difference of 5 will be squeezed in the design. How can I overcome this.
0
Comment
Question by:Moizsaif123
2 Comments
 
LVL 19

Accepted Solution

by:
Bardobrave earned 500 total points
ID: 37786841
Let's see.

Your chart will have a maximum height, and a maximum y value. The maximum height is a data you know (as you define how much space you will use on your view), while your maximum y value will depend in each load of the graph.

So... to make your values fit always on your defined height, you'll need to assign a correspondence between the space and the max values.

When you retrieve data you'd get the maximum y value on the dataset, then, through a simply mathematical rule, you can obtain the size of a unit on your graph:
total height --> maximum y
x --> single unit

x = (totalHeight * singleUnit) / maximum y

Once you know the maximum y value on your dataset you can recalculate the size of your graphs unit and redraw it.
0
 
LVL 4

Author Comment

by:Moizsaif123
ID: 37796698
I got a clear picture of the work needed. I have attached an image where the coordinates marked as (1,10) and (2,9) so the line is so short and now i want the space between the spaces where iv marked with arrows in the jpeg to not appear or to be filled.

so to fill the space the max,min of the y axis needs to be set as 10,9 so the line will be longer as well as the x-axis.

I need code to implement now the requirement is this. can I get an example of some code.
xy.jpg
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now