<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Label Each Series in a Chart</title>
	<atom:link href="http://peltiertech.com/WordPress/label-each-series-in-a-chart/feed/" rel="self" type="application/rss+xml" />
	<link>http://peltiertech.com/WordPress/label-each-series-in-a-chart/</link>
	<description>Peltier Tech Excel Charts and Programming Blog</description>
	<lastBuildDate>Fri, 19 Mar 2010 16:32:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: Jeff Weir</title>
		<link>http://peltiertech.com/WordPress/label-each-series-in-a-chart/comment-page-1/#comment-26852</link>
		<dc:creator>Jeff Weir</dc:creator>
		<pubDate>Thu, 11 Feb 2010 18:10:27 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=714#comment-26852</guid>
		<description>THanks Jon, that&#039;s a great work-around.</description>
		<content:encoded><![CDATA[<p>THanks Jon, that&#8217;s a great work-around.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://peltiertech.com/WordPress/label-each-series-in-a-chart/comment-page-1/#comment-26838</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Thu, 11 Feb 2010 11:59:42 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=714#comment-26838</guid>
		<description>Jeff -

That&#039;s the way data labels work. A label is always at the ith point, so if you remove j points at the beginning of the series, the label sticks to what is now the ith point, but which was the (i+j)th point.

If you need the label to stick to a given XY value in a dynamic setting, you should use a hidden series with points to anchor labels (one custom XY point per label). To keep the last point labeled in a dynamic setting, use a dynamic pair of XY values for that point&#039;s label. No need for VBA.</description>
		<content:encoded><![CDATA[<p>Jeff -</p>
<p>That&#8217;s the way data labels work. A label is always at the ith point, so if you remove j points at the beginning of the series, the label sticks to what is now the ith point, but which was the (i+j)th point.</p>
<p>If you need the label to stick to a given XY value in a dynamic setting, you should use a hidden series with points to anchor labels (one custom XY point per label). To keep the last point labeled in a dynamic setting, use a dynamic pair of XY values for that point&#8217;s label. No need for VBA.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Weir</title>
		<link>http://peltiertech.com/WordPress/label-each-series-in-a-chart/comment-page-1/#comment-26828</link>
		<dc:creator>Jeff Weir</dc:creator>
		<pubDate>Thu, 11 Feb 2010 09:07:59 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=714#comment-26828</guid>
		<description>I just realised that positioning the data labels to the far right of the graph won&#039;t work unless you use some VBA to adjust their vertical height in relation to the last datapoint shown for whatever x is selected.</description>
		<content:encoded><![CDATA[<p>I just realised that positioning the data labels to the far right of the graph won&#8217;t work unless you use some VBA to adjust their vertical height in relation to the last datapoint shown for whatever x is selected.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Weir</title>
		<link>http://peltiertech.com/WordPress/label-each-series-in-a-chart/comment-page-1/#comment-26827</link>
		<dc:creator>Jeff Weir</dc:creator>
		<pubDate>Thu, 11 Feb 2010 09:04:05 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=714#comment-26827</guid>
		<description>Hi Jon. Just found some interesting behaviour using the Label Last Point macro. I&#039;ve got a dynamic series set up to display x number of years of a time series. When I set x to 10 years and run the macro, I get this:
http://screencast.com/t/MWIzYjYzM

When I change x to 20 years, I get this:
http://screencast.com/t/OTcxZDYw

I can see what&#039;s going on here...by changing x then I&#039;m effectively introducing new points into the graph after the originally labelled points. So I guess I could either make the macro re-run on change of x, or maybe position the data labels to the far right of the graph, albeit with the same verticle position of the data points. 

Any thoughts on these approaches?

On an related note, I&#039;m displaying the last x years of the series, and instead of using the normal offset function you cover in your posts I&#039;m using this: =OFFSET(HLFS!$A$1,,MATCH(LastCell,HLFS!$1:$1)-1,1,-year_input-1)

...where lastcell is the named formula =9.99999999999999E+307 (i.e. I&#039;m using the bignum approach). 

This works a treat if you always want your series to finish at the last entry of the row. The usual COUNTA arguement instead of MATCH  wouldn&#039;t work in my specific case, because some series have several blanks in the rows, which would through the offset off by the number of blank cells.

You ever do a blog post on bignum?

Cheers

Jeff</description>
		<content:encoded><![CDATA[<p>Hi Jon. Just found some interesting behaviour using the Label Last Point macro. I&#8217;ve got a dynamic series set up to display x number of years of a time series. When I set x to 10 years and run the macro, I get this:<br />
<a href="http://screencast.com/t/MWIzYjYzM" rel="nofollow">http://screencast.com/t/MWIzYjYzM</a></p>
<p>When I change x to 20 years, I get this:<br />
<a href="http://screencast.com/t/OTcxZDYw" rel="nofollow">http://screencast.com/t/OTcxZDYw</a></p>
<p>I can see what&#8217;s going on here&#8230;by changing x then I&#8217;m effectively introducing new points into the graph after the originally labelled points. So I guess I could either make the macro re-run on change of x, or maybe position the data labels to the far right of the graph, albeit with the same verticle position of the data points. </p>
<p>Any thoughts on these approaches?</p>
<p>On an related note, I&#8217;m displaying the last x years of the series, and instead of using the normal offset function you cover in your posts I&#8217;m using this: =OFFSET(HLFS!$A$1,,MATCH(LastCell,HLFS!$1:$1)-1,1,-year_input-1)</p>
<p>&#8230;where lastcell is the named formula =9.99999999999999E+307 (i.e. I&#8217;m using the bignum approach). </p>
<p>This works a treat if you always want your series to finish at the last entry of the row. The usual COUNTA arguement instead of MATCH  wouldn&#8217;t work in my specific case, because some series have several blanks in the rows, which would through the offset off by the number of blank cells.</p>
<p>You ever do a blog post on bignum?</p>
<p>Cheers</p>
<p>Jeff</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://peltiertech.com/WordPress/label-each-series-in-a-chart/comment-page-1/#comment-15220</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Tue, 16 Jun 2009 21:04:34 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=714#comment-15220</guid>
		<description>Barrett -

I turned on the macro recorder while making some minor adjustments and came up with this modified procedure (note the red text). It doesn&#039;t do the number format, since it assumes the series name is a string, but if you format the series names the way you want, it should work.

&lt;pre class=&quot;vbasmall&quot;&gt;Sub LabelLastPoint()
  Dim mySrs As Series
  Dim iPts As Long
  Dim bLabeled As Boolean
  If ActiveChart Is Nothing Then
    MsgBox &quot;Select a chart and try again.&quot;, vbExclamation
  Else
    For Each mySrs In ActiveChart.SeriesCollection
      bLabeled = False
      With mySrs
        For iPts = .Points.count To 1 Step -1
          If bLabeled Then
            &#039; handle error if point isn&#039;t plotted
            On Error Resume Next
            &#039; remove existing label if it&#039;s not the last point
            mySrs.Points(iPts).HasDataLabel = False
            On Error GoTo 0
          Else
            &#039; handle error if point isn&#039;t plotted
            On Error Resume Next
            &#039; add label
            mySrs.Points(iPts).ApplyDataLabels _
                ShowSeriesName:=True, _
                ShowCategoryName:=False, ShowValue:=False, _
                AutoText:=True, LegendKey:=False
&lt;font color=&quot;red&quot;&gt;            With mySrs.Points(iPts).DataLabel
              .Position = xlLabelPositionCenter
              .Orientation = xlUpward
            End With&lt;/font&gt;
            bLabeled = (Err.Number = 0)
            On Error GoTo 0
          End If
        Next
      End With
    Next
    ActiveChart.HasLegend = False
  End If
End Sub
&#160;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Barrett -</p>
<p>I turned on the macro recorder while making some minor adjustments and came up with this modified procedure (note the red text). It doesn&#8217;t do the number format, since it assumes the series name is a string, but if you format the series names the way you want, it should work.</p>
<pre class="vbasmall">Sub LabelLastPoint()
  Dim mySrs As Series
  Dim iPts As Long
  Dim bLabeled As Boolean
  If ActiveChart Is Nothing Then
    MsgBox "Select a chart and try again.", vbExclamation
  Else
    For Each mySrs In ActiveChart.SeriesCollection
      bLabeled = False
      With mySrs
        For iPts = .Points.count To 1 Step -1
          If bLabeled Then
            ' handle error if point isn't plotted
            On Error Resume Next
            ' remove existing label if it's not the last point
            mySrs.Points(iPts).HasDataLabel = False
            On Error GoTo 0
          Else
            ' handle error if point isn't plotted
            On Error Resume Next
            ' add label
            mySrs.Points(iPts).ApplyDataLabels _
                ShowSeriesName:=True, _
                ShowCategoryName:=False, ShowValue:=False, _
                AutoText:=True, LegendKey:=False
<font color="red">            With mySrs.Points(iPts).DataLabel
              .Position = xlLabelPositionCenter
              .Orientation = xlUpward
            End With</font>
            bLabeled = (Err.Number = 0)
            On Error GoTo 0
          End If
        Next
      End With
    Next
    ActiveChart.HasLegend = False
  End If
End Sub
&nbsp;</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Barrett</title>
		<link>http://peltiertech.com/WordPress/label-each-series-in-a-chart/comment-page-1/#comment-15213</link>
		<dc:creator>Barrett</dc:creator>
		<pubDate>Tue, 16 Jun 2009 17:28:43 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=714#comment-15213</guid>
		<description>Hi Jon,

I&#039;m wondering how to rotate the data labels 270 degrees using vba, as well as format the data labels to a certain category (Accounting), with 0 decimal places.

Even when I do this manually to a data label, I then have to move the label down so it lays within the column of data.  I&#039;m sure there is a way to do this as well, but am at a loss.

Thanks!</description>
		<content:encoded><![CDATA[<p>Hi Jon,</p>
<p>I&#8217;m wondering how to rotate the data labels 270 degrees using vba, as well as format the data labels to a certain category (Accounting), with 0 decimal places.</p>
<p>Even when I do this manually to a data label, I then have to move the label down so it lays within the column of data.  I&#8217;m sure there is a way to do this as well, but am at a loss.</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: LEM</title>
		<link>http://peltiertech.com/WordPress/label-each-series-in-a-chart/comment-page-1/#comment-8037</link>
		<dc:creator>LEM</dc:creator>
		<pubDate>Thu, 08 Jan 2009 18:14:37 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=714#comment-8037</guid>
		<description>Thank you Jon!  And I appreciate your quick response!!</description>
		<content:encoded><![CDATA[<p>Thank you Jon!  And I appreciate your quick response!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://peltiertech.com/WordPress/label-each-series-in-a-chart/comment-page-1/#comment-8034</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Thu, 08 Jan 2009 16:56:22 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=714#comment-8034</guid>
		<description>LEM -

You need to change one line of code:

&lt;pre class=&quot;vba&quot;&gt;    &#039; add label
    mySrs.Points(iPts).ApplyDataLabels AutoText:=True, _
        LegendKey:=False, ShowSeriesName:=True, ShowValue:=True, _
        Separator:=&quot;&quot; &amp; Chr(10) &amp; &quot;&quot;&lt;/vba&gt;

Chr(10) puts the value onto a new line, that is, separates it with a line feed (ASCII character 10). A little testing shows you can use any string you want, even multiple characters as the separator. I tried these and all did as expected:

Separator:=&quot;, &quot;
Separator:=&quot; - &quot;
Separator:=&quot; ### &quot;</description>
		<content:encoded><![CDATA[<p>LEM -</p>
<p>You need to change one line of code:</p>
<pre class="vba">    ' add label
    mySrs.Points(iPts).ApplyDataLabels AutoText:=True, _
        LegendKey:=False, ShowSeriesName:=True, ShowValue:=True, _
        Separator:="" &#038; Chr(10) &#038; ""

Chr(10) puts the value onto a new line, that is, separates it with a line feed (ASCII character 10). A little testing shows you can use any string you want, even multiple characters as the separator. I tried these and all did as expected:

Separator:=", "
Separator:=" - "
Separator:=" ### "</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: LEM</title>
		<link>http://peltiertech.com/WordPress/label-each-series-in-a-chart/comment-page-1/#comment-8032</link>
		<dc:creator>LEM</dc:creator>
		<pubDate>Thu, 08 Jan 2009 16:02:26 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=714#comment-8032</guid>
		<description>Hello Jon,

I have entered this into a workbook, and I am getting the series name, but I was wondering how to alter the code so that I can have the series name and the value.  Any help would be greatly appreciated!

Thanks!</description>
		<content:encoded><![CDATA[<p>Hello Jon,</p>
<p>I have entered this into a workbook, and I am getting the series name, but I was wondering how to alter the code so that I can have the series name and the value.  Any help would be greatly appreciated!</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://peltiertech.com/WordPress/label-each-series-in-a-chart/comment-page-1/#comment-5811</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Sat, 01 Nov 2008 00:07:39 +0000</pubDate>
		<guid isPermaLink="false">http://peltiertech.com/WordPress/?p=714#comment-5811</guid>
		<description>Stružák - 

Good point. I usually remember. In this case it probably wouldn&#039;t make too much difference, but it&#039;s a good habit to get into.</description>
		<content:encoded><![CDATA[<p>Stružák &#8211; </p>
<p>Good point. I usually remember. In this case it probably wouldn&#8217;t make too much difference, but it&#8217;s a good habit to get into.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
