I've recently been
asked how to set the background of a chart in BI Publisher to a gradient colour
when using the Word Template builder. There is very little documentation on how
to do this, and what there is doesn't seem to work properly, so here's how.
Using the Word
template builder create the basic chart you want, here's mine:
The background colour
isn't in the list of properties when editing the chart, so we need to use the
advanced tab of the chart edit screen:
We need to insert a
new tag here for "PlotArea" after the Graph tag:
<PlotArea
borderColor="#000000" fillColor="#D0DCEC"
borderTransparent="true" fillTransparent="false" />
The chart now looks
appears as:
There are four parameters
on the PlotArea tag:
borderColor: The
colour you want to use for the border, in hex, e.g. "#000000"
fillColor: The colour
you want to use for the background, in hex, e.g. "#D0DCEC"
borderTransparent
: Determines if the border is
transparent - the borderColor setting only applies if this is set to
"false".
fillTransparent:
Determines if the background is transparent - the fillColor setting only
applies if this is set to "false"
Now we have a
background colour set, we can go a stage further and set a gradient wash:
To do this we need to
use a sub-tag of PlotArea: SFX. The SFX tag has three parameters:
fillType: this can be set
to FT_GRADIENT, FT_COLOR or FT_TEXTURE.
gradientDirection:
this can be any of the follow directional options: GD_RIGHT, GD_LEFT, GD_DOWN,
GD_UP, GD_DOWN_LEFT, GD_UP_LEFT, GD_DIAGONAL_45, GD_DIAGONAL_135,
GD_DOWN_RIGHT, GD_UP_RIGHT, GD_RADIAL, GD_RADIAL_TOP_LEFT, GD_RADIAL_TOP_RIGHT,
GD_RADIAL_BOTTOM_LEFT or GD_RADIAL_BOTTOM_RIGHT
gradientNumStops: This
tells the chart how many gradient colour changes to perform. A setting of 2
performs one gradient change from one colour to a second (hence 2). 3 would
allow a gradient change from one colour to a second and then on to a third.
(there's an example of this below).
so our SFX tag will
be:
<SFX fillType="FT_GRADIENT"
gradientDirection="GD_RIGHT" gradientNumStops="2">
The SFX tag has a
sub-tag of GradientStopStyle, and you need one of these for each stop. As we've
specificed 2 stops, we need 2 GradientStopStyle tags:
<GradientStopStyle stopIndex="0"
gradientStopPosition="0.0" gradientStopColor="#D0DCEC"/>
<GradientStopStyle stopIndex="1"
gradientStopPosition="100.0"
gradientStopColor="#FFFFFF"/>
These tell the chart
the order of the gradient colour changes, the percentage of the chart then
should cover and the colour they should end up as.
The first tag sets the
initial colour, in this case #D0DCEC.
The second tag sets
the colour to change to and how far across the chart it should go, in this case
cover the whole chart (100%) and change the colour to white (#FFFFFF). So the
whole PlotArea tag group would now be:
<PlotArea
borderColor="#000000" fillColor="#D0DCEC"
borderTransparent="true" fillTransparent="false">
<SFX fillType="FT_GRADIENT"
gradientDirection="GD_RIGHT" gradientNumStops="2">
<GradientStopStyle
stopIndex="0" gradientStopPosition="0.0"
gradientStopColor="#D0DCEC"/>
<GradientStopStyle
stopIndex="1" gradientStopPosition="100.0"
gradientStopColor="#FFFFFF"/>
</SFX>
</PlotArea>
Paste this into the
Advanced tab of the edit chart screen to see the chart above.
To enhance this we can
add additional stops. The following tag has 3 stops and a down gradient:
<PlotArea borderColor="#000000"
borderTransparent="true" fillTransparent="false">
<SFX fillType="FT_GRADIENT"
gradientDirection="GD_RIGHT" gradientNumStops="3">
<GradientStopStyle
stopIndex="0" gradientStopPosition="0.0"
gradientStopColor="#D0DCEC"/>
<GradientStopStyle
stopIndex="1" gradientStopPosition="50.0"
gradientStopColor="#FFFFFF"/>
<GradientStopStyle
stopIndex="2" gradientStopPosition="100.0"
gradientStopColor="#D0DCEC"/>
</SFX>
</PlotArea>
and produces this:
This sets the
background of the chart area, but we can also set the background of the whole
chart. The background tag sets this:
<Background fillColor="#D0DCEC" fillTransparent="false"/>
Just like the PlotArea
tag, filltransparent must be set to "false" for the fillColor to be
active:
We can also use the
same SFX sub-tag to set a gradient:
<Background
fillColor="#D0DCEC"
fillTransparent="false">
<SFX fillType="FT_GRADIENT"
gradientDirection="GD_RIGHT" gradientNumStops="2">
<GradientStopStyle
stopIndex="0" gradientStopPosition="0.0"
gradientStopColor="#D0DCEC"/>
<GradientStopStyle
stopIndex="1" gradientStopPosition="100.0" gradientStopColor="#FFFFFF"/>
</SFX>
</Background>
produces:
and finally we can go
one step further by having different settings for the PlotArea and the
Background:
<Background
fillColor="#D0DCEC"
fillTransparent="false">
<SFX fillType="FT_GRADIENT"
gradientDirection="GD_RIGHT" gradientNumStops="2">
<GradientStopStyle
stopIndex="0" gradientStopPosition="0.0"
gradientStopColor="#D0DCEC"/>
<GradientStopStyle
stopIndex="1" gradientStopPosition="100.0"
gradientStopColor="#FFFFFF"/>
</SFX>
</Background>
<PlotArea
borderTransparent="true" fillTransparent="false">
<SFX fillType="FT_GRADIENT"
gradientDirection="GD_LEFT" gradientNumStops="2">
<GradientStopStyle
stopIndex="0" gradientStopPosition="0.0"
gradientStopColor="#D0DCEC"/>
<GradientStopStyle
stopIndex="1" gradientStopPosition="100.0"
gradientStopColor="#FFFFFF"/>
</SFX>
</PlotArea>
Produces:
No comments:
Post a Comment