Friday, March 9, 2012

Defining your own Palette in the Chart

The chart contol within Reporting Services only has 7 palette options,
is it possible to define your own palette?You need SP1 to be able to do this.
Bryan Avery wrote:
> The chart contol within Reporting Services only has 7 palette
options,
> is it possible to define your own palette?|||Did you find out how to do it?
I've been wondering about it, didn't find a way to do it.
Kaisa
"Bryan Avery" <b_avery@.yahoo.com> wrote in message
news:1112708844.404082.158390@.o13g2000cwo.googlegroups.com...
> You need SP1 to be able to do this.
> Bryan Avery wrote:
> > The chart contol within Reporting Services only has 7 palette
> options,
> > is it possible to define your own palette?
>|||Once I'd upgraded to SP1 and RTFM it worked:
Here is the extract from the SP1 Release notes
Chart Styles
Chart styles have been enhanced for SP1. Previously, the style of a
chart value element (for example, a bar or pie slice in the chart)
could not be changed in Report Designer. Colors were limited to the
automatic palette for the entire chart; you could not choose the colors
that were assigned to each element. With SP1, the line style and fill
color for an element can be edited using Report Designer. You can also
use expressions to control these styles.
To edit the style of a chart element
1. Using Report Designer, create a chart. For more information about
creating a chart, see "Adding a Chart" in Reporting Services Books
Online.
2. In Layout view, right-click the chart, and then click Properties.
3. On the Data tab, in Values, select the value to edit, and then click
Edit.
NOTE: If there is only one value series in the chart, select [Value].
4. On the Appearance tab, click Series Style.
5. On the Border and Line tab, select the line style, width, and color.
To use an expression, click the Expression (fx) button next to the
desired option.
6. On the Fill tab, select the color, gradient, and gradient end color.
To use an expression, click the Expression (fx) button next to the
desired option.
Note Providing a static value will cause all chart elements for that
value series to display using the same style. For example, selecting
Red for the fill color will cause all bars to become red, overriding
the automatic color assignment from the chart palette. To provide
different styles based on field or other values, use an expression. If
you use an expression for fill color, the chart elements will be white
in Layout view, but will display properly when the report is run.
Note A fill color of Transparent will cause the chart elements to
display using the automatic color assignment from the chart palette.
Kaisa M. Lindahl wrote:
> Did you find out how to do it?
> I've been wondering about it, didn't find a way to do it.
> Kaisa
> "Bryan Avery" <b_avery@.yahoo.com> wrote in message
> news:1112708844.404082.158390@.o13g2000cwo.googlegroups.com...
> > You need SP1 to be able to do this.
> >
> > Bryan Avery wrote:
> > > The chart contol within Reporting Services only has 7 palette
> > options,
> > > is it possible to define your own palette?
> >|||But what about the expression? Something like "= Choose(RowNumber(Nothing or
Dateset name), "#0060A1","#3380B4", "#669FC6", ...)" - which works in detail
table rows - does not work in style expressions why? And how to solve the
problem?
"Bryan Avery" wrote:
> Once I'd upgraded to SP1 and RTFM it worked:
> Here is the extract from the SP1 Release notes
> Chart Styles
> Chart styles have been enhanced for SP1. Previously, the style of a
> chart value element (for example, a bar or pie slice in the chart)
> could not be changed in Report Designer. Colors were limited to the
> automatic palette for the entire chart; you could not choose the colors
> that were assigned to each element. With SP1, the line style and fill
> color for an element can be edited using Report Designer. You can also
> use expressions to control these styles.
> To edit the style of a chart element
> 1. Using Report Designer, create a chart. For more information about
> creating a chart, see "Adding a Chart" in Reporting Services Books
> Online.
> 2. In Layout view, right-click the chart, and then click Properties.
> 3. On the Data tab, in Values, select the value to edit, and then click
> Edit.
> NOTE: If there is only one value series in the chart, select [Value].
> 4. On the Appearance tab, click Series Style.
> 5. On the Border and Line tab, select the line style, width, and color.
> To use an expression, click the Expression (fx) button next to the
> desired option.
> 6. On the Fill tab, select the color, gradient, and gradient end color.
> To use an expression, click the Expression (fx) button next to the
> desired option.
> Note Providing a static value will cause all chart elements for that
> value series to display using the same style. For example, selecting
> Red for the fill color will cause all bars to become red, overriding
> the automatic color assignment from the chart palette. To provide
> different styles based on field or other values, use an expression. If
> you use an expression for fill color, the chart elements will be white
> in Layout view, but will display properly when the report is run.
> Note A fill color of Transparent will cause the chart elements to
> display using the automatic color assignment from the chart palette.
> Kaisa M. Lindahl wrote:
> > Did you find out how to do it?
> > I've been wondering about it, didn't find a way to do it.
> >
> > Kaisa
> > "Bryan Avery" <b_avery@.yahoo.com> wrote in message
> > news:1112708844.404082.158390@.o13g2000cwo.googlegroups.com...
> > > You need SP1 to be able to do this.
> > >
> > > Bryan Avery wrote:
> > > > The chart contol within Reporting Services only has 7 palette
> > > options,
> > > > is it possible to define your own palette?
> > >
>|||RowNumber does not work in charts, because a chart is very similar to a
matrix (i.e. you have groupings in two dimensions: columns (categories), and
rows (series)). You cannot use RowNumber in a matrix.
Ok, here is a (trivial) way to use your own custom chart palette.
You would add the following code to report - report properties - code:
Private Shared count As Integer = 0
Private Shared colorPalette As String() = {"Green", "Blue", "Red",
"Orange", "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B",
"#352F26", "#F1E7D6", "#E16C56", "#CFBA9B"}
Public Function GetColor() As String
Dim c as string = colors(count Mod colors.Length)
count = count + 1
Return c
End Function
On the datapoint, you would then set the BackgroundColor to
=Code.GetColor()
A slightly more advanced way of using your own custom chart palette is to
use the following code:
Private Shared colorPalette As String() = {"Green", "Blue", "Red",
"Orange", "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B",
"#352F26", "#F1E7D6", "#E16C56", "#CFBA9B"}
Private Shared count As Integer = 0
Private Shared mapping As New System.Collections.Hashtable()
Public Function GetColor(ByVal groupingValue As String) As String
If mapping.ContainsKey(groupingValue) Then
Return osMapping(groupingValue)
End If
Dim c As String = colorPalette(count Mod colorPalette.Length)
count = count + 1
mapping.Add(groupingValue, c)
Return c
End Function
You would then typically use the same expression as argument for
GetColor(...) as you would use on the category grouping expression (assuming
your expression evaluates to a string). As you can see in the code above,
the hash table will store color mappings and look up existing color
mappings. If you have a new group, it will add a new color mapping.
Robert M. Bruckner
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Hawkeye" <Hawkeye@.discussions.microsoft.com> wrote in message
news:CF9A87DB-DBB3-4381-A2D2-FC5227ACC79A@.microsoft.com...
> But what about the expression? Something like "= Choose(RowNumber(Nothing
> or
> Dateset name), "#0060A1","#3380B4", "#669FC6", ...)" - which works in
> detail
> table rows - does not work in style expressions why? And how to solve the
> problem?
> "Bryan Avery" wrote:
>> Once I'd upgraded to SP1 and RTFM it worked:
>> Here is the extract from the SP1 Release notes
>> Chart Styles
>> Chart styles have been enhanced for SP1. Previously, the style of a
>> chart value element (for example, a bar or pie slice in the chart)
>> could not be changed in Report Designer. Colors were limited to the
>> automatic palette for the entire chart; you could not choose the colors
>> that were assigned to each element. With SP1, the line style and fill
>> color for an element can be edited using Report Designer. You can also
>> use expressions to control these styles.
>> To edit the style of a chart element
>> 1. Using Report Designer, create a chart. For more information about
>> creating a chart, see "Adding a Chart" in Reporting Services Books
>> Online.
>> 2. In Layout view, right-click the chart, and then click Properties.
>> 3. On the Data tab, in Values, select the value to edit, and then click
>> Edit.
>> NOTE: If there is only one value series in the chart, select [Value].
>> 4. On the Appearance tab, click Series Style.
>> 5. On the Border and Line tab, select the line style, width, and color.
>> To use an expression, click the Expression (fx) button next to the
>> desired option.
>> 6. On the Fill tab, select the color, gradient, and gradient end color.
>> To use an expression, click the Expression (fx) button next to the
>> desired option.
>> Note Providing a static value will cause all chart elements for that
>> value series to display using the same style. For example, selecting
>> Red for the fill color will cause all bars to become red, overriding
>> the automatic color assignment from the chart palette. To provide
>> different styles based on field or other values, use an expression. If
>> you use an expression for fill color, the chart elements will be white
>> in Layout view, but will display properly when the report is run.
>> Note A fill color of Transparent will cause the chart elements to
>> display using the automatic color assignment from the chart palette.
>> Kaisa M. Lindahl wrote:
>> > Did you find out how to do it?
>> > I've been wondering about it, didn't find a way to do it.
>> >
>> > Kaisa
>> > "Bryan Avery" <b_avery@.yahoo.com> wrote in message
>> > news:1112708844.404082.158390@.o13g2000cwo.googlegroups.com...
>> > > You need SP1 to be able to do this.
>> > >
>> > > Bryan Avery wrote:
>> > > > The chart contol within Reporting Services only has 7 palette
>> > > options,
>> > > > is it possible to define your own palette?
>> > >
>>|||Thx! Setting the FillColor to Code.GetColor() works!
"Robert Bruckner [MSFT]" wrote:
> RowNumber does not work in charts, because a chart is very similar to a
> matrix (i.e. you have groupings in two dimensions: columns (categories), and
> rows (series)). You cannot use RowNumber in a matrix.
>
> Ok, here is a (trivial) way to use your own custom chart palette.
> You would add the following code to report - report properties - code:
> Private Shared count As Integer = 0
> Private Shared colorPalette As String() = {"Green", "Blue", "Red",
> "Orange", "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B",
> "#352F26", "#F1E7D6", "#E16C56", "#CFBA9B"}
> Public Function GetColor() As String
> Dim c as string = colors(count Mod colors.Length)
> count = count + 1
> Return c
> End Function
> On the datapoint, you would then set the BackgroundColor to
> =Code.GetColor()
>
> A slightly more advanced way of using your own custom chart palette is to
> use the following code:
> Private Shared colorPalette As String() = {"Green", "Blue", "Red",
> "Orange", "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B",
> "#352F26", "#F1E7D6", "#E16C56", "#CFBA9B"}
> Private Shared count As Integer = 0
> Private Shared mapping As New System.Collections.Hashtable()
> Public Function GetColor(ByVal groupingValue As String) As String
> If mapping.ContainsKey(groupingValue) Then
> Return osMapping(groupingValue)
> End If
> Dim c As String = colorPalette(count Mod colorPalette.Length)
> count = count + 1
> mapping.Add(groupingValue, c)
> Return c
> End Function
> You would then typically use the same expression as argument for
> GetColor(...) as you would use on the category grouping expression (assuming
> your expression evaluates to a string). As you can see in the code above,
> the hash table will store color mappings and look up existing color
> mappings. If you have a new group, it will add a new color mapping.
>
> --
> Robert M. Bruckner
> Microsoft SQL Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
> "Hawkeye" <Hawkeye@.discussions.microsoft.com> wrote in message
> news:CF9A87DB-DBB3-4381-A2D2-FC5227ACC79A@.microsoft.com...
> > But what about the expression? Something like "= Choose(RowNumber(Nothing
> > or
> > Dateset name), "#0060A1","#3380B4", "#669FC6", ...)" - which works in
> > detail
> > table rows - does not work in style expressions why? And how to solve the
> > problem?
> >
> > "Bryan Avery" wrote:
> >
> >> Once I'd upgraded to SP1 and RTFM it worked:
> >>
> >> Here is the extract from the SP1 Release notes
> >>
> >> Chart Styles
> >> Chart styles have been enhanced for SP1. Previously, the style of a
> >> chart value element (for example, a bar or pie slice in the chart)
> >> could not be changed in Report Designer. Colors were limited to the
> >> automatic palette for the entire chart; you could not choose the colors
> >> that were assigned to each element. With SP1, the line style and fill
> >> color for an element can be edited using Report Designer. You can also
> >> use expressions to control these styles.
> >>
> >> To edit the style of a chart element
> >>
> >> 1. Using Report Designer, create a chart. For more information about
> >> creating a chart, see "Adding a Chart" in Reporting Services Books
> >> Online.
> >>
> >> 2. In Layout view, right-click the chart, and then click Properties.
> >>
> >> 3. On the Data tab, in Values, select the value to edit, and then click
> >> Edit.
> >>
> >> NOTE: If there is only one value series in the chart, select [Value].
> >> 4. On the Appearance tab, click Series Style.
> >>
> >> 5. On the Border and Line tab, select the line style, width, and color.
> >> To use an expression, click the Expression (fx) button next to the
> >> desired option.
> >>
> >> 6. On the Fill tab, select the color, gradient, and gradient end color.
> >> To use an expression, click the Expression (fx) button next to the
> >> desired option.
> >>
> >> Note Providing a static value will cause all chart elements for that
> >> value series to display using the same style. For example, selecting
> >> Red for the fill color will cause all bars to become red, overriding
> >> the automatic color assignment from the chart palette. To provide
> >> different styles based on field or other values, use an expression. If
> >> you use an expression for fill color, the chart elements will be white
> >> in Layout view, but will display properly when the report is run.
> >> Note A fill color of Transparent will cause the chart elements to
> >> display using the automatic color assignment from the chart palette.
> >> Kaisa M. Lindahl wrote:
> >> > Did you find out how to do it?
> >> > I've been wondering about it, didn't find a way to do it.
> >> >
> >> > Kaisa
> >> > "Bryan Avery" <b_avery@.yahoo.com> wrote in message
> >> > news:1112708844.404082.158390@.o13g2000cwo.googlegroups.com...
> >> > > You need SP1 to be able to do this.
> >> > >
> >> > > Bryan Avery wrote:
> >> > > > The chart contol within Reporting Services only has 7 palette
> >> > > options,
> >> > > > is it possible to define your own palette?
> >> > >
> >>
> >>
>
>|||... It works! But now I want to reuse the colorPalette-Array. So I have to
call a simple sub
Public Sub Reset() count = 0 End Function
How to call this Function in the layout section?
"Robert Bruckner [MSFT]" wrote:
> RowNumber does not work in charts, because a chart is very similar to a
> matrix (i.e. you have groupings in two dimensions: columns (categories), and
> rows (series)). You cannot use RowNumber in a matrix.
>
> Ok, here is a (trivial) way to use your own custom chart palette.
> You would add the following code to report - report properties - code:
> Private Shared count As Integer = 0
> Private Shared colorPalette As String() = {"Green", "Blue", "Red",
> "Orange", "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B",
> "#352F26", "#F1E7D6", "#E16C56", "#CFBA9B"}
> Public Function GetColor() As String
> Dim c as string = colors(count Mod colors.Length)
> count = count + 1
> Return c
> End Function
> On the datapoint, you would then set the BackgroundColor to
> =Code.GetColor()
>
> A slightly more advanced way of using your own custom chart palette is to
> use the following code:
> Private Shared colorPalette As String() = {"Green", "Blue", "Red",
> "Orange", "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B",
> "#352F26", "#F1E7D6", "#E16C56", "#CFBA9B"}
> Private Shared count As Integer = 0
> Private Shared mapping As New System.Collections.Hashtable()
> Public Function GetColor(ByVal groupingValue As String) As String
> If mapping.ContainsKey(groupingValue) Then
> Return osMapping(groupingValue)
> End If
> Dim c As String = colorPalette(count Mod colorPalette.Length)
> count = count + 1
> mapping.Add(groupingValue, c)
> Return c
> End Function
> You would then typically use the same expression as argument for
> GetColor(...) as you would use on the category grouping expression (assuming
> your expression evaluates to a string). As you can see in the code above,
> the hash table will store color mappings and look up existing color
> mappings. If you have a new group, it will add a new color mapping.
>
> --
> Robert M. Bruckner
> Microsoft SQL Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
> "Hawkeye" <Hawkeye@.discussions.microsoft.com> wrote in message
> news:CF9A87DB-DBB3-4381-A2D2-FC5227ACC79A@.microsoft.com...
> > But what about the expression? Something like "= Choose(RowNumber(Nothing
> > or
> > Dateset name), "#0060A1","#3380B4", "#669FC6", ...)" - which works in
> > detail
> > table rows - does not work in style expressions why? And how to solve the
> > problem?
> >
> > "Bryan Avery" wrote:
> >
> >> Once I'd upgraded to SP1 and RTFM it worked:
> >>
> >> Here is the extract from the SP1 Release notes
> >>
> >> Chart Styles
> >> Chart styles have been enhanced for SP1. Previously, the style of a
> >> chart value element (for example, a bar or pie slice in the chart)
> >> could not be changed in Report Designer. Colors were limited to the
> >> automatic palette for the entire chart; you could not choose the colors
> >> that were assigned to each element. With SP1, the line style and fill
> >> color for an element can be edited using Report Designer. You can also
> >> use expressions to control these styles.
> >>
> >> To edit the style of a chart element
> >>
> >> 1. Using Report Designer, create a chart. For more information about
> >> creating a chart, see "Adding a Chart" in Reporting Services Books
> >> Online.
> >>
> >> 2. In Layout view, right-click the chart, and then click Properties.
> >>
> >> 3. On the Data tab, in Values, select the value to edit, and then click
> >> Edit.
> >>
> >> NOTE: If there is only one value series in the chart, select [Value].
> >> 4. On the Appearance tab, click Series Style.
> >>
> >> 5. On the Border and Line tab, select the line style, width, and color.
> >> To use an expression, click the Expression (fx) button next to the
> >> desired option.
> >>
> >> 6. On the Fill tab, select the color, gradient, and gradient end color.
> >> To use an expression, click the Expression (fx) button next to the
> >> desired option.
> >>
> >> Note Providing a static value will cause all chart elements for that
> >> value series to display using the same style. For example, selecting
> >> Red for the fill color will cause all bars to become red, overriding
> >> the automatic color assignment from the chart palette. To provide
> >> different styles based on field or other values, use an expression. If
> >> you use an expression for fill color, the chart elements will be white
> >> in Layout view, but will display properly when the report is run.
> >> Note A fill color of Transparent will cause the chart elements to
> >> display using the automatic color assignment from the chart palette.
> >> Kaisa M. Lindahl wrote:
> >> > Did you find out how to do it?
> >> > I've been wondering about it, didn't find a way to do it.
> >> >
> >> > Kaisa
> >> > "Bryan Avery" <b_avery@.yahoo.com> wrote in message
> >> > news:1112708844.404082.158390@.o13g2000cwo.googlegroups.com...
> >> > > You need SP1 to be able to do this.
> >> > >
> >> > > Bryan Avery wrote:
> >> > > > The chart contol within Reporting Services only has 7 palette
> >> > > options,
> >> > > > is it possible to define your own palette?
> >> > >
> >>
> >>
>
>|||If you don't use the chart title, x-axis title, or y-axis title you could
invoke a function there to reset the palette.
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"Hawkeye" <Hawkeye@.discussions.microsoft.com> wrote in message
news:FBF93B34-3367-4E16-9F45-982E1B7112C4@.microsoft.com...
> ... It works! But now I want to reuse the colorPalette-Array. So I have to
> call a simple sub
> Public Sub Reset() count = 0 End Function
> How to call this Function in the layout section?
>
> "Robert Bruckner [MSFT]" wrote:
>> RowNumber does not work in charts, because a chart is very similar to a
>> matrix (i.e. you have groupings in two dimensions: columns (categories),
>> and
>> rows (series)). You cannot use RowNumber in a matrix.
>>
>> Ok, here is a (trivial) way to use your own custom chart palette.
>> You would add the following code to report - report properties - code:
>> Private Shared count As Integer = 0
>> Private Shared colorPalette As String() = {"Green", "Blue", "Red",
>> "Orange", "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B",
>> "#352F26", "#F1E7D6", "#E16C56", "#CFBA9B"}
>> Public Function GetColor() As String
>> Dim c as string = colors(count Mod colors.Length)
>> count = count + 1
>> Return c
>> End Function
>> On the datapoint, you would then set the BackgroundColor to
>> =Code.GetColor()
>>
>> A slightly more advanced way of using your own custom chart palette is to
>> use the following code:
>> Private Shared colorPalette As String() = {"Green", "Blue", "Red",
>> "Orange", "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B",
>> "#352F26", "#F1E7D6", "#E16C56", "#CFBA9B"}
>> Private Shared count As Integer = 0
>> Private Shared mapping As New System.Collections.Hashtable()
>> Public Function GetColor(ByVal groupingValue As String) As String
>> If mapping.ContainsKey(groupingValue) Then
>> Return osMapping(groupingValue)
>> End If
>> Dim c As String = colorPalette(count Mod colorPalette.Length)
>> count = count + 1
>> mapping.Add(groupingValue, c)
>> Return c
>> End Function
>> You would then typically use the same expression as argument for
>> GetColor(...) as you would use on the category grouping expression
>> (assuming
>> your expression evaluates to a string). As you can see in the code above,
>> the hash table will store color mappings and look up existing color
>> mappings. If you have a new group, it will add a new color mapping.
>>
>> --
>> Robert M. Bruckner
>> Microsoft SQL Server Reporting Services
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>>
>> "Hawkeye" <Hawkeye@.discussions.microsoft.com> wrote in message
>> news:CF9A87DB-DBB3-4381-A2D2-FC5227ACC79A@.microsoft.com...
>> > But what about the expression? Something like "=>> > Choose(RowNumber(Nothing
>> > or
>> > Dateset name), "#0060A1","#3380B4", "#669FC6", ...)" - which works in
>> > detail
>> > table rows - does not work in style expressions why? And how to solve
>> > the
>> > problem?
>> >
>> > "Bryan Avery" wrote:
>> >
>> >> Once I'd upgraded to SP1 and RTFM it worked:
>> >>
>> >> Here is the extract from the SP1 Release notes
>> >>
>> >> Chart Styles
>> >> Chart styles have been enhanced for SP1. Previously, the style of a
>> >> chart value element (for example, a bar or pie slice in the chart)
>> >> could not be changed in Report Designer. Colors were limited to the
>> >> automatic palette for the entire chart; you could not choose the
>> >> colors
>> >> that were assigned to each element. With SP1, the line style and fill
>> >> color for an element can be edited using Report Designer. You can also
>> >> use expressions to control these styles.
>> >>
>> >> To edit the style of a chart element
>> >>
>> >> 1. Using Report Designer, create a chart. For more information about
>> >> creating a chart, see "Adding a Chart" in Reporting Services Books
>> >> Online.
>> >>
>> >> 2. In Layout view, right-click the chart, and then click Properties.
>> >>
>> >> 3. On the Data tab, in Values, select the value to edit, and then
>> >> click
>> >> Edit.
>> >>
>> >> NOTE: If there is only one value series in the chart, select [Value].
>> >> 4. On the Appearance tab, click Series Style.
>> >>
>> >> 5. On the Border and Line tab, select the line style, width, and
>> >> color.
>> >> To use an expression, click the Expression (fx) button next to the
>> >> desired option.
>> >>
>> >> 6. On the Fill tab, select the color, gradient, and gradient end
>> >> color.
>> >> To use an expression, click the Expression (fx) button next to the
>> >> desired option.
>> >>
>> >> Note Providing a static value will cause all chart elements for that
>> >> value series to display using the same style. For example, selecting
>> >> Red for the fill color will cause all bars to become red, overriding
>> >> the automatic color assignment from the chart palette. To provide
>> >> different styles based on field or other values, use an expression. If
>> >> you use an expression for fill color, the chart elements will be white
>> >> in Layout view, but will display properly when the report is run.
>> >> Note A fill color of Transparent will cause the chart elements to
>> >> display using the automatic color assignment from the chart palette.
>> >> Kaisa M. Lindahl wrote:
>> >> > Did you find out how to do it?
>> >> > I've been wondering about it, didn't find a way to do it.
>> >> >
>> >> > Kaisa
>> >> > "Bryan Avery" <b_avery@.yahoo.com> wrote in message
>> >> > news:1112708844.404082.158390@.o13g2000cwo.googlegroups.com...
>> >> > > You need SP1 to be able to do this.
>> >> > >
>> >> > > Bryan Avery wrote:
>> >> > > > The chart contol within Reporting Services only has 7 palette
>> >> > > options,
>> >> > > > is it possible to define your own palette?
>> >> > >
>> >>
>> >>
>>|||I use the chart type "pie chart" so I cannot use x-title or y-title. Is there
an alternative? (Besides using the chart title)
And: How can I call Subs (instead of functions)?
"Robert Bruckner [MSFT]" wrote:
> If you don't use the chart title, x-axis title, or y-axis title you could
> invoke a function there to reset the palette.
>
> -- Robert
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Hawkeye" <Hawkeye@.discussions.microsoft.com> wrote in message
> news:FBF93B34-3367-4E16-9F45-982E1B7112C4@.microsoft.com...
> > ... It works! But now I want to reuse the colorPalette-Array. So I have to
> > call a simple sub
> > Public Sub Reset() count = 0 End Function
> > How to call this Function in the layout section?
> >
> >
> >
> > "Robert Bruckner [MSFT]" wrote:
> >
> >> RowNumber does not work in charts, because a chart is very similar to a
> >> matrix (i.e. you have groupings in two dimensions: columns (categories),
> >> and
> >> rows (series)). You cannot use RowNumber in a matrix.
> >>
> >>
> >> Ok, here is a (trivial) way to use your own custom chart palette.
> >> You would add the following code to report - report properties - code:
> >>
> >> Private Shared count As Integer = 0
> >> Private Shared colorPalette As String() = {"Green", "Blue", "Red",
> >> "Orange", "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B",
> >> "#352F26", "#F1E7D6", "#E16C56", "#CFBA9B"}
> >> Public Function GetColor() As String
> >> Dim c as string = colors(count Mod colors.Length)
> >> count = count + 1
> >> Return c
> >> End Function
> >>
> >> On the datapoint, you would then set the BackgroundColor to
> >> =Code.GetColor()
> >>
> >>
> >> A slightly more advanced way of using your own custom chart palette is to
> >> use the following code:
> >>
> >> Private Shared colorPalette As String() = {"Green", "Blue", "Red",
> >> "Orange", "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B",
> >> "#352F26", "#F1E7D6", "#E16C56", "#CFBA9B"}
> >> Private Shared count As Integer = 0
> >> Private Shared mapping As New System.Collections.Hashtable()
> >> Public Function GetColor(ByVal groupingValue As String) As String
> >> If mapping.ContainsKey(groupingValue) Then
> >> Return osMapping(groupingValue)
> >> End If
> >> Dim c As String = colorPalette(count Mod colorPalette.Length)
> >> count = count + 1
> >> mapping.Add(groupingValue, c)
> >> Return c
> >> End Function
> >>
> >> You would then typically use the same expression as argument for
> >> GetColor(...) as you would use on the category grouping expression
> >> (assuming
> >> your expression evaluates to a string). As you can see in the code above,
> >> the hash table will store color mappings and look up existing color
> >> mappings. If you have a new group, it will add a new color mapping.
> >>
> >>
> >> --
> >> Robert M. Bruckner
> >> Microsoft SQL Server Reporting Services
> >> This posting is provided "AS IS" with no warranties, and confers no
> >> rights.
> >>
> >>
> >>
> >>
> >> "Hawkeye" <Hawkeye@.discussions.microsoft.com> wrote in message
> >> news:CF9A87DB-DBB3-4381-A2D2-FC5227ACC79A@.microsoft.com...
> >> > But what about the expression? Something like "=> >> > Choose(RowNumber(Nothing
> >> > or
> >> > Dateset name), "#0060A1","#3380B4", "#669FC6", ...)" - which works in
> >> > detail
> >> > table rows - does not work in style expressions why? And how to solve
> >> > the
> >> > problem?
> >> >
> >> > "Bryan Avery" wrote:
> >> >
> >> >> Once I'd upgraded to SP1 and RTFM it worked:
> >> >>
> >> >> Here is the extract from the SP1 Release notes
> >> >>
> >> >> Chart Styles
> >> >> Chart styles have been enhanced for SP1. Previously, the style of a
> >> >> chart value element (for example, a bar or pie slice in the chart)
> >> >> could not be changed in Report Designer. Colors were limited to the
> >> >> automatic palette for the entire chart; you could not choose the
> >> >> colors
> >> >> that were assigned to each element. With SP1, the line style and fill
> >> >> color for an element can be edited using Report Designer. You can also
> >> >> use expressions to control these styles.
> >> >>
> >> >> To edit the style of a chart element
> >> >>
> >> >> 1. Using Report Designer, create a chart. For more information about
> >> >> creating a chart, see "Adding a Chart" in Reporting Services Books
> >> >> Online.
> >> >>
> >> >> 2. In Layout view, right-click the chart, and then click Properties.
> >> >>
> >> >> 3. On the Data tab, in Values, select the value to edit, and then
> >> >> click
> >> >> Edit.
> >> >>
> >> >> NOTE: If there is only one value series in the chart, select [Value].
> >> >> 4. On the Appearance tab, click Series Style.
> >> >>
> >> >> 5. On the Border and Line tab, select the line style, width, and
> >> >> color.
> >> >> To use an expression, click the Expression (fx) button next to the
> >> >> desired option.
> >> >>
> >> >> 6. On the Fill tab, select the color, gradient, and gradient end
> >> >> color.
> >> >> To use an expression, click the Expression (fx) button next to the
> >> >> desired option.
> >> >>
> >> >> Note Providing a static value will cause all chart elements for that
> >> >> value series to display using the same style. For example, selecting
> >> >> Red for the fill color will cause all bars to become red, overriding
> >> >> the automatic color assignment from the chart palette. To provide
> >> >> different styles based on field or other values, use an expression. If
> >> >> you use an expression for fill color, the chart elements will be white
> >> >> in Layout view, but will display properly when the report is run.
> >> >> Note A fill color of Transparent will cause the chart elements to
> >> >> display using the automatic color assignment from the chart palette.
> >> >> Kaisa M. Lindahl wrote:
> >> >> > Did you find out how to do it?
> >> >> > I've been wondering about it, didn't find a way to do it.
> >> >> >
> >> >> > Kaisa
> >> >> > "Bryan Avery" <b_avery@.yahoo.com> wrote in message
> >> >> > news:1112708844.404082.158390@.o13g2000cwo.googlegroups.com...
> >> >> > > You need SP1 to be able to do this.
> >> >> > >
> >> >> > > Bryan Avery wrote:
> >> >> > > > The chart contol within Reporting Services only has 7 palette
> >> >> > > options,
> >> >> > > > is it possible to define your own palette?
> >> >> > >
> >> >>
> >> >>
> >>
> >>
> >>
>
>|||Hi,
I tried the attached code and I received this error: There is an error on
line 1 of custom code: [BC30201] Expression expected.
Can someone tell me what I'm doing wrong?
Thanks!
"Hawkeye" wrote:
> I use the chart type "pie chart" so I cannot use x-title or y-title. Is there
> an alternative? (Besides using the chart title)
> And: How can I call Subs (instead of functions)?
>
>
> "Robert Bruckner [MSFT]" wrote:
> > If you don't use the chart title, x-axis title, or y-axis title you could
> > invoke a function there to reset the palette.
> >
> >
> > -- Robert
> > This posting is provided "AS IS" with no warranties, and confers no rights.
> >
> >
> > "Hawkeye" <Hawkeye@.discussions.microsoft.com> wrote in message
> > news:FBF93B34-3367-4E16-9F45-982E1B7112C4@.microsoft.com...
> > > ... It works! But now I want to reuse the colorPalette-Array. So I have to
> > > call a simple sub
> > > Public Sub Reset() count = 0 End Function
> > > How to call this Function in the layout section?
> > >
> > >
> > >
> > > "Robert Bruckner [MSFT]" wrote:
> > >
> > >> RowNumber does not work in charts, because a chart is very similar to a
> > >> matrix (i.e. you have groupings in two dimensions: columns (categories),
> > >> and
> > >> rows (series)). You cannot use RowNumber in a matrix.
> > >>
> > >>
> > >> Ok, here is a (trivial) way to use your own custom chart palette.
> > >> You would add the following code to report - report properties - code:
> > >>
> > >> Private Shared count As Integer = 0
> > >> Private Shared colorPalette As String() = {"Green", "Blue", "Red",
> > >> "Orange", "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B",
> > >> "#352F26", "#F1E7D6", "#E16C56", "#CFBA9B"}
> > >> Public Function GetColor() As String
> > >> Dim c as string = colors(count Mod colors.Length)
> > >> count = count + 1
> > >> Return c
> > >> End Function
> > >>
> > >> On the datapoint, you would then set the BackgroundColor to
> > >> =Code.GetColor()
> > >>
> > >>
> > >> A slightly more advanced way of using your own custom chart palette is to
> > >> use the following code:
> > >>
> > >> Private Shared colorPalette As String() = {"Green", "Blue", "Red",
> > >> "Orange", "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B",
> > >> "#352F26", "#F1E7D6", "#E16C56", "#CFBA9B"}
> > >> Private Shared count As Integer = 0
> > >> Private Shared mapping As New System.Collections.Hashtable()
> > >> Public Function GetColor(ByVal groupingValue As String) As String
> > >> If mapping.ContainsKey(groupingValue) Then
> > >> Return osMapping(groupingValue)
> > >> End If
> > >> Dim c As String = colorPalette(count Mod colorPalette.Length)
> > >> count = count + 1
> > >> mapping.Add(groupingValue, c)
> > >> Return c
> > >> End Function
> > >>
> > >> You would then typically use the same expression as argument for
> > >> GetColor(...) as you would use on the category grouping expression
> > >> (assuming
> > >> your expression evaluates to a string). As you can see in the code above,
> > >> the hash table will store color mappings and look up existing color
> > >> mappings. If you have a new group, it will add a new color mapping.
> > >>
> > >>
> > >> --
> > >> Robert M. Bruckner
> > >> Microsoft SQL Server Reporting Services
> > >> This posting is provided "AS IS" with no warranties, and confers no
> > >> rights.
> > >>
> > >>
> > >>
> > >>
> > >> "Hawkeye" <Hawkeye@.discussions.microsoft.com> wrote in message
> > >> news:CF9A87DB-DBB3-4381-A2D2-FC5227ACC79A@.microsoft.com...
> > >> > But what about the expression? Something like "=> > >> > Choose(RowNumber(Nothing
> > >> > or
> > >> > Dateset name), "#0060A1","#3380B4", "#669FC6", ...)" - which works in
> > >> > detail
> > >> > table rows - does not work in style expressions why? And how to solve
> > >> > the
> > >> > problem?
> > >> >
> > >> > "Bryan Avery" wrote:
> > >> >
> > >> >> Once I'd upgraded to SP1 and RTFM it worked:
> > >> >>
> > >> >> Here is the extract from the SP1 Release notes
> > >> >>
> > >> >> Chart Styles
> > >> >> Chart styles have been enhanced for SP1. Previously, the style of a
> > >> >> chart value element (for example, a bar or pie slice in the chart)
> > >> >> could not be changed in Report Designer. Colors were limited to the
> > >> >> automatic palette for the entire chart; you could not choose the
> > >> >> colors
> > >> >> that were assigned to each element. With SP1, the line style and fill
> > >> >> color for an element can be edited using Report Designer. You can also
> > >> >> use expressions to control these styles.
> > >> >>
> > >> >> To edit the style of a chart element
> > >> >>
> > >> >> 1. Using Report Designer, create a chart. For more information about
> > >> >> creating a chart, see "Adding a Chart" in Reporting Services Books
> > >> >> Online.
> > >> >>
> > >> >> 2. In Layout view, right-click the chart, and then click Properties.
> > >> >>
> > >> >> 3. On the Data tab, in Values, select the value to edit, and then
> > >> >> click
> > >> >> Edit.
> > >> >>
> > >> >> NOTE: If there is only one value series in the chart, select [Value].
> > >> >> 4. On the Appearance tab, click Series Style.
> > >> >>
> > >> >> 5. On the Border and Line tab, select the line style, width, and
> > >> >> color.
> > >> >> To use an expression, click the Expression (fx) button next to the
> > >> >> desired option.
> > >> >>
> > >> >> 6. On the Fill tab, select the color, gradient, and gradient end
> > >> >> color.
> > >> >> To use an expression, click the Expression (fx) button next to the
> > >> >> desired option.
> > >> >>
> > >> >> Note Providing a static value will cause all chart elements for that
> > >> >> value series to display using the same style. For example, selecting
> > >> >> Red for the fill color will cause all bars to become red, overriding
> > >> >> the automatic color assignment from the chart palette. To provide
> > >> >> different styles based on field or other values, use an expression. If
> > >> >> you use an expression for fill color, the chart elements will be white
> > >> >> in Layout view, but will display properly when the report is run.
> > >> >> Note A fill color of Transparent will cause the chart elements to
> > >> >> display using the automatic color assignment from the chart palette.
> > >> >> Kaisa M. Lindahl wrote:
> > >> >> > Did you find out how to do it?
> > >> >> > I've been wondering about it, didn't find a way to do it.
> > >> >> >
> > >> >> > Kaisa
> > >> >> > "Bryan Avery" <b_avery@.yahoo.com> wrote in message
> > >> >> > news:1112708844.404082.158390@.o13g2000cwo.googlegroups.com...
> > >> >> > > You need SP1 to be able to do this.
> > >> >> > >
> > >> >> > > Bryan Avery wrote:
> > >> >> > > > The chart contol within Reporting Services only has 7 palette
> > >> >> > > options,
> > >> >> > > > is it possible to define your own palette?
> > >> >> > >
> > >> >>
> > >> >>
> > >>
> > >>
> > >>
> >
> >
> >|||>I use the chart type "pie chart" so I cannot use x-title or y-title. Is
>there an alternative? (Besides using the chart title)
You could, for instance, call the expression in the following place:
* open chart properties dialog
* click on the "chart area style" button in the general tab
* e.g. for the Style property use an expression like =Code.ResetColor
* Add the following function on the custom code window:
Public Function ResetColor() As String
count = 0
Return "None"
End Function
> And: How can I call Subs (instead of functions)?
You would convert the sub into a function which returns a string
representing the value you would want to set anyway on that property. But in
addition you would reset the count. See example above.
Alternatively, you could define multiple color palettes and multiple
GetColor functions. In that case there would be no need to reset because you
don't share the palette in multiple charts (or data regions in general).
BTW: my advanced sample in my previous posting had a minor typo which is
fixed below.
Private Shared colorPalette As String() = {"Green", "Blue", "Red", "Orange",
"Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B", "#352F26",
"#F1E7D6", "#E16C56", "#CFBA9B"}
Private Shared count As Integer = 0
Private Shared mapping As New System.Collections.Hashtable()
Public Function GetColor(ByVal groupingValue As String) As String
If mapping.ContainsKey(groupingValue) Then
Return mapping(groupingValue)
End If
Dim c As String = colorPalette(count Mod colorPalette.Length)
count = count + 1
mapping.Add(groupingValue, c)
Return c
End Function
At the bottom I added a fully functional RDL file which shows the usage of
custom palettes.
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
=====================================================
<?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>
<Author>Robert M. Bruckner</Author>
<Body>
<ReportItems>
<Table Name="table1">
<Height>0.5in</Height>
<ZIndex>1</ZIndex>
<Style />
<Header>
<TableRows>
<TableRow>
<Height>0.25in</Height>
<TableCells>
<TableCell>
<ReportItems>
<Textbox Name="textbox1">
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
</Style>
<ZIndex>3</ZIndex>
<rd:DefaultName>textbox1</rd:DefaultName>
<CanGrow>true</CanGrow>
<Value />
</Textbox>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="textbox2">
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
<FontWeight>700</FontWeight>
</Style>
<ZIndex>2</ZIndex>
<rd:DefaultName>textbox2</rd:DefaultName>
<CanGrow>true</CanGrow>
<Value>Legend</Value>
</Textbox>
</ReportItems>
</TableCell>
</TableCells>
</TableRow>
</TableRows>
</Header>
<DataSetName>DataSet1</DataSetName>
<Top>0.125in</Top>
<Width>2in</Width>
<TableGroups>
<TableGroup>
<Header>
<TableRows>
<TableRow>
<Height>0.25in</Height>
<TableCells>
<TableCell>
<ReportItems>
<Rectangle Name="rectangle1">
<ZIndex>1</ZIndex>
<Style>
<BackgroundColor>=Code.GetColor(Fields!CategoryName.Value)</BackgroundColor>
</Style>
</Rectangle>
</ReportItems>
</TableCell>
<TableCell>
<ReportItems>
<Textbox Name="CategoryName">
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<PaddingTop>2pt</PaddingTop>
<PaddingRight>2pt</PaddingRight>
</Style>
<rd:DefaultName>CategoryName</rd:DefaultName>
<CanGrow>true</CanGrow>
<Value>=Fields!CategoryName.Value</Value>
</Textbox>
</ReportItems>
</TableCell>
</TableCells>
</TableRow>
</TableRows>
</Header>
<Grouping Name="table1_Group1">
<GroupExpressions>
<GroupExpression>=Fields!CategoryName.Value</GroupExpression>
</GroupExpressions>
</Grouping>
<Sorting>
<SortBy>
<SortExpression>=Fields!CategoryName.Value</SortExpression>
<Direction>Ascending</Direction>
</SortBy>
</Sorting>
</TableGroup>
</TableGroups>
<Left>3.25in</Left>
<TableColumns>
<TableColumn>
<Width>0.25in</Width>
</TableColumn>
<TableColumn>
<Width>1.75in</Width>
</TableColumn>
</TableColumns>
</Table>
<Chart Name="chart1">
<ThreeDProperties>
<Rotation>30</Rotation>
<Inclination>30</Inclination>
<Shading>Simple</Shading>
<WallThickness>50</WallThickness>
</ThreeDProperties>
<Style>
<BackgroundColor>White</BackgroundColor>
</Style>
<Legend>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
<Position>BottomCenter</Position>
<Layout>Table</Layout>
</Legend>
<Palette>Default</Palette>
<ChartData>
<ChartSeries>
<DataPoints>
<DataPoint>
<DataValues>
<DataValue>
<Value>=Sum(Fields!UnitsInStock.Value)</Value>
</DataValue>
</DataValues>
<DataLabel />
<Style>
<BackgroundColor>=Code.GetColor(Fields!CategoryName.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>
<Min>0</Min>
</Axis>
</CategoryAxis>
<DataSetName>DataSet1</DataSetName>
<PointWidth>0</PointWidth>
<Type>Bar</Type>
<Top>0.25in</Top>
<Title />
<Width>3in</Width>
<Height>2.5in</Height>
<SeriesGroupings>
<SeriesGrouping>
<DynamicSeries>
<Grouping Name="chart1_SeriesGroup1">
<GroupExpressions>
<GroupExpression>=Fields!CategoryName.Value</GroupExpression>
</GroupExpressions>
</Grouping>
<Sorting>
<SortBy>
<SortExpression>=Fields!CategoryName.Value</SortExpression>
<Direction>Ascending</Direction>
</SortBy>
</Sorting>
<Label>=Fields!CategoryName.Value</Label>
</DynamicSeries>
</SeriesGrouping>
</SeriesGroupings>
<Subtype>Plain</Subtype>
<PlotArea>
<Style>
<BackgroundColor>LightGrey</BackgroundColor>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
</PlotArea>
<Left>0.125in</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.25in</Height>
</Body>
<TopMargin>1in</TopMargin>
<DataSources>
<DataSource Name="Northwind">
<rd:DataSourceID>f646058b-4784-494d-a09d-27fde13a5679</rd:DataSourceID>
<ConnectionProperties>
<DataProvider>SQL</DataProvider>
<ConnectString>data source=(local);initial
catalog=Northwind</ConnectString>
<IntegratedSecurity>true</IntegratedSecurity>
</ConnectionProperties>
</DataSource>
</DataSources>
<Code> Private Shared colorPalette As String() = {"Green", "Blue",
"Red", "Orange", "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B",
"#352F26", "#F1E7D6", "#E16C56", "#CFBA9B"}
Private Shared count As Integer = 0
Private Shared mapping As New System.Collections.Hashtable()
Public Function GetColor(ByVal groupingValue As String) As String
If mapping.ContainsKey(groupingValue) Then
Return mapping(groupingValue)
End If
Dim c As String = colorPalette(count Mod colorPalette.Length)
count = count + 1
mapping.Add(groupingValue, c)
Return c
End Function
</Code>
<Width>6.5in</Width>
<DataSets>
<DataSet Name="DataSet1">
<Fields>
<Field Name="ProductID">
<DataField>ProductID</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
<Field Name="ProductName">
<DataField>ProductName</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="SupplierID">
<DataField>SupplierID</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
<Field Name="CategoryID">
<DataField>CategoryID</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
<Field Name="QuantityPerUnit">
<DataField>QuantityPerUnit</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="UnitPrice">
<DataField>UnitPrice</DataField>
<rd:TypeName>System.Decimal</rd:TypeName>
</Field>
<Field Name="UnitsInStock">
<DataField>UnitsInStock</DataField>
<rd:TypeName>System.Int16</rd:TypeName>
</Field>
<Field Name="UnitsOnOrder">
<DataField>UnitsOnOrder</DataField>
<rd:TypeName>System.Int16</rd:TypeName>
</Field>
<Field Name="ReorderLevel">
<DataField>ReorderLevel</DataField>
<rd:TypeName>System.Int16</rd:TypeName>
</Field>
<Field Name="Discontinued">
<DataField>Discontinued</DataField>
<rd:TypeName>System.Boolean</rd:TypeName>
</Field>
<Field Name="CategoryName">
<DataField>CategoryName</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Country">
<DataField>Country</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
</Fields>
<Query>
<DataSourceName>Northwind</DataSourceName>
<CommandText>SELECT Products.*, Categories.CategoryName,
Suppliers.Country
FROM Products INNER JOIN
Categories ON Products.CategoryID =Categories.CategoryID INNER JOIN
Suppliers ON Products.SupplierID =Suppliers.SupplierID</CommandText>
</Query>
</DataSet>
</DataSets>
<LeftMargin>1in</LeftMargin>
<rd:SnapToGrid>true</rd:SnapToGrid>
<rd:DrawGrid>true</rd:DrawGrid>
<rd:ReportID>e5564b0f-4fab-4cf7-9cef-bda726589920</rd:ReportID>
<BottomMargin>1in</BottomMargin>
<Language>en-US</Language>
</Report>|||That works! I couldn't use subs, could I?
What I found interesting is that without reseting the counter, the last
value of the counter resist in memory so that for the next run (!) of the
report the counter is not only not reinit to zero, but also further increased.
Is that the normal behaviour of shared report variables?
"Robert Bruckner [MSFT]" wrote:
> >I use the chart type "pie chart" so I cannot use x-title or y-title. Is
> >there an alternative? (Besides using the chart title)
> You could, for instance, call the expression in the following place:
> * open chart properties dialog
> * click on the "chart area style" button in the general tab
> * e.g. for the Style property use an expression like =Code.ResetColor
> * Add the following function on the custom code window:
> Public Function ResetColor() As String
> count = 0
> Return "None"
> End Function
> > And: How can I call Subs (instead of functions)?
> You would convert the sub into a function which returns a string
> representing the value you would want to set anyway on that property. But in
> addition you would reset the count. See example above.
>
> Alternatively, you could define multiple color palettes and multiple
> GetColor functions. In that case there would be no need to reset because you
> don't share the palette in multiple charts (or data regions in general).
> BTW: my advanced sample in my previous posting had a minor typo which is
> fixed below.
> Private Shared colorPalette As String() = {"Green", "Blue", "Red", "Orange",
> "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B", "#352F26",
> "#F1E7D6", "#E16C56", "#CFBA9B"}
> Private Shared count As Integer = 0
> Private Shared mapping As New System.Collections.Hashtable()
> Public Function GetColor(ByVal groupingValue As String) As String
> If mapping.ContainsKey(groupingValue) Then
> Return mapping(groupingValue)
> End If
> Dim c As String = colorPalette(count Mod colorPalette.Length)
> count = count + 1
> mapping.Add(groupingValue, c)
> Return c
> End Function
>
> At the bottom I added a fully functional RDL file which shows the usage of
> custom palettes.
>
> -- Robert
> This posting is provided "AS IS" with no warranties, and confers no rights.
> =====================================================> <?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>
> <Author>Robert M. Bruckner</Author>
> <Body>
> <ReportItems>
> <Table Name="table1">
> <Height>0.5in</Height>
> <ZIndex>1</ZIndex>
> <Style />
> <Header>
> <TableRows>
> <TableRow>
> <Height>0.25in</Height>
> <TableCells>
> <TableCell>
> <ReportItems>
> <Textbox Name="textbox1">
> <Style>
> <PaddingLeft>2pt</PaddingLeft>
> <PaddingBottom>2pt</PaddingBottom>
> <PaddingTop>2pt</PaddingTop>
> <PaddingRight>2pt</PaddingRight>
> </Style>
> <ZIndex>3</ZIndex>
> <rd:DefaultName>textbox1</rd:DefaultName>
> <CanGrow>true</CanGrow>
> <Value />
> </Textbox>
> </ReportItems>
> </TableCell>
> <TableCell>
> <ReportItems>
> <Textbox Name="textbox2">
> <Style>
> <PaddingLeft>2pt</PaddingLeft>
> <PaddingBottom>2pt</PaddingBottom>
> <PaddingTop>2pt</PaddingTop>
> <PaddingRight>2pt</PaddingRight>
> <FontWeight>700</FontWeight>
> </Style>
> <ZIndex>2</ZIndex>
> <rd:DefaultName>textbox2</rd:DefaultName>
> <CanGrow>true</CanGrow>
> <Value>Legend</Value>
> </Textbox>
> </ReportItems>
> </TableCell>
> </TableCells>
> </TableRow>
> </TableRows>
> </Header>
> <DataSetName>DataSet1</DataSetName>
> <Top>0.125in</Top>
> <Width>2in</Width>
> <TableGroups>
> <TableGroup>
> <Header>
> <TableRows>
> <TableRow>
> <Height>0.25in</Height>
> <TableCells>
> <TableCell>
> <ReportItems>
> <Rectangle Name="rectangle1">
> <ZIndex>1</ZIndex>
> <Style>
> <BackgroundColor>=Code.GetColor(Fields!CategoryName.Value)</BackgroundColor>
> </Style>
> </Rectangle>
> </ReportItems>
> </TableCell>
> <TableCell>
> <ReportItems>
> <Textbox Name="CategoryName">
> <Style>
> <PaddingLeft>2pt</PaddingLeft>
> <PaddingBottom>2pt</PaddingBottom>
> <PaddingTop>2pt</PaddingTop>
> <PaddingRight>2pt</PaddingRight>
> </Style>
> <rd:DefaultName>CategoryName</rd:DefaultName>
> <CanGrow>true</CanGrow>
> <Value>=Fields!CategoryName.Value</Value>
> </Textbox>
> </ReportItems>
> </TableCell>
> </TableCells>
> </TableRow>
> </TableRows>
> </Header>
> <Grouping Name="table1_Group1">
> <GroupExpressions>
> <GroupExpression>=Fields!CategoryName.Value</GroupExpression>
> </GroupExpressions>
> </Grouping>
> <Sorting>
> <SortBy>
> <SortExpression>=Fields!CategoryName.Value</SortExpression>
> <Direction>Ascending</Direction>
> </SortBy>
> </Sorting>
> </TableGroup>
> </TableGroups>
> <Left>3.25in</Left>
> <TableColumns>
> <TableColumn>
> <Width>0.25in</Width>
> </TableColumn>
> <TableColumn>
> <Width>1.75in</Width>
> </TableColumn>
> </TableColumns>
> </Table>
> <Chart Name="chart1">
> <ThreeDProperties>
> <Rotation>30</Rotation>
> <Inclination>30</Inclination>
> <Shading>Simple</Shading>
> <WallThickness>50</WallThickness>
> </ThreeDProperties>
> <Style>
> <BackgroundColor>White</BackgroundColor>
> </Style>
> <Legend>
> <Style>
> <BorderStyle>
> <Default>Solid</Default>
> </BorderStyle>
> </Style>
> <Position>BottomCenter</Position>
> <Layout>Table</Layout>
> </Legend>
> <Palette>Default</Palette>
> <ChartData>
> <ChartSeries>
> <DataPoints>
> <DataPoint>
> <DataValues>
> <DataValue>
> <Value>=Sum(Fields!UnitsInStock.Value)</Value>
> </DataValue>
> </DataValues>
> <DataLabel />
> <Style>
> <BackgroundColor>=Code.GetColor(Fields!CategoryName.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>
> <Min>0</Min>
> </Axis>
> </CategoryAxis>
> <DataSetName>DataSet1</DataSetName>
> <PointWidth>0</PointWidth>
> <Type>Bar</Type>
> <Top>0.25in</Top>
> <Title />
> <Width>3in</Width>
> <Height>2.5in</Height>
> <SeriesGroupings>
> <SeriesGrouping>
> <DynamicSeries>
> <Grouping Name="chart1_SeriesGroup1">
> <GroupExpressions>
> <GroupExpression>=Fields!CategoryName.Value</GroupExpression>
> </GroupExpressions>
> </Grouping>
> <Sorting>
> <SortBy>
> <SortExpression>=Fields!CategoryName.Value</SortExpression>
> <Direction>Ascending</Direction>
> </SortBy>
> </Sorting>
> <Label>=Fields!CategoryName.Value</Label>
> </DynamicSeries>
> </SeriesGrouping>
> </SeriesGroupings>
> <Subtype>Plain</Subtype>
> <PlotArea>
> <Style>
> <BackgroundColor>LightGrey</BackgroundColor>
> <BorderStyle>
> <Default>Solid</Default>
> </BorderStyle>
> </Style>
> </PlotArea>
> <Left>0.125in</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.25in</Height>
> </Body>
> <TopMargin>1in</TopMargin>
> <DataSources>
> <DataSource Name="Northwind">
> <rd:DataSourceID>f646058b-4784-494d-a09d-27fde13a5679</rd:DataSourceID>
> <ConnectionProperties>
> <DataProvider>SQL</DataProvider>
> <ConnectString>data source=(local);initial
> catalog=Northwind</ConnectString>|||Yes, the variables are marked as shared - so they are really shared across
all requests on a server. One way to solve this is to use e.g. a hashtable
storing the counter based on the username (from the Globals collection) to
make sure that different users running the same report at the same time
can't affect each other.
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"Hawkeye" <Hawkeye@.discussions.microsoft.com> wrote in message
news:91642910-E126-408B-A2A9-1F5B02BEB7FE@.microsoft.com...
> That works! I couldn't use subs, could I?
> What I found interesting is that without reseting the counter, the last
> value of the counter resist in memory so that for the next run (!) of the
> report the counter is not only not reinit to zero, but also further
> increased.
> Is that the normal behaviour of shared report variables?
>
> "Robert Bruckner [MSFT]" wrote:
>> >I use the chart type "pie chart" so I cannot use x-title or y-title. Is
>> >there an alternative? (Besides using the chart title)
>> You could, for instance, call the expression in the following place:
>> * open chart properties dialog
>> * click on the "chart area style" button in the general tab
>> * e.g. for the Style property use an expression like =Code.ResetColor
>> * Add the following function on the custom code window:
>> Public Function ResetColor() As String
>> count = 0
>> Return "None"
>> End Function
>> > And: How can I call Subs (instead of functions)?
>> You would convert the sub into a function which returns a string
>> representing the value you would want to set anyway on that property. But
>> in
>> addition you would reset the count. See example above.
>>
>> Alternatively, you could define multiple color palettes and multiple
>> GetColor functions. In that case there would be no need to reset because
>> you
>> don't share the palette in multiple charts (or data regions in general).
>> BTW: my advanced sample in my previous posting had a minor typo which is
>> fixed below.
>> Private Shared colorPalette As String() = {"Green", "Blue", "Red",
>> "Orange",
>> "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B", "#352F26",
>> "#F1E7D6", "#E16C56", "#CFBA9B"}
>> Private Shared count As Integer = 0
>> Private Shared mapping As New System.Collections.Hashtable()
>> Public Function GetColor(ByVal groupingValue As String) As String
>> If mapping.ContainsKey(groupingValue) Then
>> Return mapping(groupingValue)
>> End If
>> Dim c As String = colorPalette(count Mod colorPalette.Length)
>> count = count + 1
>> mapping.Add(groupingValue, c)
>> Return c
>> End Function
>>
>> At the bottom I added a fully functional RDL file which shows the usage
>> of
>> custom palettes.
>>
>> -- Robert
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> =====================================================>> <?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>
>> <Author>Robert M. Bruckner</Author>
>> <Body>
>> <ReportItems>
>> <Table Name="table1">
>> <Height>0.5in</Height>
>> <ZIndex>1</ZIndex>
>> <Style />
>> <Header>
>> <TableRows>
>> <TableRow>
>> <Height>0.25in</Height>
>> <TableCells>
>> <TableCell>
>> <ReportItems>
>> <Textbox Name="textbox1">
>> <Style>
>> <PaddingLeft>2pt</PaddingLeft>
>> <PaddingBottom>2pt</PaddingBottom>
>> <PaddingTop>2pt</PaddingTop>
>> <PaddingRight>2pt</PaddingRight>
>> </Style>
>> <ZIndex>3</ZIndex>
>> <rd:DefaultName>textbox1</rd:DefaultName>
>> <CanGrow>true</CanGrow>
>> <Value />
>> </Textbox>
>> </ReportItems>
>> </TableCell>
>> <TableCell>
>> <ReportItems>
>> <Textbox Name="textbox2">
>> <Style>
>> <PaddingLeft>2pt</PaddingLeft>
>> <PaddingBottom>2pt</PaddingBottom>
>> <PaddingTop>2pt</PaddingTop>
>> <PaddingRight>2pt</PaddingRight>
>> <FontWeight>700</FontWeight>
>> </Style>
>> <ZIndex>2</ZIndex>
>> <rd:DefaultName>textbox2</rd:DefaultName>
>> <CanGrow>true</CanGrow>
>> <Value>Legend</Value>
>> </Textbox>
>> </ReportItems>
>> </TableCell>
>> </TableCells>
>> </TableRow>
>> </TableRows>
>> </Header>
>> <DataSetName>DataSet1</DataSetName>
>> <Top>0.125in</Top>
>> <Width>2in</Width>
>> <TableGroups>
>> <TableGroup>
>> <Header>
>> <TableRows>
>> <TableRow>
>> <Height>0.25in</Height>
>> <TableCells>
>> <TableCell>
>> <ReportItems>
>> <Rectangle Name="rectangle1">
>> <ZIndex>1</ZIndex>
>> <Style>
>> <BackgroundColor>=Code.GetColor(Fields!CategoryName.Value)</BackgroundColor>
>> </Style>
>> </Rectangle>
>> </ReportItems>
>> </TableCell>
>> <TableCell>
>> <ReportItems>
>> <Textbox Name="CategoryName">
>> <Style>
>> <PaddingLeft>2pt</PaddingLeft>
>> <PaddingBottom>2pt</PaddingBottom>
>> <PaddingTop>2pt</PaddingTop>
>> <PaddingRight>2pt</PaddingRight>
>> </Style>
>> <rd:DefaultName>CategoryName</rd:DefaultName>
>> <CanGrow>true</CanGrow>
>> <Value>=Fields!CategoryName.Value</Value>
>> </Textbox>
>> </ReportItems>
>> </TableCell>
>> </TableCells>
>> </TableRow>
>> </TableRows>
>> </Header>
>> <Grouping Name="table1_Group1">
>> <GroupExpressions>
>> <GroupExpression>=Fields!CategoryName.Value</GroupExpression>
>> </GroupExpressions>
>> </Grouping>
>> <Sorting>
>> <SortBy>
>> <SortExpression>=Fields!CategoryName.Value</SortExpression>
>> <Direction>Ascending</Direction>
>> </SortBy>
>> </Sorting>
>> </TableGroup>
>> </TableGroups>
>> <Left>3.25in</Left>
>> <TableColumns>
>> <TableColumn>
>> <Width>0.25in</Width>
>> </TableColumn>
>> <TableColumn>
>> <Width>1.75in</Width>
>> </TableColumn>
>> </TableColumns>
>> </Table>
>> <Chart Name="chart1">
>> <ThreeDProperties>
>> <Rotation>30</Rotation>
>> <Inclination>30</Inclination>
>> <Shading>Simple</Shading>
>> <WallThickness>50</WallThickness>
>> </ThreeDProperties>
>> <Style>
>> <BackgroundColor>White</BackgroundColor>
>> </Style>
>> <Legend>
>> <Style>
>> <BorderStyle>
>> <Default>Solid</Default>
>> </BorderStyle>
>> </Style>
>> <Position>BottomCenter</Position>
>> <Layout>Table</Layout>
>> </Legend>
>> <Palette>Default</Palette>
>> <ChartData>
>> <ChartSeries>
>> <DataPoints>
>> <DataPoint>
>> <DataValues>
>> <DataValue>
>> <Value>=Sum(Fields!UnitsInStock.Value)</Value>
>> </DataValue>
>> </DataValues>
>> <DataLabel />
>> <Style>
>> <BackgroundColor>=Code.GetColor(Fields!CategoryName.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>
>> <Min>0</Min>
>> </Axis>
>> </CategoryAxis>
>> <DataSetName>DataSet1</DataSetName>
>> <PointWidth>0</PointWidth>
>> <Type>Bar</Type>
>> <Top>0.25in</Top>
>> <Title />
>> <Width>3in</Width>
>> <Height>2.5in</Height>
>> <SeriesGroupings>
>> <SeriesGrouping>
>> <DynamicSeries>
>> <Grouping Name="chart1_SeriesGroup1">
>> <GroupExpressions>
>> <GroupExpression>=Fields!CategoryName.Value</GroupExpression>
>> </GroupExpressions>
>> </Grouping>
>> <Sorting>
>> <SortBy>
>> <SortExpression>=Fields!CategoryName.Value</SortExpression>
>> <Direction>Ascending</Direction>
>> </SortBy>
>> </Sorting>
>> <Label>=Fields!CategoryName.Value</Label>
>> </DynamicSeries>
>> </SeriesGrouping>
>> </SeriesGroupings>
>> <Subtype>Plain</Subtype>
>> <PlotArea>
>> <Style>
>> <BackgroundColor>LightGrey</BackgroundColor>
>> <BorderStyle>
>> <Default>Solid</Default>
>> </BorderStyle>
>> </Style>
>> </PlotArea>
>> <Left>0.125in</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.25in</Height>
>> </Body>
>> <TopMargin>1in</TopMargin>
>> <DataSources>
>> <DataSource Name="Northwind">
>> <rd:DataSourceID>f646058b-4784-494d-a09d-27fde13a5679</rd:DataSourceID>
>> <ConnectionProperties>
>> <DataProvider>SQL</DataProvider>
>> <ConnectString>data source=(local);initial
>> catalog=Northwind</ConnectString>|||Actually, in this case it would also work without defining the variables as
shared.
i.e.:
Private count As Integer = 0
Private mapping As New System.Collections.Hashtable()
...
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Robert Bruckner [MSFT]" <robruc@.online.microsoft.com> wrote in message
news:%23IohCWXXFHA.712@.TK2MSFTNGP14.phx.gbl...
> Yes, the variables are marked as shared - so they are really shared across
> all requests on a server. One way to solve this is to use e.g. a hashtable
> storing the counter based on the username (from the Globals collection) to
> make sure that different users running the same report at the same time
> can't affect each other.
> -- Robert
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
> "Hawkeye" <Hawkeye@.discussions.microsoft.com> wrote in message
> news:91642910-E126-408B-A2A9-1F5B02BEB7FE@.microsoft.com...
>> That works! I couldn't use subs, could I?
>> What I found interesting is that without reseting the counter, the last
>> value of the counter resist in memory so that for the next run (!) of the
>> report the counter is not only not reinit to zero, but also further
>> increased.
>> Is that the normal behaviour of shared report variables?
>>
>> "Robert Bruckner [MSFT]" wrote:
>> >I use the chart type "pie chart" so I cannot use x-title or y-title. Is
>> >there an alternative? (Besides using the chart title)
>> You could, for instance, call the expression in the following place:
>> * open chart properties dialog
>> * click on the "chart area style" button in the general tab
>> * e.g. for the Style property use an expression like =Code.ResetColor
>> * Add the following function on the custom code window:
>> Public Function ResetColor() As String
>> count = 0
>> Return "None"
>> End Function
>> > And: How can I call Subs (instead of functions)?
>> You would convert the sub into a function which returns a string
>> representing the value you would want to set anyway on that property.
>> But in
>> addition you would reset the count. See example above.
>>
>> Alternatively, you could define multiple color palettes and multiple
>> GetColor functions. In that case there would be no need to reset because
>> you
>> don't share the palette in multiple charts (or data regions in general).
>> BTW: my advanced sample in my previous posting had a minor typo which is
>> fixed below.
>> Private Shared colorPalette As String() = {"Green", "Blue", "Red",
>> "Orange",
>> "Aqua", "Teal", "Gold", "RoyalBlue", "#A59D93", "#B8341B", "#352F26",
>> "#F1E7D6", "#E16C56", "#CFBA9B"}
>> Private Shared count As Integer = 0
>> Private Shared mapping As New System.Collections.Hashtable()
>> Public Function GetColor(ByVal groupingValue As String) As String
>> If mapping.ContainsKey(groupingValue) Then
>> Return mapping(groupingValue)
>> End If
>> Dim c As String = colorPalette(count Mod colorPalette.Length)
>> count = count + 1
>> mapping.Add(groupingValue, c)
>> Return c
>> End Function
>>
>> At the bottom I added a fully functional RDL file which shows the usage
>> of
>> custom palettes.
>>
>> -- Robert
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>> =====================================================>> <?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>
>> <Author>Robert M. Bruckner</Author>
>> <Body>
>> <ReportItems>
>> <Table Name="table1">
>> <Height>0.5in</Height>
>> <ZIndex>1</ZIndex>
>> <Style />
>> <Header>
>> <TableRows>
>> <TableRow>
>> <Height>0.25in</Height>
>> <TableCells>
>> <TableCell>
>> <ReportItems>
>> <Textbox Name="textbox1">
>> <Style>
>> <PaddingLeft>2pt</PaddingLeft>
>> <PaddingBottom>2pt</PaddingBottom>
>> <PaddingTop>2pt</PaddingTop>
>> <PaddingRight>2pt</PaddingRight>
>> </Style>
>> <ZIndex>3</ZIndex>
>> <rd:DefaultName>textbox1</rd:DefaultName>
>> <CanGrow>true</CanGrow>
>> <Value />
>> </Textbox>
>> </ReportItems>
>> </TableCell>
>> <TableCell>
>> <ReportItems>
>> <Textbox Name="textbox2">
>> <Style>
>> <PaddingLeft>2pt</PaddingLeft>
>> <PaddingBottom>2pt</PaddingBottom>
>> <PaddingTop>2pt</PaddingTop>
>> <PaddingRight>2pt</PaddingRight>
>> <FontWeight>700</FontWeight>
>> </Style>
>> <ZIndex>2</ZIndex>
>> <rd:DefaultName>textbox2</rd:DefaultName>
>> <CanGrow>true</CanGrow>
>> <Value>Legend</Value>
>> </Textbox>
>> </ReportItems>
>> </TableCell>
>> </TableCells>
>> </TableRow>
>> </TableRows>
>> </Header>
>> <DataSetName>DataSet1</DataSetName>
>> <Top>0.125in</Top>
>> <Width>2in</Width>
>> <TableGroups>
>> <TableGroup>
>> <Header>
>> <TableRows>
>> <TableRow>
>> <Height>0.25in</Height>
>> <TableCells>
>> <TableCell>
>> <ReportItems>
>> <Rectangle Name="rectangle1">
>> <ZIndex>1</ZIndex>
>> <Style>
>> <BackgroundColor>=Code.GetColor(Fields!CategoryName.Value)</BackgroundColor>
>> </Style>
>> </Rectangle>
>> </ReportItems>
>> </TableCell>
>> <TableCell>
>> <ReportItems>
>> <Textbox Name="CategoryName">
>> <Style>
>> <PaddingLeft>2pt</PaddingLeft>
>> <PaddingBottom>2pt</PaddingBottom>
>> <PaddingTop>2pt</PaddingTop>
>> <PaddingRight>2pt</PaddingRight>
>> </Style>
>> <rd:DefaultName>CategoryName</rd:DefaultName>
>> <CanGrow>true</CanGrow>
>> <Value>=Fields!CategoryName.Value</Value>
>> </Textbox>
>> </ReportItems>
>> </TableCell>
>> </TableCells>
>> </TableRow>
>> </TableRows>
>> </Header>
>> <Grouping Name="table1_Group1">
>> <GroupExpressions>
>> <GroupExpression>=Fields!CategoryName.Value</GroupExpression>
>> </GroupExpressions>
>> </Grouping>
>> <Sorting>
>> <SortBy>
>> <SortExpression>=Fields!CategoryName.Value</SortExpression>
>> <Direction>Ascending</Direction>
>> </SortBy>
>> </Sorting>
>> </TableGroup>
>> </TableGroups>
>> <Left>3.25in</Left>
>> <TableColumns>
>> <TableColumn>
>> <Width>0.25in</Width>
>> </TableColumn>
>> <TableColumn>
>> <Width>1.75in</Width>
>> </TableColumn>
>> </TableColumns>
>> </Table>
>> <Chart Name="chart1">
>> <ThreeDProperties>
>> <Rotation>30</Rotation>
>> <Inclination>30</Inclination>
>> <Shading>Simple</Shading>
>> <WallThickness>50</WallThickness>
>> </ThreeDProperties>
>> <Style>
>> <BackgroundColor>White</BackgroundColor>
>> </Style>
>> <Legend>
>> <Style>
>> <BorderStyle>
>> <Default>Solid</Default>
>> </BorderStyle>
>> </Style>
>> <Position>BottomCenter</Position>
>> <Layout>Table</Layout>
>> </Legend>
>> <Palette>Default</Palette>
>> <ChartData>
>> <ChartSeries>
>> <DataPoints>
>> <DataPoint>
>> <DataValues>
>> <DataValue>
>> <Value>=Sum(Fields!UnitsInStock.Value)</Value>
>> </DataValue>
>> </DataValues>
>> <DataLabel />
>> <Style>
>> <BackgroundColor>=Code.GetColor(Fields!CategoryName.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>
>> <Min>0</Min>
>> </Axis>
>> </CategoryAxis>
>> <DataSetName>DataSet1</DataSetName>
>> <PointWidth>0</PointWidth>
>> <Type>Bar</Type>
>> <Top>0.25in</Top>
>> <Title />
>> <Width>3in</Width>
>> <Height>2.5in</Height>
>> <SeriesGroupings>
>> <SeriesGrouping>
>> <DynamicSeries>
>> <Grouping Name="chart1_SeriesGroup1">
>> <GroupExpressions>
>> <GroupExpression>=Fields!CategoryName.Value</GroupExpression>
>> </GroupExpressions>
>> </Grouping>
>> <Sorting>
>> <SortBy>
>> <SortExpression>=Fields!CategoryName.Value</SortExpression>
>> <Direction>Ascending</Direction>
>> </SortBy>
>> </Sorting>
>> <Label>=Fields!CategoryName.Value</Label>
>> </DynamicSeries>
>> </SeriesGrouping>
>> </SeriesGroupings>
>> <Subtype>Plain</Subtype>
>> <PlotArea>
>> <Style>
>> <BackgroundColor>LightGrey</BackgroundColor>
>> <BorderStyle>
>> <Default>Solid</Default>
>> </BorderStyle>
>> </Style>
>> </PlotArea>
>> <Left>0.125in</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.25in</Height>
>> </Body>
>> <TopMargin>1in</TopMargin>
>> <DataSources>
>> <DataSource Name="Northwind">
>> <rd:DataSourceID>f646058b-4784-494d-a09d-27fde13a5679</rd:DataSourceID>
>> <ConnectionProperties>
>> <DataProvider>SQL</DataProvider>
>> <ConnectString>data source=(local);initial
>> catalog=Northwind</ConnectString>
>

No comments:

Post a Comment