Solved

Max,Min X-Coordinate

Posted on 2012-03-30
2
442 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

776 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