Solved

Max,Min X-Coordinate

Posted on 2012-03-30
2
456 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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…

710 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