Solved

Max,Min X-Coordinate

Posted on 2012-03-30
2
465 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month4 days, 11 hours left to enroll

636 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