Solved

How do I Locate the position of a series and move a text box to it?

Posted on 2011-03-15
4
227 Views
Last Modified: 2012-08-13
I have a chart that has 8 different shapes I want to programatically move and resize.  To do this I think I need to know where the series are located on the chart so I can solve
Left Line - Center Line = Distance1
Center Line + Right Line = Distance2
and use these distance values to set the length of the arrows and the location of the center line to set the start location of the arrows.  I do not need to move these items along the Y-Axis, only the X- Axis.

What I don't know how to do is get the location of my series so I can calculate my distance values.

Below is what the chart is supposed to look like.
Correctly Formated Arrows

Below is what the chart looks like if the data for the Actual Elevation changes.  As you can see the arrows are not between the outermost left and right lines and starting from the center line.
Incorrectly Formated Arrows
0
Comment
Question by:Philippe217
  • 2
  • 2
4 Comments
 
LVL 41

Accepted Solution

by:
dlmille earned 500 total points
ID: 35184477
You can use an Excel4 macro to obtain the X,Y coordinate at any point in a series...

    XVal = ExecuteExcel4Macro("GET.CHART.ITEM(1,2,""S1P" & i & """)")
    yval = ExecuteExcel4Macro("GET.CHART.ITEM(2,2,""S1P" & i & """)")

Attached, I used a recent solution that plots math functions and added a routine to update the datalabels on the chart with their X,Y coordinates (not the data coordinates, but the coordinates you are looking for, I believe).

Is this sufficient for you to take it from here?

Cheers,

Dave
Equation-Charting-with-XY-Coordi.xls
0
 

Assisted Solution

by:Philippe217
Philippe217 earned 0 total points
ID: 35335398
Unfortunatly that didn't do what I needed it to do.

I've ended up converting the shapes into series and displaying their name as the lable and tying their start and end points to the value of the vertical lines while setting their position in the horizontal to a constant.
0
 
LVL 41

Assisted Solution

by:dlmille
dlmille earned 500 total points
ID: 35338701
ok - now, that's an approach.  You can also get the topleft, height, width, etc., from the active chart, then you can derive where the points are based on what point you're charting, normalizing to these chart dimensions, then put your shape there.  I probably should have suggested this route, first - I found a link on it, but was waiting for a response.  If you'd like that link let me know and I'll track it down.  Otherwise, if you have what you need, great!

dave
0
 

Author Closing Comment

by:Philippe217
ID: 35372886
I used my approach to solve this problem.  I can see how your appraoch works but I don't have time to figure out how to implement it.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

920 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

16 Experts available now in Live!

Get 1:1 Help Now