سؤال

In previous versions of Excel there was a registry entry that you could create to allow Excel to display values/labels that would be positioned outside the axis min/max using QFE_Bonn dword=1. This is what I have used for Excel 2003: Plot lines that contain labels disappear ...)

I have not been able to find a similar patch or native functionality in Excel 2010 (Office Pro Plus). Any ideas how this can be accomplished, or did MS remove this functionality altogether?

Here are screenshots of examples in Excel 2003. I create a series of data which uniformly exceeds the y-axis maximum. This series' color fill has been removed already

Excel screenshot

To finish the look, remove the series' border so that it appears invisible. Then replace the series' value labels with the relevant data.

هل كانت مفيدة؟

المحلول

There is a workaround using the DataLabels.Left property which positions the DataLabel relative to the ChartArea.

Here is an example VB solution:

sub FakeLabels()
Dim sF As Double
Dim lOff As Double
Dim p As Double

ActiveSheet.ChartObjects(1).Activate

With ActiveChart
    For sF = 1 To .SeriesCollection.Count
        If .SeriesCollection(sF).Name = "FakeSeries" Then
             'Define the lOff variable by adding 100, or some other value
             lOff = .SeriesCollection(sF).Points(1).DataLabel.Left + 100
             For p = 1 To .SeriesCollection(sF).Points.Count
                 .SeriesCollection(sF).Points(p).DataLabel.Left = lOff               
             Next p
        End If
    Next sF
End With

It yields the same results, the only new requirement is to keep the values for the "dummy" series within the axis min/max values for the chart.

A pleasant surprise is that re-sizing the chart doesn’t appear to affect the relative placement of the labels.

UPDATED 9-25-2013

I have used the "textbox" approach since first asking this question. But it is extremely clunky to manage the interplay between the labels' position and the textbox positions, their relative position of the PlotArea i.e., when to use .InsideWidth vs. .Width or .InsideLeft vs. .Left and whether there needs to be any sort of hedonic "adjustments" to the points values, as always seem to be the case, they are never quite perfectly aligned.

While perusing the PPT object model reference for some other chart-related inquiries, I stumbled upon this property which appears to replicate the functionality of the previous hotfix/registry hack.

.ShowDataLabelsOverMaximum

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top