Tuesday, March 20, 2012

BUG: 3rd Request: Series style function BUG in SP1

I'll try posting this again, since it garnered no reply either of the
times that I posted it. Is my post being ignored for some reason?
Greetings.
I found an odd issue when working with a series style in a line chart
in SP1. I was using my own function to determine the color of the
series. So I entered =Code.PickColor(Fields!ResultSort.Value) for the
formula. My code is this:
Public Function PickColor(iResultSort As Integer) As String
Dim sColor As String
Select Case iResultSort
Case 0: sColor = "#000000" ' Black, Full
Case 3: sColor = "#800000" ' Brown, Avg
End Select
PickColor = sColor
End Function
The ResultSort field is defined in SQL as an integer. What happened
on the chart is that the data line was drawn in the color expected,
but from the end of the line to the x axis, a black line was drawn.
If I change the code to use a String instead:
Public Function PickColor(sResultSort As String) As String
Dim sColor As String
Select Case sResultSort
Case "0": sColor = "#000000" ' Black, Full
Case "3": sColor = "#800000" ' Brown, Avg
End Select
PickColor = sColor
End Function
then it draws as expected.
I would sort of like to know if there is something that I am missing
here that causes it to behave like this or if there is an issue with
the functionality.
I have the rdl and sample data as xml attached here, and can email
screenshots or whatever if desired.
Thanks.
Dale.
<?xml version="1.0" encoding="utf-8"?>
<Report
xmlns="http://schemas.microsoft.com/sqlserver/reporting/2003/10/reportdefinition"
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>=Fields!DPC.Value</Value>
</DataValue>
</DataValues>
<DataLabel />
<Style>
<BorderColor>
<Default>=Code.PickColor( Fields!ResultSort.Value
)</Default>
</BorderColor>
</Style>
<Marker>
<Type>Auto</Type>
<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>Line</Type>
<Title />
<CategoryGroupings>
<CategoryGrouping>
<DynamicCategories>
<Grouping Name="chart1_CategoryGroup1">
<GroupExpressions>
<GroupExpression>=Fields!DaysAfter.Value</GroupExpression>
</GroupExpressions>
</Grouping>
<Label>=Fields!DaysAfter.Value</Label>
</DynamicCategories>
</CategoryGrouping>
</CategoryGroupings>
<SeriesGroupings>
<SeriesGrouping>
<DynamicSeries>
<Grouping Name="chart1_SeriesGroup1">
<GroupExpressions>
<GroupExpression>=Fields!ResultSort.Value</GroupExpression>
</GroupExpressions>
</Grouping>
<Label>=Fields!ResultSort.Value</Label>
</DynamicSeries>
</SeriesGrouping>
</SeriesGroupings>
<Subtype>Plain</Subtype>
<PlotArea>
<Style>
<BackgroundColor>White</BackgroundColor>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
</PlotArea>
<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>5.125in</Height>
</Body>
<TopMargin>1in</TopMargin>
<DataSources>
<DataSource Name="List_History ReadOnly">
<rd:DataSourceID>f2bd5a97-e7bc-444d-a3f9-b6f33e8fb5a7</rd:DataSourceID>
<DataSourceReference>List_History ReadOnly</DataSourceReference>
</DataSource>
</DataSources>
<Code>Public Function PickColor(iResultSort As Integer) As String
Dim sColor As String
Select Case iResultSort
Case 0: sColor = "#000000" ' Black, Full
Case 3: sColor = "#800000" ' Brown, Avg
End Select
PickColor = sColor
End Function
Public Function PickLineWidth(sResultSort As String) As String
Dim sWidth As String
Select Case sResultSort
Case 0: sWidth = "1.5pt" ' Thicker
Case Else: sWidth = "1pt" ' Normal
End Select
End Function
</Code>
<Width>6.625in</Width>
<DataSets>
<DataSet Name="DataSet1">
<Fields>
<Field Name="DaysAfter">
<DataField>DaysAfter</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
<Field Name="ResultSort">
<DataField>ResultSort</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
<Field Name="DPC">
<DataField>DPC</DataField>
<rd:TypeName>System.Decimal</rd:TypeName>
</Field>
</Fields>
<Query>
<DataSourceName>List_History ReadOnly</DataSourceName>
<CommandText>SELECT * FROM dbo.Dale</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>1f236bff-9e92-4d02-a9b0-b41e2d7f6950</rd:ReportID>
<BottomMargin>1in</BottomMargin>
<Language>en-US</Language>
</Report>
<SampleData>
<DataRow DaysAfter="34" ResultSort="0" DPC="4.07"/><DataRow
DaysAfter="65" ResultSort="0" DPC="4.07"/><DataRow DaysAfter="95"
ResultSort="0" DPC="4.07"/><DataRow DaysAfter="126" ResultSort="0"
DPC="4.07"/><DataRow DaysAfter="156" ResultSort="0"
DPC="4.07"/><DataRow DaysAfter="187" ResultSort="0"
DPC="4.07"/><DataRow DaysAfter="218" ResultSort="0"
DPC="4.07"/><DataRow DaysAfter="248" ResultSort="0"
DPC="4.07"/><DataRow DaysAfter="279" ResultSort="0"
DPC="4.07"/><DataRow ResultSort="0" DPC="4.07"/><DataRow
DaysAfter="34" ResultSort="1" DPC="3.06"/><DataRow DaysAfter="65"
ResultSort="1" DPC="3.06"/><DataRow DaysAfter="95" ResultSort="1"
DPC="3.06"/><DataRow DaysAfter="126" ResultSort="1"
DPC="3.06"/><DataRow DaysAfter="156" ResultSort="1"
DPC="3.06"/><DataRow DaysAfter="187" ResultSort="1"
DPC="3.06"/><DataRow DaysAfter="218" ResultSort="1"
DPC="3.06"/><DataRow DaysAfter="248" ResultSort="1"
DPC="3.06"/><DataRow DaysAfter="279" ResultSort="1"
DPC="3.06"/><DataRow ResultSort="1" DPC="3.06"/><DataRow
DaysAfter="34" ResultSort="3" DPC="8.59"/><DataRow DaysAfter="65"
ResultSort="3" DPC="11.32"/><DataRow DaysAfter="95" ResultSort="3"
DPC="14.78"/><DataRow DaysAfter="126" ResultSort="3"
DPC="15.42"/><DataRow DaysAfter="156" ResultSort="3"
DPC="16.04"/><DataRow DaysAfter="187" ResultSort="3"
DPC="16.33"/></SampleData>I think there might be several issues here:
* you use DaysAfter as category grouping. Your data has NULLs for DaysAfter
in some of the rows - is this intended?
* the category grouping does not use a sort expression (to sort DaysAfter
ascending) - add a sort expression identical on the category group
expression: =Fields!DaysAfter.Value
* A series grouping is present in the chart - therefore instead of using
=Code.PickColor( Fields!ResultSort.Value), you should use this expression:
=Code.PickColor(First(Fields!ResultSort.Value, "chart1_SeriesGroup1")
The important part is the aggregate scope which has to be identical to the
chart series grouping name. Just using the First aggregate without the scope
will give you incorrect results, because the aggregate will be just scoped
for every chart datapoint (and therefore null if you don't have any
datapoints for a particular series group / category group combination).
Finally, I'm not sure but you might run into an issue in the chart control
we have identified recently and for which we have provided a fix. The fix is
related to NULL datapoints in line charts. Details:
http://support.microsoft.com/default.aspx?scid=kb;en-us;883675. Please feel
free to contact PSS and refer them to KB 883675.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Shrumishi" <shrumishi@.yahoo.com> wrote in message
news:4380bfd3.0409170628.7daebbd3@.posting.google.com...
> I'll try posting this again, since it garnered no reply either of the
> times that I posted it. Is my post being ignored for some reason?
> Greetings.
> I found an odd issue when working with a series style in a line chart
> in SP1. I was using my own function to determine the color of the
> series. So I entered =Code.PickColor(Fields!ResultSort.Value) for the
> formula. My code is this:
> Public Function PickColor(iResultSort As Integer) As String
> Dim sColor As String
> Select Case iResultSort
> Case 0: sColor = "#000000" ' Black, Full
> Case 3: sColor = "#800000" ' Brown, Avg
> End Select
> PickColor = sColor
> End Function
> The ResultSort field is defined in SQL as an integer. What happened
> on the chart is that the data line was drawn in the color expected,
> but from the end of the line to the x axis, a black line was drawn.
> If I change the code to use a String instead:
> Public Function PickColor(sResultSort As String) As String
> Dim sColor As String
> Select Case sResultSort
> Case "0": sColor = "#000000" ' Black, Full
> Case "3": sColor = "#800000" ' Brown, Avg
> End Select
> PickColor = sColor
> End Function
> then it draws as expected.
> I would sort of like to know if there is something that I am missing
> here that causes it to behave like this or if there is an issue with
> the functionality.
> I have the rdl and sample data as xml attached here, and can email
> screenshots or whatever if desired.
> Thanks.
> Dale.
> <?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>=Fields!DPC.Value</Value>
> </DataValue>
> </DataValues>
> <DataLabel />
> <Style>
> <BorderColor>
> <Default>=Code.PickColor( Fields!ResultSort.Value
> )</Default>
> </BorderColor>
> </Style>
> <Marker>
> <Type>Auto</Type>
> <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>Line</Type>
> <Title />
> <CategoryGroupings>
> <CategoryGrouping>
> <DynamicCategories>
> <Grouping Name="chart1_CategoryGroup1">
> <GroupExpressions>
>
<GroupExpression>=Fields!DaysAfter.Value</GroupExpression>
> </GroupExpressions>
> </Grouping>
> <Label>=Fields!DaysAfter.Value</Label>
> </DynamicCategories>
> </CategoryGrouping>
> </CategoryGroupings>
> <SeriesGroupings>
> <SeriesGrouping>
> <DynamicSeries>
> <Grouping Name="chart1_SeriesGroup1">
> <GroupExpressions>
>
<GroupExpression>=Fields!ResultSort.Value</GroupExpression>
> </GroupExpressions>
> </Grouping>
> <Label>=Fields!ResultSort.Value</Label>
> </DynamicSeries>
> </SeriesGrouping>
> </SeriesGroupings>
> <Subtype>Plain</Subtype>
> <PlotArea>
> <Style>
> <BackgroundColor>White</BackgroundColor>
> <BorderStyle>
> <Default>Solid</Default>
> </BorderStyle>
> </Style>
> </PlotArea>
> <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>5.125in</Height>
> </Body>
> <TopMargin>1in</TopMargin>
> <DataSources>
> <DataSource Name="List_History ReadOnly">
>
<rd:DataSourceID>f2bd5a97-e7bc-444d-a3f9-b6f33e8fb5a7</rd:DataSourceID>
> <DataSourceReference>List_History ReadOnly</DataSourceReference>
> </DataSource>
> </DataSources>
> <Code>Public Function PickColor(iResultSort As Integer) As String
> Dim sColor As String
> Select Case iResultSort
> Case 0: sColor = "#000000" ' Black, Full
> Case 3: sColor = "#800000" ' Brown, Avg
> End Select
> PickColor = sColor
> End Function
> Public Function PickLineWidth(sResultSort As String) As String
> Dim sWidth As String
> Select Case sResultSort
> Case 0: sWidth = "1.5pt" ' Thicker
> Case Else: sWidth = "1pt" ' Normal
> End Select
> End Function
> </Code>
> <Width>6.625in</Width>
> <DataSets>
> <DataSet Name="DataSet1">
> <Fields>
> <Field Name="DaysAfter">
> <DataField>DaysAfter</DataField>
> <rd:TypeName>System.Int32</rd:TypeName>
> </Field>
> <Field Name="ResultSort">
> <DataField>ResultSort</DataField>
> <rd:TypeName>System.Int32</rd:TypeName>
> </Field>
> <Field Name="DPC">
> <DataField>DPC</DataField>
> <rd:TypeName>System.Decimal</rd:TypeName>
> </Field>
> </Fields>
> <Query>
> <DataSourceName>List_History ReadOnly</DataSourceName>
> <CommandText>SELECT * FROM dbo.Dale</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>1f236bff-9e92-4d02-a9b0-b41e2d7f6950</rd:ReportID>
> <BottomMargin>1in</BottomMargin>
> <Language>en-US</Language>
> </Report>
> <SampleData>
> <DataRow DaysAfter="34" ResultSort="0" DPC="4.07"/><DataRow
> DaysAfter="65" ResultSort="0" DPC="4.07"/><DataRow DaysAfter="95"
> ResultSort="0" DPC="4.07"/><DataRow DaysAfter="126" ResultSort="0"
> DPC="4.07"/><DataRow DaysAfter="156" ResultSort="0"
> DPC="4.07"/><DataRow DaysAfter="187" ResultSort="0"
> DPC="4.07"/><DataRow DaysAfter="218" ResultSort="0"
> DPC="4.07"/><DataRow DaysAfter="248" ResultSort="0"
> DPC="4.07"/><DataRow DaysAfter="279" ResultSort="0"
> DPC="4.07"/><DataRow ResultSort="0" DPC="4.07"/><DataRow
> DaysAfter="34" ResultSort="1" DPC="3.06"/><DataRow DaysAfter="65"
> ResultSort="1" DPC="3.06"/><DataRow DaysAfter="95" ResultSort="1"
> DPC="3.06"/><DataRow DaysAfter="126" ResultSort="1"
> DPC="3.06"/><DataRow DaysAfter="156" ResultSort="1"
> DPC="3.06"/><DataRow DaysAfter="187" ResultSort="1"
> DPC="3.06"/><DataRow DaysAfter="218" ResultSort="1"
> DPC="3.06"/><DataRow DaysAfter="248" ResultSort="1"
> DPC="3.06"/><DataRow DaysAfter="279" ResultSort="1"
> DPC="3.06"/><DataRow ResultSort="1" DPC="3.06"/><DataRow
> DaysAfter="34" ResultSort="3" DPC="8.59"/><DataRow DaysAfter="65"
> ResultSort="3" DPC="11.32"/><DataRow DaysAfter="95" ResultSort="3"
> DPC="14.78"/><DataRow DaysAfter="126" ResultSort="3"
> DPC="15.42"/><DataRow DaysAfter="156" ResultSort="3"
> DPC="16.04"/><DataRow DaysAfter="187" ResultSort="3"
> DPC="16.33"/></SampleData>sql

No comments:

Post a Comment