View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rafael Guerreiro Osorio Rafael Guerreiro Osorio is offline
external usenet poster
 
Posts: 27
Default Proportional Chart

Hi Cody,

You didn't provide enough information, playing with charts can be tricky...

But, assuming:

1) Your scatter is the only chartobject in a worksheet
2) You are plotting only positive values
3) your data is in the same worksheet

the code below, copied to the worksheet code page, will update the scales of
the chart whenever values change:

Private Sub Worksheet_Change(ByVal Target As Range)

With ActiveSheet.ChartObjects(1).Chart
'Autoscale axes first
.Axes(1).MaximumScaleIsAuto = True
.Axes(2).MaximumScaleIsAuto = True
.Refresh

'Make both equal to highest
If .Axes(1).MaximumScale .Axes(2).MaximumScale Then
.Axes(2).MaximumScale = .Axes(1).MaximumScale
Else
.Axes(1).MaximumScale = .Axes(2).MaximumScale
End If
End With
End Sub

Best,

Rafael

"Cody" wrote:

My request is that the chart autoscale to my data but scale is such a manner
that x and y increments are equivalent. I am plotting objects so a unit
length in x must visually equal a unit length in y.

Hope that is clearer.


"Tushar Mehta" wrote:

I don't understand what appears to be a contradictory requirement of
"like the chart to auto-scale" and "force the scaling"

In any case, use the macro recorder to get the code for what you want.
Use Tools | Macro Record new macro... do whatever it is you want and
turn off the recorder. XL will give you the necessary code that you
can then customize / generalize.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
I am using a chart to visibly create an object. I would like to force the
scaling of the chart (xy scatter) to always be equivalent units (of length in
my case) in both axis directions. I like the chart to auto-scale for size
but if the chart scales different for each direction then my objects are
skewed.

If anyone has code ideas or suggestions I would greatly appreciate any help
I can get.

Thanks,

Cody