LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.charting
PLP PLP is offline
external usenet poster
 
Posts: 5
Default chart "squaring"

I'm trying to "square" a chart...
I mean:
given 2 points (P1 and P2) with coordinates
P1(x1,y1) and P2(x2,y2), I want set the vertical (y) distance between P2 and
P1 equal to the horizontal distance between the points (on the monitor, in
pixels).

I start with a chart, and after drawing the chart (let's say with
..plotarea.width = k) I want resize it to fit my need.

From a matematichal point of view, the problem is very simple.
What I want is that:
(y2-y1)
-------- = 1
(x2-x1)

So (y2-y1) = (x2-x1).
Obviously you have to consider the value in pixel of both y2, y1 and x2,x1
pairs.
The distance in pixel is:
(y2-y1) =((y2actualvalue - y1actualvalue)* (.MaximumscaleY -
..MinimumscaleY))/.InsideHeight

I have to change the .plotarea.insidewidth, let's say from k to k'.
In excel vba language it should be something like this:

..PlotArea.InsideWidth = ((y2 -y1) * ActiveChart.PlotArea.InsideHeight *
(MaximumscaleX - MinimumscaleX)) / ((MaximumscaleY - MinimumscaleYs) *
(x2 -x1) )

(I know the formula is not correct, it's just to give you an idea; I wrote
the right formula in tha actual subroutine)

The problem is that I cannot change the .plotarea.insidewidth value but only
the .plotarea.widht value.
There is some relation between the .insidewidth and the .width value?
I tryed guessing width = .insidewidth + left but it does'nt work.....
Then I tryed with .insidewidth + 2 * left (maybe there is a right
also :-) ), but it doesn't work again.

The best result I reached so far is using a Do while... loop with a little
change in the width of just one pixel for time, and then verifying the new
(y2-y1)/(x2-x1) ratio.
Is quite good, but non perfect....
Any ideas?

Tkx

Pierluigi

:





 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I make a "tab name" the "chart title"? CurtG Charts and Charting in Excel 3 April 24th 23 03:44 AM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM
Complex if test program possible? If "value" "value", paste "value" in another cell? jseabold Excel Discussion (Misc queries) 1 January 30th 06 10:01 PM
Insert "-" in text "1234567890" to have a output like this"123-456-7890" Alwyn Excel Discussion (Misc queries) 3 October 25th 05 11:36 PM


All times are GMT +1. The time now is 07:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"