+ Reply to Thread
Results 1 to 4 of 4

Automatic values of Y axis

  1. #1
    Registered User
    Join Date
    06-02-2017
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    12

    Automatic values of Y axis

    I have a stacked pivot chart that also uses a slicer that has three buttons.

    Depending on how the slicer is determining which data to use for the chart, the automatic Y axis values are as shown in the attached.

    Why is the Minimum value not set to zero, when the first button on the slicer is selected and how can I fix it so that the value is zero?

    The underlying data for the pivot table is in the range blank to 102.

    Due to the sensitive nature of the data, I cannot provide a copy of the workbook, sorry.

    Thanks
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    01-05-2013
    Location
    Singapore
    MS-Off Ver
    H&B2016 & H&B2021
    Posts
    3,060

    Re: Automatic values of Y axis

    Type "0" (without the double quotes) in the Minimum Bounds box and follow by the tab key.

  3. #3
    Registered User
    Join Date
    06-02-2017
    Location
    London, England
    MS-Off Ver
    2010
    Posts
    12

    Re: Automatic values of Y axis

    I can't do that because when the slicer is used to filter different areas of the data, a negative value is (rightly) included but is not shown correctly in the chart if the minimum value is set to zero.

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Automatic values of Y axis

    This article is the best I am aware of that explains how Excel's "auto" algorithm chooses axis limits: https://peltiertech.com/how-excel-ca...t-axis-limits/

    However, I'm not sure that really is much help here. However the "auto" algorithm works, MSFT gives us only two built in choices -- accept the auto axis limits or manually enter the axis limits we want. There are no built in options for an "auto" algorithm that is not the "auto" algorithm provided by Excel. In your case, you mostly like the "auto" algorithm, but not always. I expect that the scenarios where you don't like the auto algorithm occur frequently enough that you are unhappy needing to manually edit the axis limits in those situations.

    At this point, the only path forward that I'm aware of is to use a macro script of some kind. For your application, the script might simply need to check if the default "auto" algorithm chooses a value greater than 0 and forces the value to 0 in those cases. Otherwise, it would leave the "auto" selection checked. VBA has long been the preferred macro language (though that seems to be changing), so everything I know about these scripts would use VBA as the macro script language. These two tutorials might be more than necessary, but should allow you to see some of what is involved in a macro script that modifies chart axis limits:
    https://peltiertech.com/chart-udf-control-axis-scale/
    https://peltiertech.com/link-excel-c...lues-in-cells/
    I would add that most of the discussion I see pertains to regular charts. In some ways, pivot charts are their own animal, so you may need to explore how these ideas work with pivot charts.

    Before delving deeper, cost-benefit analysis. Is it worth the effort to continue? As tedious as it is, sometimes I prefer to just manually change the axis limits because I judge it is not worth the effort to automate it.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] How to set automatic axis
    By harim4 in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 08-27-2020, 01:21 PM
  2. Replies: 1
    Last Post: 09-19-2017, 12:55 PM
  3. Automatic Removal of X-Axis Categorical Values in a Bar Chart
    By megahuts in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 09-22-2010, 04:30 AM
  4. Replies: 8
    Last Post: 02-12-2009, 10:12 AM
  5. [SOLVED] How to insert X axis scale values next to axis and X axis grid lin
    By vp23larry in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 06-23-2005, 11:05 AM
  6. [SOLVED] Automatic axis format
    By jos in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 02-10-2005, 07:06 AM
  7. Automatic Change of X-axis
    By Jan in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 01-16-2005, 03:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1