+ Reply to Thread
Results 1 to 4 of 4

Move data label relatively

  1. #1
    Registered User
    Join Date
    02-17-2012
    Location
    Tumbuctu
    MS-Off Ver
    Excel 2007
    Posts
    3

    Move data label relatively

    Hi all,

    I am doing a stacked bar chart and i want to place data labels in a position relatively to the size of the bar is reffering.

    i am trying to do something like this:

    Please Login or Register  to view this content.
    This code will be inside a loop.

    Thanks!!

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,437

    Re: Move data label relatively

    The points in a series do not have left/top properties.

    Can you not use one of the built in data label positions?

    Would it make it clear to us if you posted a workbook example with a data label manually positioned where you want it and the explanation of why that position.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    04-07-2004
    Posts
    8

    Re: Move data label relatively

    Here's a snippet from a macro that works on xy scatter charts. I don't know what it will do with bar charts, though.
    With .Points(j)
    .ApplyDataLabels Type:=xlShowValue, LegendKey:=False
    With .DataLabel
    .Characters.Text = "sometext"
    If XL2007 Then .Select
    .Left = .Left - 5
    .Top = .Top - 6
    End With '\datalabels
    End With '\.points

    Brian in Austin, Texas

  4. #4
    Registered User
    Join Date
    02-17-2012
    Location
    Tumbuctu
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Move data label relatively

    Hi all,

    the problem is that i am trying to improve with macros a waterfall chart, and i need that datalabels look something like this:

    positivos.PNG

    and in case that values are negative, this will be the final look.

    negativos.PNG

    My first idea was to get the distance from the top of the bar to the top of chartarea and then calculate the new position of datalabels, but that obviously did not work.

    At this point i am blocked with this, but i think that it does not have to be so difficult.

    Thank you guys.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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