Code Text Into Chart Lines?

  • Thread starter Thread starter Phil Hageman
  • Start date Start date
P

Phil Hageman

I have 39 charts in a workbook, where data value changes
cause movement of the lines on the charts. I use text
boxes to identify some of the data lines on the charts.
But as data values change, the text boxes stay in place
while the lines move - requiring manual repositioning of
the text box. This is out of control. How can I attach
text to a data line (coding?) such that it moves with the
line?

Thanks, Phil
 
Phil,

Attach data labels to your chart points.

If you want to use any text, it is quite tricky to do this manually. Using code you can do something like the following:

Set seSales = ActiveSheet.ChartObjects(1).Chart.SeriesCollection(1)
seSales.HasDataLabels = True
seSales.Points(2).DataLabel.Text = "Oranges"
 
John, Thanks for your response. I want to leave data
labels alone - they show a plotted value, say 100, 200,
etc. I would like to somehow attach text to the line that
says "Oranges". Another line could represent "Apples" etc.

Phil
-----Original Message-----
Phil,

Attach data labels to your chart points.

If you want to use any text, it is quite tricky to do
this manually. Using code you can do something like the
following:
 
Back
Top