Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » How to customize bar chart color
How to customize bar chart color [message #368614] Mon, 15 June 2009 15:09 Go to next message
Alex is currently offline AlexFriend
Messages: 22
Registered: July 2009
Junior Member
Hello,

I created a bar chart which showed the severity of vulnerabilities.
It's ordered by severity and colored by Categories. I was able to pick up
colors by clicking "Series Palette". But ideally I would like to tie a
specified color to severity. e.g. If it's critical, the color should be
red...

Just wonder if there is a way to do so.

Thanks a lot for your time and help.

Regards,

-Alex
Re: How to customize bar chart color [message #368623 is a reply to message #368614] Tue, 16 June 2009 14:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: jasonweathersby.windstream.net

Alex,

You should be able to do this in the beforeDrawDataPoint script. Keep
in mind this will mess up the legend unless you change colors for it to
with script. To change the data point color do this:

function beforeDrawDataPoint(dph, fill, icsc)
{
//Fill implements Fill interface
//ImageImpl
//ColorDefinitionImpl
//GradientImpl
//MultipleFillImpl
val = dph.getOrthogonalValue();
if (val < 0){
fill.set(255, 0, 0);
}

}
See attached example

Jason

<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.17"
id="1">
<property name="createdBy">Eclipse BIRT Designer Version
2.3.2.r232_20090202 Build &lt;2.3.2.v20090218-0730></property>
<property name="units">in</property>
<method name="beforeRender"><![CDATA[var mychartvar = "setbyreport";
reportContext.setGlobalVariable("reportvariable", mychartvar);]]></method>
<data-sources>
<script-data-source name="Data Source" id="2"/>
</data-sources>
<data-sets>
<script-data-set name="Data Set" id="3">
<list-property name="resultSetHints">
<structure>
<property name="position">1</property>
<property name="name">Category</property>
<property name="dataType">any</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">SalesBalance</property>
<property name="dataType">any</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">Projection</property>
</structure>
</list-property>
<list-property name="columnHints">
<structure>
<property name="columnName">Category</property>
</structure>
<structure>
<property name="columnName">SalesBalance</property>
</structure>
<structure>
<property name="columnName">Projection</property>
</structure>
</list-property>
<structure name="cachedMetaData">
<list-property name="resultSet">
<structure>
<property name="position">1</property>
<property name="name">Category</property>
<property name="dataType">any</property>
</structure>
<structure>
<property name="position">2</property>
<property name="name">SalesBalance</property>
<property name="dataType">any</property>
</structure>
<structure>
<property name="position">3</property>
<property name="name">Projection</property>
<property name="dataType">any</property>
</structure>
</list-property>
</structure>
<property name="dataSource">Data Source</property>
<method name="open"><![CDATA[i = 0;

sourcedata = new Array( new Array(3),
new Array(3),
new Array(3),
new Array(3),
new Array(3));
sourcedata[0][0] = "Keyboard";
sourcedata[0][1] = 320;
sourcedata[0][2] = 105;

sourcedata[1][0] = "Mouse";
sourcedata[1][1] = 1700;
sourcedata[1][2] = 430;

sourcedata[2][0] = "Memory";
sourcedata[2][1] = -387;
sourcedata[2][2] = 250;

sourcedata[3][0] = "CPU";
sourcedata[3][1] = 890;
sourcedata[3][2] = -100;

sourcedata[4][0] = "Cable";
sourcedata[4][1] = -790;
sourcedata[4][2] = 340;]]></method>
<method name="fetch"><![CDATA[if ( i < 5 )
{
row["Category"] = sourcedata[i][0];
row["SalesBalance"] = sourcedata[i][1];
row["Projection"]= sourcedata[i][2];
i++;
return true;
}
return false;]]></method>
</script-data-set>
</data-sets>
<page-setup>
<simple-master-page name="Simple MasterPage" id="4">
<page-footer>
<text id="5">
<property name="contentType">html</property>
<text-property
name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property>
</text>
</page-footer>
</simple-master-page>
</page-setup>
<body>
<extended-item extensionName="Chart" name="NewChart" id="6">
<xml-property
name="xmlRepresentation"><![CDATA[<model:ChartWithAxes
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:attribute="http://www.birt.eclipse.org/ChartModelAttribute"
xmlns:data="http://www.birt.eclipse.org/ChartModelData"
xmlns:layout="http://www.birt.eclipse.org/ChartModelLayout"
xmlns:model="http://www.birt.eclipse.org/ChartModel"
xmlns:type="http://www.birt.eclipse.org/ChartModelType">
<Type>Bar Chart</Type>
<SubType>Stacked</SubType>
<Description>
<Value></Value>
<Font>
<Alignment/>
</Font>
</Description>
<Block>
<Children xsi:type="layout:TitleBlock">
<Bounds>
<Left>0.0</Left>
<Top>0.0</Top>
<Width>0.0</Width>
<Height>0.0</Height>
</Bounds>
<Insets>
<Top>3.0</Top>
<Left>3.0</Left>
<Bottom>3.0</Bottom>
<Right>3.0</Right>
</Insets>
<Row>-1</Row>
<Column>-1</Column>
<Rowspan>-1</Rowspan>
<Columnspan>-1</Columnspan>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>false</Visible>
</Outline>
<Visible>false</Visible>
<Label>
<Caption>
<Value>Bar Chart Title</Value>
<Font>
<Name>Book Antiqua</Name>
<Size>24.0</Size>
<Bold>true</Bold>
<Italic>false</Italic>
<Strikethrough>false</Strikethrough>
<Underline>false</Underline>
<Alignment>
<horizontalAlignment>Left</horizontalAlignment>
<verticalAlignment>Top</verticalAlignment>
</Alignment>
<Rotation>0.0</Rotation>
</Font>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
</Caption>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>2.0</Left>
<Bottom>0.0</Bottom>
<Right>3.0</Right>
</Insets>
<Visible>true</Visible>
</Label>
</Children>
<Children xsi:type="layout:Plot">
<Bounds>
<Left>0.0</Left>
<Top>0.0</Top>
<Width>0.0</Width>
<Height>0.0</Height>
</Bounds>
<Insets>
<Top>3.0</Top>
<Left>3.0</Left>
<Bottom>3.0</Bottom>
<Right>3.0</Right>
</Insets>
<Row>-1</Row>
<Column>-1</Column>
<Rowspan>-1</Rowspan>
<Columnspan>-1</Columnspan>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>false</Visible>
</Outline>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Visible>true</Visible>
<HorizontalSpacing>5</HorizontalSpacing>
<VerticalSpacing>5</VerticalSpacing>
<ClientArea>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>0</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>false</Visible>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>0.0</Left>
<Bottom>0.0</Bottom>
<Right>0.0</Right>
</Insets>
</ClientArea>
</Children>
<Children xsi:type="layout:Legend">
<Bounds>
<Left>0.0</Left>
<Top>0.0</Top>
<Width>0.0</Width>
<Height>0.0</Height>
</Bounds>
<Insets>
<Top>3.0</Top>
<Left>3.0</Left>
<Bottom>3.0</Bottom>
<Right>3.0</Right>
</Insets>
<Row>-1</Row>
<Column>-1</Column>
<Rowspan>-1</Rowspan>
<Columnspan>-1</Columnspan>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>false</Visible>
</Outline>
<Visible>false</Visible>
<ClientArea>
<Outline>
<Style>Solid</Style>
<Thickness>0</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>false</Visible>
</Outline>
<Insets>
<Top>2.0</Top>
<Left>2.0</Left>
<Bottom>2.0</Bottom>
<Right>2.0</Right>
</Insets>
</ClientArea>
<Text>
<Value>&lt;undefined></Value>
<Font>
<Name>SansSerif</Name>
<Size>12.0</Size>
<Bold>false</Bold>
<Italic>false</Italic>
<Strikethrough>false</Strikethrough>
<Underline>false</Underline>
<Alignment>
<horizontalAlignment>Left</horizontalAlignment>
<verticalAlignment>Top</verticalAlignment>
</Alignment>
<Rotation>0.0</Rotation>
</Font>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
</Text>
<Orientation>Vertical</Orientation>
<Direction>Top_Bottom</Direction>
<Separator>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>true</Visible>
</Separator>
<Position>Right</Position>
<ItemType>Series</ItemType>
<Title>
<Caption>
<Value></Value>
<Font>
<Alignment/>
</Font>
</Caption>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>2.0</Left>
<Bottom>0.0</Bottom>
<Right>3.0</Right>
</Insets>
<Visible>true</Visible>
</Title>
</Children>
<Bounds>
<Left>0.0</Left>
<Top>0.0</Top>
<Width>302.25000000240004</Width>
<Height>207.0</Height>
</Bounds>
<Insets>
<Top>3.0</Top>
<Left>3.0</Left>
<Bottom>3.0</Bottom>
<Right>3.0</Right>
</Insets>
<Row>-1</Row>
<Column>-1</Column>
<Rowspan>-1</Rowspan>
<Columnspan>-1</Columnspan>
<Outline>
<Style>Solid</Style>
<Thickness>4</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>51</Red>
<Green>51</Green>
<Blue>153</Blue>
</Color>
<Visible>true</Visible>
</Outline>
<Background xsi:type="attribute:Gradient">
<StartColor>
<Transparency>255</Transparency>
<Red>203</Red>
<Green>228</Green>
<Blue>254</Blue>
</StartColor>
<EndColor>
<Transparency>255</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</EndColor>
<Direction>90.0</Direction>
</Background>
<Visible>true</Visible>
</Block>
<Dimension>Two_Dimensional</Dimension>
<Script>function beforeDrawDataPoint(dph, fill, icsc)
{
//Fill implements Fill interface
//ImageImpl
//ColorDefinitionImpl
//GradientImpl
//MultipleFillImpl
val = dph.getOrthogonalValue();
if (val &lt; 0){
fill.set(255, 0, 0);
}

}


function beforeDrawDataPointLabel(dph, label, icsc)
{
var mylab =
icsc.getExternalContext().getScriptable().getGlobalVariable( &quot;reportvariable&quot;);
label.getCaption().setValue(mylab);
}</Script>
<Units>Points</Units>
<SeriesThickness>10.0</SeriesThickness>
<SampleData>
<BaseSampleData>
<DataSetRepresentation>'A','B','C'</DataSetRepresentation>
</BaseSampleData>
<OrthogonalSampleData>
<DataSetRepresentation>5.0,4.0,12.0</DataSetRepresentation >
<SeriesDefinitionIndex>0</SeriesDefinitionIndex>
</OrthogonalSampleData>
<OrthogonalSampleData>
<DataSetRepresentation>10.0,8.0,24.0</DataSetRepresentation >
<SeriesDefinitionIndex>1</SeriesDefinitionIndex>
</OrthogonalSampleData>
<AncillarySampleData>
<DataSetRepresentation>Series 1</DataSetRepresentation>
</AncillarySampleData>
</SampleData>
<Interactivity/>
<Axes>
<Type>Text</Type>
<Title>
<Caption>
<Value>=</Value>
<Font>
<Name>SansSerif</Name>
<Size>16.0</Size>
<Bold>true</Bold>
<Italic>false</Italic>
<Strikethrough>false</Strikethrough>
<Underline>false</Underline>
<Alignment>
<horizontalAlignment>Left</horizontalAlignment>
<verticalAlignment>Top</verticalAlignment>
</Alignment>
<Rotation>0.0</Rotation>
</Font>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
</Caption>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>2.0</Left>
<Bottom>0.0</Bottom>
<Right>3.0</Right>
</Insets>
<Visible>false</Visible>
</Title>
<TitlePosition>Below</TitlePosition>
<AssociatedAxes>
<Type>Linear</Type>
<Title>
<Caption>
<Value>=Sales Balance</Value>
<Font>
<Name>SansSerif</Name>
<Size>16.0</Size>
<Bold>true</Bold>
<Italic>false</Italic>
<Strikethrough>false</Strikethrough>
<Underline>false</Underline>
<Alignment>
<horizontalAlignment>Left</horizontalAlignment>
<verticalAlignment>Top</verticalAlignment>
</Alignment>
<Rotation>90.0</Rotation>
</Font>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
</Caption>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>2.0</Left>
<Bottom>0.0</Bottom>
<Right>3.0</Right>
</Insets>
<Visible>true</Visible>
</Title>
<TitlePosition>Left</TitlePosition>
<SeriesDefinitions>
<Query>
<Definition></Definition>
</Query>
<SeriesPalette>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>0</Red>
<Green>128</Green>
<Blue>255</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>255</Red>
<Green>128</Green>
<Blue>192</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>255</Green>
<Blue>128</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>0</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>64</Red>
<Green>128</Green>
<Blue>128</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>128</Green>
<Blue>192</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>170</Red>
<Green>85</Green>
<Blue>85</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>128</Green>
<Blue>0</Blue>
</Entries>
</SeriesPalette>
<Series xsi:type="type:BarSeries">
<Visible>true</Visible>
<Label>
<Caption>
<Value>&lt;undefined></Value>
<Font>
<Name>SansSerif</Name>
<Size>12.0</Size>
<Bold>false</Bold>
<Italic>false</Italic>
<Strikethrough>false</Strikethrough>
<Underline>false</Underline>
<Alignment>
<horizontalAlignment>Left</horizontalAlignment>
<verticalAlignment>Top</verticalAlignment>
</Alignment>
<Rotation>0.0</Rotation>
</Font>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
</Caption>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>false</Visible>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>2.0</Left>
<Bottom>0.0</Bottom>
<Right>3.0</Right>
</Insets>
<Visible>true</Visible>
</Label>
<DataDefinition>
<Definition>row[&quot;SalesBalance&quot;]</Definition >
</DataDefinition>
<SeriesIdentifier>&lt;undefined></SeriesIdentifier>
<DataPoint>
<Components>
<Type>Orthogonal_Value</Type>
</Components>
<Separator>, </Separator>
</DataPoint>
<LabelPosition>Inside</LabelPosition>
<Stacked>true</Stacked>
<Riser>Rectangle</Riser>
</Series>
<Grouping>
<Enabled>false</Enabled>
<GroupingInterval>2.0</GroupingInterval>
<GroupType>Text</GroupType>
<AggregateExpression>Sum</AggregateExpression>
</Grouping>
<Sorting>Ascending</Sorting>
</SeriesDefinitions>
<SeriesDefinitions>
<Query>
<Definition></Definition>
</Query>
<SeriesPalette>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>255</Red>
<Green>128</Green>
<Blue>192</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>255</Green>
<Blue>128</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>0</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>64</Red>
<Green>128</Green>
<Blue>128</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>128</Green>
<Blue>192</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>170</Red>
<Green>85</Green>
<Blue>85</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>128</Green>
<Blue>0</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>0</Red>
<Green>128</Green>
<Blue>255</Blue>
</Entries>
</SeriesPalette>
<Series xsi:type="type:BarSeries">
<Visible>true</Visible>
<Label>
<Caption>
<Value>&lt;undefined></Value>
<Font>
<Name>SansSerif</Name>
<Size>12.0</Size>
<Bold>false</Bold>
<Italic>false</Italic>
<Strikethrough>false</Strikethrough>
<Underline>false</Underline>
<Alignment>
<horizontalAlignment>Left</horizontalAlignment>
<verticalAlignment>Top</verticalAlignment>
</Alignment>
<Rotation>0.0</Rotation>
</Font>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
</Caption>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>false</Visible>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>2.0</Left>
<Bottom>0.0</Bottom>
<Right>3.0</Right>
</Insets>
<Visible>true</Visible>
</Label>
<DataDefinition>
<Definition>row[&quot;SalesBalance&quot;]</Definition >
</DataDefinition>
<SeriesIdentifier>&lt;undefined></SeriesIdentifier>
<DataPoint>
<Components>
<Type>Orthogonal_Value</Type>
</Components>
<Separator>, </Separator>
</DataPoint>
<LabelPosition>Inside</LabelPosition>
<Stacked>true</Stacked>
<Riser>Rectangle</Riser>
</Series>
<Grouping>
<Enabled>false</Enabled>
<GroupingInterval>2.0</GroupingInterval>
<GroupType>Text</GroupType>
<AggregateExpression>Sum</AggregateExpression>
</Grouping>
</SeriesDefinitions>
<Orientation>Vertical</Orientation>
<LineAttributes>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>true</Visible>
</LineAttributes>
<Label>
<Caption>
<Value>&lt;undefined></Value>
<Font>
<Name>SansSerif</Name>
<Size>12.0</Size>
<Bold>false</Bold>
<Italic>false</Italic>
<Strikethrough>false</Strikethrough>
<Underline>false</Underline>
<Alignment>
<horizontalAlignment>Left</horizontalAlignment>
<verticalAlignment>Top</verticalAlignment>
</Alignment>
<Rotation>0.0</Rotation>
</Font>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
</Caption>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>2.0</Left>
<Bottom>0.0</Bottom>
<Right>3.0</Right>
</Insets>
<Visible>true</Visible>
</Label>
<LabelPosition>Left</LabelPosition>
<MajorGrid>
<LineAttributes>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>196</Red>
<Green>196</Green>
<Blue>196</Blue>
</Color>
<Visible>false</Visible>
</LineAttributes>
<TickStyle>Left</TickStyle>
<TickAttributes>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>196</Red>
<Green>196</Green>
<Blue>196</Blue>
</Color>
<Visible>true</Visible>
</TickAttributes>
</MajorGrid>
<MinorGrid>
<LineAttributes>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>225</Red>
<Green>225</Green>
<Blue>225</Blue>
</Color>
<Visible>false</Visible>
</LineAttributes>
<TickStyle>Across</TickStyle>
<TickAttributes>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>225</Red>
<Green>225</Green>
<Blue>225</Blue>
</Color>
<Visible>false</Visible>
</TickAttributes>
</MinorGrid>
<Scale>
<Min xsi:type="data:NumberDataElement">
<Value>-1000.0</Value>
</Min>
<Max xsi:type="data:NumberDataElement">
<Value>2000.0</Value>
</Max>
<Step>500.0</Step>
<MinorGridsPerUnit>5</MinorGridsPerUnit>
</Scale>
<Origin>
<Type>Min</Type>
<Value xsi:type="data:NumberDataElement">
<Value>0.0</Value>
</Value>
</Origin>
<PrimaryAxis>true</PrimaryAxis>
<Percent>false</Percent>
</AssociatedAxes>
<AncillaryAxes>
<Type>Text</Type>
<Title>
<Caption>
<Value>Z-Axis Title</Value>
<Font>
<Size>14.0</Size>
<Bold>true</Bold>
<Alignment>
<horizontalAlignment>Center</horizontalAlignment>
<verticalAlignment>Center</verticalAlignment>
</Alignment>
</Font>
</Caption>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>2.0</Left>
<Bottom>0.0</Bottom>
<Right>3.0</Right>
</Insets>
<Visible>false</Visible>
</Title>
<TitlePosition>Below</TitlePosition>
<SeriesDefinitions>
<Query>
<Definition></Definition>
</Query>
<SeriesPalette>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>80</Red>
<Green>166</Green>
<Blue>218</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>242</Red>
<Green>88</Green>
<Blue>106</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>232</Red>
<Green>172</Green>
<Blue>57</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>255</Green>
<Blue>128</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>64</Red>
<Green>128</Green>
<Blue>128</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>128</Green>
<Blue>192</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>170</Red>
<Green>85</Green>
<Blue>85</Blue>
</Entries>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>128</Red>
<Green>128</Green>
<Blue>0</Blue>
</Entries>
</SeriesPalette>
<Series>
<Visible>true</Visible>
<Label>
<Caption>
<Value></Value>
<Font>
<Alignment/>
</Font>
</Caption>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>false</Visible>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>2.0</Left>
<Bottom>0.0</Bottom>
<Right>3.0</Right>
</Insets>
<Visible>false</Visible>
</Label>
<SeriesIdentifier></SeriesIdentifier>
<DataPoint>
<Components>
<Type>Orthogonal_Value</Type>
</Components>
<Separator>, </Separator>
</DataPoint>
<LabelPosition>Outside</LabelPosition>
<Stacked>false</Stacked>
</Series>
<Grouping>
<Enabled>false</Enabled>
<GroupingInterval>2.0</GroupingInterval>
<GroupType>Text</GroupType>
<AggregateExpression>Sum</AggregateExpression>
</Grouping>
</SeriesDefinitions>
<Orientation>Horizontal</Orientation>
<LineAttributes>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>true</Visible>
</LineAttributes>
<Label>
<Caption>
<Value></Value>
<Font>
<Alignment/>
</Font>
</Caption>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>2.0</Left>
<Bottom>0.0</Bottom>
<Right>3.0</Right>
</Insets>
<Visible>true</Visible>
</Label>
<LabelPosition>Below</LabelPosition>
<MajorGrid>
<LineAttributes>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>196</Red>
<Green>196</Green>
<Blue>196</Blue>
</Color>
<Visible>false</Visible>
</LineAttributes>
<TickStyle>Across</TickStyle>
<TickAttributes>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>196</Red>
<Green>196</Green>
<Blue>196</Blue>
</Color>
<Visible>true</Visible>
</TickAttributes>
</MajorGrid>
<MinorGrid>
<LineAttributes>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>225</Red>
<Green>225</Green>
<Blue>225</Blue>
</Color>
<Visible>false</Visible>
</LineAttributes>
<TickStyle>Across</TickStyle>
<TickAttributes>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>225</Red>
<Green>225</Green>
<Blue>225</Blue>
</Color>
<Visible>false</Visible>
</TickAttributes>
</MinorGrid>
<Scale>
<MinorGridsPerUnit>5</MinorGridsPerUnit>
</Scale>
<Origin>
<Type>Min</Type>
<Value xsi:type="data:NumberDataElement">
<Value>0.0</Value>
</Value>
</Origin>
<PrimaryAxis>true</PrimaryAxis>
<Percent>false</Percent>
</AncillaryAxes>
<SeriesDefinitions>
<Query>
<Definition></Definition>
</Query>
<SeriesPalette>
<Entries xsi:type="attribute:ColorDefinition">
<Transparency>255</Transparency>
<Red>127</Red>
<Green>127</Green>
<Blue>127</Blue>
</Entries>
</SeriesPalette>
<Series>
<Visible>true</Visible>
<Label>
<Caption>
<Value>&lt;undefined></Value>
<Font>
<Name>SansSerif</Name>
<Size>12.0</Size>
<Bold>false</Bold>
<Italic>false</Italic>
<Strikethrough>false</Strikethrough>
<Underline>false</Underline>
<Alignment>
<horizontalAlignment>Left</horizontalAlignment>
<verticalAlignment>Top</verticalAlignment>
</Alignment>
<Rotation>0.0</Rotation>
</Font>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
</Caption>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>false</Visible>
</Outline>
<Insets>
<Top>0.0</Top>
<Left>2.0</Left>
<Bottom>0.0</Bottom>
<Right>3.0</Right>
</Insets>
<Visible>false</Visible>
</Label>
<DataDefinition>
<Definition>row[&quot;Category&quot;]</Definition>
</DataDefinition>
<SeriesIdentifier>&lt;undefined></SeriesIdentifier>
<DataPoint>
<Components>
<Type>Orthogonal_Value</Type>
</Components>
<Separator>, </Separator>
</DataPoint>
<LabelPosition>Outside</LabelPosition>
<Stacked>false</Stacked>
</Series>
<Grouping>
<Enabled>false</Enabled>
<GroupingInterval>2.0</GroupingInterval>
<GroupType>Text</GroupType>
<AggregateExpression>Sum</AggregateExpression>
</Grouping>
</SeriesDefinitions>
<Orientation>Horizontal</Orientation>
<LineAttributes>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
<Visible>true</Visible>
</LineAttributes>
<Label>
<Caption>
<Value>&lt;undefined></Value>
<Font>
<Name>SansSerif</Name>
<Size>12.0</Size>
<Bold>false</Bold>
<Italic>false</Italic>
<Strikethrough>false</Strikethrough>
<Underline>false</Underline>
<Alignment>
<horizontalAlignment>Left</horizontalAlignment>
<verticalAlignment>Top</verticalAlignment>
</Alignment>
<Rotation>0.0</Rotation>
</Font>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
</Caption>
<Background xsi:type="attribute:ColorDefinition">
<Transparency>0</Transparency>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Background>
<Outline>
<Style>Solid</Style>
<Thickness>1</Thickness>
<Color>
<Transparency>255</Transparency>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
Re: How to customize bar chart color [message #997485 is a reply to message #368623] Mon, 07 January 2013 18:14 Go to previous messageGo to next message
Mike Wulkan is currently offline Mike WulkanFriend
Messages: 147
Registered: July 2009
Senior Member
I'd like to do something similar but I think I have to do it in a different exit.
I have a bar chart with 1 series. I am sorting the category X series using the the column value I am using for the Value series. This way I can get the bars showing in order from max to min.
However, because of this sort and because I don't know in advance how many categories there will be I cannot set the colors for the series palette statically. What I would like is to
set the colors for the bars based on the name of the category.
Using code similar to above I can do this so long as I leave the value of the series label as Category Data. This way I can compare the value and set the color.
However I would also like to change the series label to show the Value Data. Once I do this, I loose the capability to get access to the category name in this way.

So the question is how can I access the category name for a given Series Label in this method, or which method should I use to do this?

Thanks
Mike
Re: How to customize bar chart color [message #997507 is a reply to message #997485] Mon, 07 January 2013 21:30 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

Can you attach a report, that uses the sample database, showing the issue you're having?

Michael

Developer Evangelist, Silanis
Re: How to customize bar chart color [message #998220 is a reply to message #997507] Wed, 09 January 2013 15:48 Go to previous messageGo to next message
Mike Wulkan is currently offline Mike WulkanFriend
Messages: 147
Registered: July 2009
Senior Member
It is easier for me to just annotate a chart image (picture worth a thousand words...)
I would like to change the color of the Max CPU and Available CPU bars.
The X axis is sorted so the order in which the bars are shown is not known in advance.
The number of bars is also not known in advance.
I would like a script to be able to identify the bar based on the X value (eg., "Max CPU") and then change the bar color.
https://dl.dropbox.com/u/46622089/bar.png

Originally I was able to use the bar display value to do the comparison because the default value is the X Category. But when I changed the display value to be the value series so that I could display the value beside the bar, I could no longer find the X series category value associated with the bar.

Re: How to customize bar chart color [message #998323 is a reply to message #998220] Wed, 09 January 2013 20:02 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

Try this, in your chart script:

function beforeDrawDataPoint( dph, fill, icsc )
{
if(dph.getBaseDisplayValue() == "Max CPU"){
	fill.set(255,0,0);
}
if(dph.getBaseDisplayValue() == "Available CPU"){
	fill.set(0,0,255);
}
}


Michael

Developer Evangelist, Silanis
Re: How to customize bar chart color [message #998329 is a reply to message #998323] Wed, 09 January 2013 20:09 Go to previous message
Mike Wulkan is currently offline Mike WulkanFriend
Messages: 147
Registered: July 2009
Senior Member
Excellent, that did the trick.

Thanks
Previous Topic:Cannot install Birt on Eclipse 4.2.1 Juno
Next Topic:Text fit to width question
Goto Forum:
  


Current Time: Fri Mar 29 00:31:35 GMT 2024

Powered by FUDForum. Page generated in 0.02844 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top