question

DavidThielen-0658 avatar image
0 Votes"
DavidThielen-0658 asked MikeBowen-1599 edited

Colors for chart

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


openspecs-office-fileformats
· 8
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi anonymous user
I have alerted the open specifications team regarding your inquiry. A member of the team will be in touch soon.

Regards,
Obaid Farooqi -MSFT

0 Votes 0 ·

Hi @DavidThielen-0658 ,

I'll look into this. Could you please clarify for me, the xml you pasted is created by your old code and that code is adding transforms based on <c:style val="" /> in strange places and you need to know if this used to be required, but no longer is? Is that right?

Best Regards,

Mike Bowen
Escalation Engineer - Microsoft Open Specifications

0 Votes 0 ·

Hi Mike;

No, this docx was created by Word, probably Word 2010. I need to be able to render it properly and so I need to know what that <style val=/> means for a docx where the chart does not have a colors.xml reference.

thanks - dave

0 Votes 0 ·

Hi Dave,

Thanks for the clarification. I'll look into this and let you know what I find.

  • Mike

0 Votes 0 ·

Hi @DavidThielen-0658 ,

Do the values that are applied for shade, tint, lumMod/Off etc. differ from what is specified in ISO/IEC 29500-1 21.2.3.46 ST_Style (Style) for val="2"?

-Mike

0 Votes 0 ·

Mike - I think this is it!

First off, how did you know where to look for this (so I can better find stuff myself)?


Second, what exactly is table 5 in it? (And do I care about it?)

Third, in Table 6 it says that it cycles through 6 colors, but then for the next 6 it is shaded or tinted - where is the number for that?

Fourth, any chance there's a colors.xml file that has the full style/pattern for all these style settings?

thanks - dave

0 Votes 0 ·

ps - I really appreciate the support you all provide.

0 Votes 0 ·

Hi Dave,

Not a problem! Thanks for the kind words, I'm glad to be able to help :-)

For how I found those sections, unfortunately, I don't have any special technique. When I first looked into your question, my colleague (Tom Jebo) pointed me to ISO-29500-3 7.5 for AlternateContent. For the style, I knew that Charts comes from DrawingML, so I looked in ISO 29500 21.2 "DrawingML - Charts" in the table of contents in 21.2.1 and found "21.2.3.46 ST_Style (Style)", which had the display information.

I'll look into the rest of your questions and let you now what I find

Best,

Mike

0 Votes 0 ·

1 Answer

MikeBowen-1599 avatar image
0 Votes"
MikeBowen-1599 answered MikeBowen-1599 edited

Hi @DavidThielen-0658 ,

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



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.