Colors for chart

David Thielen 61 Reputation points
2021-02-26T00:36:15.637+00:00

Hi;

I'm in some code written years ago to render the charts in OpenXML. There's some code that, if there is no references colors.xml file for a chart, it uses some hard-coded color settings. For the chart line/bar colors themselves it uses accent1, accent2, etc. which appears to be correct. This is illustrated in the file ATE-4657.docx.

However, it also applies shade, tint, lumMod/Off to various values and that appear to be incorrect.

And it's got several different sets of transforms, that are set based on the <c:style val=""/> in the following, which strikes me as a very weird place to set color transforms for the chart.

    <mc:AlternateContent xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">
        <mc:Choice Requires="c14"
            xmlns:c14="http://schemas.microsoft.com/office/drawing/2007/8/2/chart"><c14:style
                val="102"/></mc:Choice>
        <mc:Fallback><c:style val="2"/></mc:Fallback>
    </mc:AlternateContent>

Is this something that used to be done, but now if there's no colors it's the accent colors with no transformations?

thanks - dave

Office Open Specifications
Office Open Specifications
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Open Specifications: Technical documents for protocols, computer languages, standards support, and data portability. The goal with Open Specifications is to help developers open new opportunities to interoperate with Windows, SQL, Office, and SharePoint.
122 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Mike Bowen 1,276 Reputation points Microsoft Employee
    2021-03-24T21:21:28.667+00:00

    Hi @David Thielen ,

    Here's what I found.

    • Table 5 shows how different styles 1 - 48 effect the different parts of a data points style depending on whether the style is for fills, lines or markers. The top row shows which columns apply for which elements and the main table shows the styles for each value. For example, these are the values for Markers for Data Points for style 2.
    Markers for Data Points
    Style Themed Effect Themed Fill Pattern Themed Fill Themed Line Color or Pattern Width Pattern
    2 No Effect Subtle 2 Subtle No Line 3 2

    So a Marker for a data point, for example, the upper part of the table indicates that a marker for a data point only has Themed Effect, Themed Fill, and Pattern and the other columns are ignored. The table shows a themed effect of No Effect, a themed fill of Subtle, and a pattern value of 2 for style 2 for a marker for a data point.

    • Cycling is not always 6 colors. This is determined by the color.xml. As an example: html
      <cs:colorStyle xmlns:cs="http://schemas.microsoft.com/office/drawing/2012/chartStyle" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" meth="cycle" id="12">
      <a:schemeClr val="accent2"/>
      <a:schemeClr val="accent4"/>
      <a:schemeClr val="accent6"/>
      <cs:variation/>
      <cs:variation>
      <a:lumMod val="60000"/>
      </cs:variation>
      <cs:variation>
      <a:lumMod val="80000"/>
      <a:lumOff val="20000"/>
      </cs:variation>
      ...

    The above cycle has three colors (accent 2, 4, and 6). The first time through (variation) no modifications are made to these colors. On the fourth color, the second variation begins, and applies a luminance modification to accent 2. The variations depend on the color style, which have defaults based on the style number is.

    • I was not able to find published default files for style.xml and colors.xml. However, I believe that the defaults for a style number are what you see in the style.xml and color.xml for the chart using that style (redundancy for backwards compatibility). So creating a new chart with a given style should produce style/color parts where the you can see the details
    • I'm still researching your other question about why files saved in Office 2010 don't have style.xml and colors.xml parts and what the defaults are in that case. I will update you with what I find there.

    Best,
    -Mike

    0 comments No comments