+ Reply to Thread
Results 1 to 10 of 10

Converting Column Object to Line Object Issue

  1. #1
    Registered User
    Join Date
    07-06-2009
    Location
    Ottawa, Canada
    MS-Off Ver
    Excel 2007
    Posts
    10

    Converting Column Object to Line Object Issue

    Hi there,

    I've created an Excel 2007 application that automatically creates a chart based on input by a user. A feature of this application is that the user can specify if a data series is to be represented as a line object or column object when creating a Line-Column chart. The feature is available when the user want to update an existing Line-Column chart.

    The problem is that when the user wants to switch from a column object to a line object, the corresponding colour of the object is not maintained. It seems like during the process of altering the data series chart type from column to line, MS Excel applies a generic colour. However, when the data series goes from a line object to a column object, there is no issue.

    Does anyone have any ideas as to why this is happening?

    Thanks.

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

    Re: Converting Column Object to Line Object Issue

    How are you changing chart type?

    The line should retain the column series Border colour as it's line colour.

    Do you have Office SP2 installed?
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    07-06-2009
    Location
    Ottawa, Canada
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Converting Column Object to Line Object Issue

    Quote Originally Posted by Andy Pope View Post
    How are you changing chart type?

    The line should retain the column series Border colour as it's line colour.

    Do you have Office SP2 installed?
    I'm simply setting the series collection's chart type property from xlColumnClustered to xlLine. My tool's requirements specify that column objects should have no border, but I am reapplying the appropriate colour afterwards in a separate subroutine. I am running Excel 2007 SP2.

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

    Re: Converting Column Object to Line Object Issue

    But if your column has no border what colour should it use when switching to line. I assume excel just takes a stab at a colour perhaps using the automatic default colours.

  5. #5
    Registered User
    Join Date
    07-06-2009
    Location
    Ottawa, Canada
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Converting Column Object to Line Object Issue

    I have a subroutine called "SeriesColorAllocation" which assigns a client-specified list of colors to my data series objects (i.e., line, column, area) based on their position on the worksheet. The subroutine is called after the data series' chart object has been changed. The main color assignment logic is as follows:

    Please Login or Register  to view this content.
    The "garrColorPalette" array object stores the RGB values specified by the client.

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

    Re: Converting Column Object to Line Object Issue

    Sorry I'm confused now.

    If you are coding all this can you not add code to set the colors you need?

    Or is the problem that the setting of colours is not working?

  7. #7
    Registered User
    Join Date
    07-06-2009
    Location
    Ottawa, Canada
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Converting Column Object to Line Object Issue

    My apologies for the confusion. Yes, the setting of the colors does not work for the specific instance whereby the user wants to switch from the current column object to the desired line object.

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

    Re: Converting Column Object to Line Object Issue

    Try this

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    07-06-2009
    Location
    Ottawa, Canada
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: Converting Column Object to Line Object Issue

    That worked!! Yay!!!

    So does that mean that MS Excel applies two levels of coloring to objects with one layer being more prominent than that other (hence setting transparency level to 0)?

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

    Re: Converting Column Object to Line Object Issue

    It's more to do with the new object model written for charts.

    Unfortunately the order of setting properties and which ones need setting is not automatic or even logical.
    Specifying a colour for the line should automatically make the line visible but it seems changing from automatic to custom colour leaves some properties unset or worst changed. So you have to apply them explicitly.

    It all adds to the joy of chart programming.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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