Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.charting
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can I make a "tab name" the "chart title"? | Charts and Charting in Excel | |||
HELP on "left","right","find","len","substitute" functions | Excel Discussion (Misc queries) | |||
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next | New Users to Excel | |||
Complex if test program possible? If "value" "value", paste "value" in another cell? | Excel Discussion (Misc queries) | |||
Insert "-" in text "1234567890" to have a output like this"123-456-7890" | Excel Discussion (Misc queries) |