+ Reply to Thread
Results 1 to 8 of 8

Colors in a sunburst graph

  1. #1
    Valued Forum Contributor Eastw00d's Avatar
    Join Date
    02-29-2020
    Location
    Breda, NL
    MS-Off Ver
    2016, 2019
    Posts
    833

    Colors in a sunburst graph

    Hi all,
    Below I have a "standard" sunburst chart, where I want to do 2 things, 1 to create a ring or segment of the same color and/or 2, to create a color of an individual item, based on the cell content. I have got so far information that I know that the graph is handling points, but in this particular case the number of individual points does not go beyond 16 where Points.Count = 24. That puzzles me.
    In this case I want to have "Okt" in green and "-0,8" in red
    I probably am making a thinking error, but I failed to see where.
    Please Login or Register  to view this content.
    Please can you help me out?
    Cheers
    Erwin
    Attached Files Attached Files
    I started learning VBA because I was lazy ...
    Still developing.... being more lazy...

  2. #2
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,223

    Re: Colors in a sunburst graph

    I'm not familiar with charts properties.
    Just give it a try.


    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Valued Forum Contributor Eastw00d's Avatar
    Join Date
    02-29-2020
    Location
    Breda, NL
    MS-Off Ver
    2016, 2019
    Posts
    833

    Re: Colors in a sunburst graph

    Thank You Bo_Ry,
    This is something that I can work with.

    Have a blessed day!
    Cheers
    Erwin

  4. #4
    Valued Forum Contributor Eastw00d's Avatar
    Join Date
    02-29-2020
    Location
    Breda, NL
    MS-Off Ver
    2016, 2019
    Posts
    833

    Re: Colors in a sunburst graph

    Although the solution of Bo_Ry is satisfactory, it does not give an answer to my question about the datalabels
    pnts = Points.Count = 24, and t is stuck at 16 when it comes to address labels.
    When I assign colors only, regardless of labels it goes very well, see below, where in each of the Cells(1, t) is a certain Interior.Color.
    Please Login or Register  to view this content.
    But my goal is actually to "match" the datatable with the content of the DataLabels. I would expect that there are to be found 24 DataLabels.texts or .Captions and I cannot figure out why this gives an error at t = 16 in a line like:
    Please Login or Register  to view this content.
    additional information: somehow at t=16 (Jun) and t = 23 (Nov), the HasDataLabel value = False. How is that possible? What is the alternative?
    Please Login or Register  to view this content.
    Cheers
    Erwin
    Last edited by Eastw00d; 03-26-2021 at 04:57 PM. Reason: additional info

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

    Re: Colors in a sunburst graph

    In a sunburst there is only 1 series. The points depend on the relationships within the data. Your debug.print shows you that.
    There are 24 individual sectors within the whole chart.
    Cheers
    Andy
    www.andypope.info

  6. #6
    Valued Forum Contributor Eastw00d's Avatar
    Join Date
    02-29-2020
    Location
    Breda, NL
    MS-Off Ver
    2016, 2019
    Posts
    833

    Re: Colors in a sunburst graph

    Yes, I agree, but somehow I cannot "catch" Jun and Nov in the action debug.print, or when assigned to, in an array.
    This as purpose to have the data as input for a coloring-action.
    As like I want to say:
    Please Login or Register  to view this content.
    somehow at t=23 the graph does not recognize "Nov" as a DataLabel and that is what puzzles me. At this point, HasDataLabel is False. What is Nov than, if not a DataLabel?

    Cheers
    Erwin

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

    Re: Colors in a sunburst graph

    Because you have this line in the code
    Please Login or Register  to view this content.
    Increase the size of the chartobject and the missing data labels will appear.

    The difficult part is point 1 covers more that one point. it covers all the points related to it. The same is true for all but the outer layer of points.

  8. #8
    Valued Forum Contributor Eastw00d's Avatar
    Join Date
    02-29-2020
    Location
    Breda, NL
    MS-Off Ver
    2016, 2019
    Posts
    833

    Re: Colors in a sunburst graph

    Aha, thank you Andy, this solves the mystery.

    Cheers
    Erwin

+ 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. Graph Colors to match cell colors
    By hadoan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-25-2019, 02:11 AM
  2. Graph colors
    By csnyder10 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 04-20-2018, 05:07 PM
  3. Bar graph with just two colors
    By klturi421 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 11-22-2014, 12:42 AM
  4. Graph bar colors
    By dferguson in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 02-12-2014, 08:37 PM
  5. Fix the colors of a graph
    By Sabini in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 09-23-2013, 03:16 AM
  6. Bar graph won't change colors
    By maxthebear in forum Excel General
    Replies: 2
    Last Post: 09-28-2009, 12:59 PM
  7. bar graph colors?
    By anantathaker in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-17-2005, 11:48 AM

Tags for this Thread

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