ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can you query a graph? (https://www.excelbanter.com/excel-programming/299476-can-you-query-graph.html)

Don Wiss

Can you query a graph?
 
Sometimes (on the Y-Axis) Excel will give you an extra tick mark above and
beyond the tick above the highest data point. (An empty band.) I would
rather it not do this. Nor do I want to completely calculate and build the
scale myself. There is one instance where it would be nice if I could
automatically correct this. The data data never goes above 1. Can I query
the graph somehow and see what maximum tick value it plans to use, and if
greater than 1 change the max value to 1?

If I could also query the tick major unit, I could then see when it has the
empty band and set a maximum value to not include it.

Or is there some simple solution and a property I could set to not allow an
empty band?

Thnaks, Don <donwiss at panix.com.

Jon Peltier[_7_]

Can you query a graph?
 
Don -

To get the maximum on the Y axis:

ActiveChart.Axes(xlvalue, xlprimary).maxumumscale

To get the tick spacing:

ActiveChart.Axes(xlvalue, xlprimary).majorunit.

Compare maxumumscale and maximumscale - major unit to your data. If the
lower still exceeds your data, run sthg like this:

with activechart.axes(xlvalue, xlprimary)
.maxumumscale = .maximumscale - .majorunit
End With

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______


Don Wiss wrote:

Sometimes (on the Y-Axis) Excel will give you an extra tick mark above and
beyond the tick above the highest data point. (An empty band.) I would
rather it not do this. Nor do I want to completely calculate and build the
scale myself. There is one instance where it would be nice if I could
automatically correct this. The data data never goes above 1. Can I query
the graph somehow and see what maximum tick value it plans to use, and if
greater than 1 change the max value to 1?

If I could also query the tick major unit, I could then see when it has the
empty band and set a maximum value to not include it.

Or is there some simple solution and a property I could set to not allow an
empty band?

Thnaks, Don <donwiss at panix.com.




All times are GMT +1. The time now is 03:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com