I want to set the fill color of a pie chart with my database ex:
I have different department in my database, in each department, I have a
column named color like:
Dept color
dept1 Moccasin
dept2 Salmon
... ...
I try to put Fields!Color.Value in the fill color property but it doesn't
work.
Anyone have an idea'
FrancisTake a look at the example rdl posted at the end of this message.
--
Ravi Mumulla (Microsoft)
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Francis" <francis.cote@.uqat.ca> wrote in message
news:eca9R8tqEHA.3464@.TK2MSFTNGP14.phx.gbl...
> I want to set the fill color of a pie chart with my database ex:
> I have different department in my database, in each department, I have a
> column named color like:
> Dept color
> dept1 Moccasin
> dept2 Salmon
> ... ...
> I try to put Fields!Color.Value in the fill color property but it doesn't
> work.
> Anyone have an idea'
> Francis
>
<?xml version="1.0" encoding="utf-8"?>
<Report
xmlns="http://schemas.microsoft.com/sqlserver/reporting/2003/10/reportdefini
tion"
xmlns:rd="">http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<RightMargin>1in</RightMargin>
<Body>
<ReportItems>
<Chart Name="chart1">
<ThreeDProperties>
<Rotation>30</Rotation>
<Inclination>30</Inclination>
<Shading>Simple</Shading>
<WallThickness>50</WallThickness>
</ThreeDProperties>
<Style>
<BackgroundColor>White</BackgroundColor>
</Style>
<Legend>
<Visible>true</Visible>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
<Position>RightCenter</Position>
</Legend>
<Palette>Default</Palette>
<ChartData>
<ChartSeries>
<DataPoints>
<DataPoint>
<DataValues>
<DataValue>
<Value>=Sum(Fields!col1.Value)</Value>
</DataValue>
</DataValues>
<DataLabel>
<Value>=Fields!col1.Value</Value>
<Visible>true</Visible>
</DataLabel>
<Style>
<BackgroundColor>= Fields!Color.Value</BackgroundColor>
</Style>
<Marker>
<Size>6pt</Size>
</Marker>
</DataPoint>
</DataPoints>
</ChartSeries>
</ChartData>
<CategoryAxis>
<Axis>
<Title />
<MajorGridLines>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
</MajorGridLines>
<MinorGridLines>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
</MinorGridLines>
<MajorTickMarks>Outside</MajorTickMarks>
<Min>0</Min>
<Visible>true</Visible>
</Axis>
</CategoryAxis>
<DataSetName>DataSet1</DataSetName>
<PointWidth>0</PointWidth>
<Type>Pie</Type>
<Top>0.5in</Top>
<Title />
<Width>3.25in</Width>
<CategoryGroupings>
<CategoryGrouping>
<DynamicCategories>
<Grouping Name="chart1_CategoryGroup1">
<GroupExpressions>
<GroupExpression>=Fields!Color.Value</GroupExpression>
</GroupExpressions>
</Grouping>
<Label>=Fields!Color.Value</Label>
</DynamicCategories>
</CategoryGrouping>
</CategoryGroupings>
<Height>2.5in</Height>
<Subtype>Plain</Subtype>
<PlotArea>
<Style>
<BackgroundColor>LightGrey</BackgroundColor>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
</PlotArea>
<Left>0.375in</Left>
<ValueAxis>
<Axis>
<Title />
<MajorGridLines>
<ShowGridLines>true</ShowGridLines>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
</MajorGridLines>
<MinorGridLines>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
</MinorGridLines>
<MajorTickMarks>Outside</MajorTickMarks>
<Min>0</Min>
<Margin>true</Margin>
<Visible>true</Visible>
<Scalar>true</Scalar>
</Axis>
</ValueAxis>
</Chart>
</ReportItems>
<Style />
<Height>3.375in</Height>
</Body>
<TopMargin>1in</TopMargin>
<DataSources>
<DataSource Name="DataSource1">
<rd:DataSourceID>c61ae735-8ef0-4ec6-9942-9f558cf0132f</rd:DataSourceID>
<ConnectionProperties>
<DataProvider>SQL</DataProvider>
<ConnectString />
<IntegratedSecurity>true</IntegratedSecurity>
</ConnectionProperties>
</DataSource>
</DataSources>
<Code>Public Shared Function HHMMSS(ByVal val As String)
Dim Minutes As String
Dim Seconds As String
Dim Hours As String
Dim ModHours As String
If IsNumeric(val) = True And val > 0 Then
If InStr(val / 3600, ".") > 0 Then
Hours = Left(val / 3600, InStr(val / 3600, ".") - 1)
Else
Hours = val / 3600
End If
ModHours = val Mod 3600
If InStr(ModHours / 60, ".") > 0 Then
Minutes = Left(ModHours / 60, InStr(ModHours / 60, ".") - 1)
Else
Minutes = ModHours / 60
End If
Seconds = ModHours Mod 60
If Len(Hours) = 0 Then
Hours = "00"
ElseIf Len(Hours) = 1 Then
Hours = "0" + Hours
End If
If Len(Seconds) = 0 Then
Seconds = "00"
ElseIf Len(Seconds) = 1 Then
Seconds = "0" + Seconds
End If
If Len(Minutes) = 0 Then
Minutes = "00"
ElseIf Len(Minutes) = 1 Then
Minutes = "0" + Minutes
End If
Return Hours + ":" + Minutes + ":" + Seconds
Else
Return "00:00:00"
End If
End Function</Code>
<Width>6.5in</Width>
<DataSets>
<DataSet Name="DataSet1">
<Fields>
<Field Name="col1">
<DataField>col1</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
<Field Name="Color">
<DataField>Color</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
</Fields>
<Query>
<DataSourceName>DataSource1</DataSourceName>
<CommandText>select 1 as col1,'Red' as Color
union
select 2 as col1,'Blue' as Color
union
select 3 as col1,'Green' as Color
union
select 4 as col1,'Yellow' as Color</CommandText>
<rd:UseGenericDesigner>true</rd:UseGenericDesigner>
</Query>
</DataSet>
</DataSets>
<LeftMargin>1in</LeftMargin>
<rd:SnapToGrid>true</rd:SnapToGrid>
<rd:DrawGrid>true</rd:DrawGrid>
<Description />
<rd:ReportID>df28471b-24a5-4a50-a8da-9b9a2b134cb4</rd:ReportID>
<BottomMargin>1in</BottomMargin>
<Language>en-US</Language>
</Report>
No comments:
Post a Comment