Hi, I have a series of columns which I need to be able to change the
background color of dynamically depending on a date which is computed
dynamically when the report is created.
I a using a textbox to display the dynamically calculated date
(e.g. =DateAdd(DateInterval.Day,5,Today).ToString("dd-MMM") )
But I cannot seem to reference this textbox object at runtime.
I also need to know how to get the actual dayname given the calculated
date above.
Any ideas about how I can do this'
Thanks
MarkusOn Apr 11, 7:19 pm, Markus...@.gmail.com wrote:
> Hi, I have a series of columns which I need to be able to change the
> background color of dynamically depending on a date which is computed
> dynamically when the report is created.
> I a using a textbox to display the dynamically calculated date
> (e.g. =DateAdd(DateInterval.Day,5,Today).ToString("dd-MMM") )
> But I cannot seem to reference this textbox object at runtime.
> I also need to know how to get the actual dayname given the calculated
> date above.
> Any ideas about how I can do this'
> Thanks
> Markus
You should use something like this in a new dataset that populates a
hidden report parameter:
SELECT DATENAME(DW, GETDATE())
Then reference the hidden parameter as part of the table's column
background property. Something like this should work:
=iif(Parameters!HiddenParameterName.Value = "Monday", "Red", "White")
Hope this helps.
Regards,
Enrique Martinez
Sr. Software Consultant|||On Apr 12, 1:07 pm, "EMartinez" <emartinez...@.gmail.com> wrote:
> On Apr 11, 7:19 pm, Markus...@.gmail.com wrote:
>
>
> > Hi, I have a series of columns which I need to be able to change the
> > background color of dynamically depending on a date which is computed
> > dynamically when the report is created.
> > I a using a textbox to display the dynamically calculated date
> > (e.g. =DateAdd(DateInterval.Day,5,Today).ToString("dd-MMM") )
> > But I cannot seem to reference this textbox object at runtime.
> > I also need to know how to get the actual dayname given the calculated
> > date above.
> > Any ideas about how I can do this'
> > Thanks
> > Markus
> You should use something like this in a new dataset that populates a
> hidden report parameter:
> SELECT DATENAME(DW, GETDATE())
> Then reference the hidden parameter as part of the table's column
> background property. Something like this should work:
> =iif(Parameters!HiddenParameterName.Value = "Monday", "Red", "White")
> Hope this helps.
> Regards,
> Enrique Martinez
> Sr. Software Consultant- Hide quoted text -
> - Show quoted text -
Thanks Enrique, I will give that a shot
Cheers
Markus|||On Apr 12, 5:00 pm, Markus...@.gmail.com wrote:
> On Apr 12, 1:07 pm, "EMartinez" <emartinez...@.gmail.com> wrote:
>
> > On Apr 11, 7:19 pm, Markus...@.gmail.com wrote:
> > > Hi, I have a series of columns which I need to be able to change the
> > > background color of dynamically depending on a date which is computed
> > > dynamically when the report is created.
> > > I a using a textbox to display the dynamically calculated date
> > > (e.g. =DateAdd(DateInterval.Day,5,Today).ToString("dd-MMM") )
> > > But I cannot seem to reference this textbox object at runtime.
> > > I also need to know how to get the actual dayname given the calculated
> > > date above.
> > > Any ideas about how I can do this'
> > > Thanks
> > > Markus
> > You should use something like this in a new dataset that populates a
> > hidden report parameter:
> > SELECT DATENAME(DW, GETDATE())
> > Then reference the hidden parameter as part of the table's column
> > background property. Something like this should work:
> > =iif(Parameters!HiddenParameterName.Value = "Monday", "Red", "White")
> > Hope this helps.
> > Regards,
> > Enrique Martinez
> > Sr. Software Consultant- Hide quoted text -
> > - Show quoted text -
> Thanks Enrique, I will give that a shot
> Cheers
> Markus
You're welcome. Let me know if you need further assistance.
Regards,
Enrique Martinez
Sr. Software Consultant
Showing posts with label color. Show all posts
Showing posts with label color. Show all posts
Thursday, March 22, 2012
Changing the color of the series label
I am able to change the colors of the series inside the graph, however I
would like to make one data point stand out based on a parameter that is
passed in. I have already set up the color schemes for the series to do this
inside the chart but would like the label to make that distinction as well.
For example I would like to set the series label to red for one data point
while all of the other labels would be black. Is this possible?
ThanksIf you have at least RS 2000 SP1 installed, you can edit the data point
label properties (font, color, etc.) and use expressions to determine the
color based on certain conditions.
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"Todd" <Todd@.discussions.microsoft.com> wrote in message
news:EAEF7051-1909-4CD8-93D8-F6842C2887B9@.microsoft.com...
>I am able to change the colors of the series inside the graph, however I
> would like to make one data point stand out based on a parameter that is
> passed in. I have already set up the color schemes for the series to do
> this
> inside the chart but would like the label to make that distinction as
> well.
> For example I would like to set the series label to red for one data point
> while all of the other labels would be black. Is this possible?
> Thanks|||I am running with SP2 and have attempted to put in the code to make this
happen but it renders all of the labels with the color not just the one that
I am looking for. I have tested the snippet of code elsewhere and it works
fine. It seems as if the chart rendering looks at the first attribute passed
for the series labels and stops looking at the attributes for the rest of the
data points.
"Robert Bruckner [MSFT]" wrote:
> If you have at least RS 2000 SP1 installed, you can edit the data point
> label properties (font, color, etc.) and use expressions to determine the
> color based on certain conditions.
> -- Robert
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Todd" <Todd@.discussions.microsoft.com> wrote in message
> news:EAEF7051-1909-4CD8-93D8-F6842C2887B9@.microsoft.com...
> >I am able to change the colors of the series inside the graph, however I
> > would like to make one data point stand out based on a parameter that is
> > passed in. I have already set up the color schemes for the series to do
> > this
> > inside the chart but would like the label to make that distinction as
> > well.
> >
> > For example I would like to set the series label to red for one data point
> > while all of the other labels would be black. Is this possible?
> >
> > Thanks
>
>|||Does the chart have a series grouping?
If yes, then assuming you have a series grouping called "ProductCategory",
you have to use a style color expression with an aggregate function:
= iif(First(Fields!Abc.Value, "ProductCategory") > 10, "Red", Nothing)
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).
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"Todd" <Todd@.discussions.microsoft.com> wrote in message
news:3048F968-1AA1-474D-9EEA-4C985F5DC1DA@.microsoft.com...
>I am running with SP2 and have attempted to put in the code to make this
> happen but it renders all of the labels with the color not just the one
> that
> I am looking for. I have tested the snippet of code elsewhere and it
> works
> fine. It seems as if the chart rendering looks at the first attribute
> passed
> for the series labels and stops looking at the attributes for the rest of
> the
> data points.
> "Robert Bruckner [MSFT]" wrote:
>> If you have at least RS 2000 SP1 installed, you can edit the data point
>> label properties (font, color, etc.) and use expressions to determine the
>> color based on certain conditions.
>> -- Robert
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>> "Todd" <Todd@.discussions.microsoft.com> wrote in message
>> news:EAEF7051-1909-4CD8-93D8-F6842C2887B9@.microsoft.com...
>> >I am able to change the colors of the series inside the graph, however I
>> > would like to make one data point stand out based on a parameter that
>> > is
>> > passed in. I have already set up the color schemes for the series to
>> > do
>> > this
>> > inside the chart but would like the label to make that distinction as
>> > well.
>> >
>> > For example I would like to set the series label to red for one data
>> > point
>> > while all of the other labels would be black. Is this possible?
>> >
>> > Thanks
>>|||No, The chart does not have series grouping. I also wonder if I have
communicated this effectively. I am talking about the labels on the x-axis.
I am only concerned with the series labels not data point labels. Does this
help to clarify?
"Robert Bruckner [MSFT]" wrote:
> Does the chart have a series grouping?
> If yes, then assuming you have a series grouping called "ProductCategory",
> you have to use a style color expression with an aggregate function:
> = iif(First(Fields!Abc.Value, "ProductCategory") > 10, "Red", Nothing)
> 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).
> -- Robert
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Todd" <Todd@.discussions.microsoft.com> wrote in message
> news:3048F968-1AA1-474D-9EEA-4C985F5DC1DA@.microsoft.com...
> >I am running with SP2 and have attempted to put in the code to make this
> > happen but it renders all of the labels with the color not just the one
> > that
> > I am looking for. I have tested the snippet of code elsewhere and it
> > works
> > fine. It seems as if the chart rendering looks at the first attribute
> > passed
> > for the series labels and stops looking at the attributes for the rest of
> > the
> > data points.
> >
> > "Robert Bruckner [MSFT]" wrote:
> >
> >> If you have at least RS 2000 SP1 installed, you can edit the data point
> >> label properties (font, color, etc.) and use expressions to determine the
> >> color based on certain conditions.
> >>
> >> -- Robert
> >> This posting is provided "AS IS" with no warranties, and confers no
> >> rights.
> >>
> >>
> >> "Todd" <Todd@.discussions.microsoft.com> wrote in message
> >> news:EAEF7051-1909-4CD8-93D8-F6842C2887B9@.microsoft.com...
> >> >I am able to change the colors of the series inside the graph, however I
> >> > would like to make one data point stand out based on a parameter that
> >> > is
> >> > passed in. I have already set up the color schemes for the series to
> >> > do
> >> > this
> >> > inside the chart but would like the label to make that distinction as
> >> > well.
> >> >
> >> > For example I would like to set the series label to red for one data
> >> > point
> >> > while all of the other labels would be black. Is this possible?
> >> >
> >> > Thanks
> >>
> >>
> >>
>
>|||Sorry, the individual x-axis labels share the same color and font settings.
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"Todd" <Todd@.discussions.microsoft.com> wrote in message
news:7391723B-1CAB-4990-A5A7-E41A41DAF65E@.microsoft.com...
> No, The chart does not have series grouping. I also wonder if I have
> communicated this effectively. I am talking about the labels on the
> x-axis.
> I am only concerned with the series labels not data point labels. Does
> this
> help to clarify?
> "Robert Bruckner [MSFT]" wrote:
>> Does the chart have a series grouping?
>> If yes, then assuming you have a series grouping called
>> "ProductCategory",
>> you have to use a style color expression with an aggregate function:
>> = iif(First(Fields!Abc.Value, "ProductCategory") > 10, "Red", Nothing)
>> 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).
>> -- Robert
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>> "Todd" <Todd@.discussions.microsoft.com> wrote in message
>> news:3048F968-1AA1-474D-9EEA-4C985F5DC1DA@.microsoft.com...
>> >I am running with SP2 and have attempted to put in the code to make this
>> > happen but it renders all of the labels with the color not just the one
>> > that
>> > I am looking for. I have tested the snippet of code elsewhere and it
>> > works
>> > fine. It seems as if the chart rendering looks at the first attribute
>> > passed
>> > for the series labels and stops looking at the attributes for the rest
>> > of
>> > the
>> > data points.
>> >
>> > "Robert Bruckner [MSFT]" wrote:
>> >
>> >> If you have at least RS 2000 SP1 installed, you can edit the data
>> >> point
>> >> label properties (font, color, etc.) and use expressions to determine
>> >> the
>> >> color based on certain conditions.
>> >>
>> >> -- Robert
>> >> This posting is provided "AS IS" with no warranties, and confers no
>> >> rights.
>> >>
>> >>
>> >> "Todd" <Todd@.discussions.microsoft.com> wrote in message
>> >> news:EAEF7051-1909-4CD8-93D8-F6842C2887B9@.microsoft.com...
>> >> >I am able to change the colors of the series inside the graph,
>> >> >however I
>> >> > would like to make one data point stand out based on a parameter
>> >> > that
>> >> > is
>> >> > passed in. I have already set up the color schemes for the series
>> >> > to
>> >> > do
>> >> > this
>> >> > inside the chart but would like the label to make that distinction
>> >> > as
>> >> > well.
>> >> >
>> >> > For example I would like to set the series label to red for one data
>> >> > point
>> >> > while all of the other labels would be black. Is this possible?
>> >> >
>> >> > Thanks
>> >>
>> >>
>> >>
>>sql
would like to make one data point stand out based on a parameter that is
passed in. I have already set up the color schemes for the series to do this
inside the chart but would like the label to make that distinction as well.
For example I would like to set the series label to red for one data point
while all of the other labels would be black. Is this possible?
ThanksIf you have at least RS 2000 SP1 installed, you can edit the data point
label properties (font, color, etc.) and use expressions to determine the
color based on certain conditions.
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"Todd" <Todd@.discussions.microsoft.com> wrote in message
news:EAEF7051-1909-4CD8-93D8-F6842C2887B9@.microsoft.com...
>I am able to change the colors of the series inside the graph, however I
> would like to make one data point stand out based on a parameter that is
> passed in. I have already set up the color schemes for the series to do
> this
> inside the chart but would like the label to make that distinction as
> well.
> For example I would like to set the series label to red for one data point
> while all of the other labels would be black. Is this possible?
> Thanks|||I am running with SP2 and have attempted to put in the code to make this
happen but it renders all of the labels with the color not just the one that
I am looking for. I have tested the snippet of code elsewhere and it works
fine. It seems as if the chart rendering looks at the first attribute passed
for the series labels and stops looking at the attributes for the rest of the
data points.
"Robert Bruckner [MSFT]" wrote:
> If you have at least RS 2000 SP1 installed, you can edit the data point
> label properties (font, color, etc.) and use expressions to determine the
> color based on certain conditions.
> -- Robert
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Todd" <Todd@.discussions.microsoft.com> wrote in message
> news:EAEF7051-1909-4CD8-93D8-F6842C2887B9@.microsoft.com...
> >I am able to change the colors of the series inside the graph, however I
> > would like to make one data point stand out based on a parameter that is
> > passed in. I have already set up the color schemes for the series to do
> > this
> > inside the chart but would like the label to make that distinction as
> > well.
> >
> > For example I would like to set the series label to red for one data point
> > while all of the other labels would be black. Is this possible?
> >
> > Thanks
>
>|||Does the chart have a series grouping?
If yes, then assuming you have a series grouping called "ProductCategory",
you have to use a style color expression with an aggregate function:
= iif(First(Fields!Abc.Value, "ProductCategory") > 10, "Red", Nothing)
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).
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"Todd" <Todd@.discussions.microsoft.com> wrote in message
news:3048F968-1AA1-474D-9EEA-4C985F5DC1DA@.microsoft.com...
>I am running with SP2 and have attempted to put in the code to make this
> happen but it renders all of the labels with the color not just the one
> that
> I am looking for. I have tested the snippet of code elsewhere and it
> works
> fine. It seems as if the chart rendering looks at the first attribute
> passed
> for the series labels and stops looking at the attributes for the rest of
> the
> data points.
> "Robert Bruckner [MSFT]" wrote:
>> If you have at least RS 2000 SP1 installed, you can edit the data point
>> label properties (font, color, etc.) and use expressions to determine the
>> color based on certain conditions.
>> -- Robert
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>> "Todd" <Todd@.discussions.microsoft.com> wrote in message
>> news:EAEF7051-1909-4CD8-93D8-F6842C2887B9@.microsoft.com...
>> >I am able to change the colors of the series inside the graph, however I
>> > would like to make one data point stand out based on a parameter that
>> > is
>> > passed in. I have already set up the color schemes for the series to
>> > do
>> > this
>> > inside the chart but would like the label to make that distinction as
>> > well.
>> >
>> > For example I would like to set the series label to red for one data
>> > point
>> > while all of the other labels would be black. Is this possible?
>> >
>> > Thanks
>>|||No, The chart does not have series grouping. I also wonder if I have
communicated this effectively. I am talking about the labels on the x-axis.
I am only concerned with the series labels not data point labels. Does this
help to clarify?
"Robert Bruckner [MSFT]" wrote:
> Does the chart have a series grouping?
> If yes, then assuming you have a series grouping called "ProductCategory",
> you have to use a style color expression with an aggregate function:
> = iif(First(Fields!Abc.Value, "ProductCategory") > 10, "Red", Nothing)
> 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).
> -- Robert
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Todd" <Todd@.discussions.microsoft.com> wrote in message
> news:3048F968-1AA1-474D-9EEA-4C985F5DC1DA@.microsoft.com...
> >I am running with SP2 and have attempted to put in the code to make this
> > happen but it renders all of the labels with the color not just the one
> > that
> > I am looking for. I have tested the snippet of code elsewhere and it
> > works
> > fine. It seems as if the chart rendering looks at the first attribute
> > passed
> > for the series labels and stops looking at the attributes for the rest of
> > the
> > data points.
> >
> > "Robert Bruckner [MSFT]" wrote:
> >
> >> If you have at least RS 2000 SP1 installed, you can edit the data point
> >> label properties (font, color, etc.) and use expressions to determine the
> >> color based on certain conditions.
> >>
> >> -- Robert
> >> This posting is provided "AS IS" with no warranties, and confers no
> >> rights.
> >>
> >>
> >> "Todd" <Todd@.discussions.microsoft.com> wrote in message
> >> news:EAEF7051-1909-4CD8-93D8-F6842C2887B9@.microsoft.com...
> >> >I am able to change the colors of the series inside the graph, however I
> >> > would like to make one data point stand out based on a parameter that
> >> > is
> >> > passed in. I have already set up the color schemes for the series to
> >> > do
> >> > this
> >> > inside the chart but would like the label to make that distinction as
> >> > well.
> >> >
> >> > For example I would like to set the series label to red for one data
> >> > point
> >> > while all of the other labels would be black. Is this possible?
> >> >
> >> > Thanks
> >>
> >>
> >>
>
>|||Sorry, the individual x-axis labels share the same color and font settings.
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"Todd" <Todd@.discussions.microsoft.com> wrote in message
news:7391723B-1CAB-4990-A5A7-E41A41DAF65E@.microsoft.com...
> No, The chart does not have series grouping. I also wonder if I have
> communicated this effectively. I am talking about the labels on the
> x-axis.
> I am only concerned with the series labels not data point labels. Does
> this
> help to clarify?
> "Robert Bruckner [MSFT]" wrote:
>> Does the chart have a series grouping?
>> If yes, then assuming you have a series grouping called
>> "ProductCategory",
>> you have to use a style color expression with an aggregate function:
>> = iif(First(Fields!Abc.Value, "ProductCategory") > 10, "Red", Nothing)
>> 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).
>> -- Robert
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>> "Todd" <Todd@.discussions.microsoft.com> wrote in message
>> news:3048F968-1AA1-474D-9EEA-4C985F5DC1DA@.microsoft.com...
>> >I am running with SP2 and have attempted to put in the code to make this
>> > happen but it renders all of the labels with the color not just the one
>> > that
>> > I am looking for. I have tested the snippet of code elsewhere and it
>> > works
>> > fine. It seems as if the chart rendering looks at the first attribute
>> > passed
>> > for the series labels and stops looking at the attributes for the rest
>> > of
>> > the
>> > data points.
>> >
>> > "Robert Bruckner [MSFT]" wrote:
>> >
>> >> If you have at least RS 2000 SP1 installed, you can edit the data
>> >> point
>> >> label properties (font, color, etc.) and use expressions to determine
>> >> the
>> >> color based on certain conditions.
>> >>
>> >> -- Robert
>> >> This posting is provided "AS IS" with no warranties, and confers no
>> >> rights.
>> >>
>> >>
>> >> "Todd" <Todd@.discussions.microsoft.com> wrote in message
>> >> news:EAEF7051-1909-4CD8-93D8-F6842C2887B9@.microsoft.com...
>> >> >I am able to change the colors of the series inside the graph,
>> >> >however I
>> >> > would like to make one data point stand out based on a parameter
>> >> > that
>> >> > is
>> >> > passed in. I have already set up the color schemes for the series
>> >> > to
>> >> > do
>> >> > this
>> >> > inside the chart but would like the label to make that distinction
>> >> > as
>> >> > well.
>> >> >
>> >> > For example I would like to set the series label to red for one data
>> >> > point
>> >> > while all of the other labels would be black. Is this possible?
>> >> >
>> >> > Thanks
>> >>
>> >>
>> >>
>>sql
Changing the Color of Data in a Bar Chart
How can I change the color of the Bars in the Bar Chart Report? I have been
trying so many things. But the only way I could change the default set colors
was to set another palette in the appearence. Can I apply/define my choice of
colors to the bars? If I can then how? I need to change the colors of the
data that is provided in the report.
thnx in advanceYou will need to have SP1 of RS 2000 installed on the server and designer
machines. In particular, read the following section of the SP1 readme file
about using colors in charts:
http://download.microsoft.com/download/7/f/b/7fb1a251-13ad-404c-a034-10d79ddaa510/SP1Readme_EN.htm#_chart_enhancements
You will find an example that highlights the bars with the minimum and the
maximum values in a regualr bar chart at the bottom of this posting.
--
Robert M. Bruckner
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
All code samples are provided "AS IS" without warranty of any kind, either
express or implied, including but not limited to the implied warranties of
merchantability and/or fitness for a particular purpose.
"Ashinie Perera" <Ashinie Perera@.discussions.microsoft.com> wrote in message
news:EFFC50E4-ACF5-4F6D-B7D3-AB3F30B95903@.microsoft.com...
> How can I change the color of the Bars in the Bar Chart Report? I have
been
> trying so many things. But the only way I could change the default set
colors
> was to set another palette in the appearence. Can I apply/define my choice
of
> colors to the bars? If I can then how? I need to change the colors of the
> data that is provided in the report.
> thnx in advance
============================================
<?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>20</Inclination>
<Shading>Real</Shading>
<WallThickness>25</WallThickness>
<DrawingStyle>Cylinder</DrawingStyle>
<Clustered>true</Clustered>
</ThreeDProperties>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
<Color>Firebrick</Color>
</Style>
<Legend>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
<Position>RightCenter</Position>
</Legend>
<Palette>Excel</Palette>
<ChartData>
<ChartSeries>
<DataPoints>
<DataPoint>
<DataValues>
<DataValue>
<Value>=Fields!UnitsInStock.Value</Value>
</DataValue>
</DataValues>
<DataLabel>
<Style />
</DataLabel>
<Style>
<BackgroundColor>=Switch(Sum(Fields!UnitsInStock.Value) =Max(Fields!UnitsInStock.Value,"Chart1"), "Red",
Sum(Fields!UnitsInStock.Value) = Min(Fields!UnitsInStock.Value,"Chart1"),
"Yellow", true, "Green")</BackgroundColor>
</Style>
<Marker>
<Size>6pt</Size>
</Marker>
</DataPoint>
</DataPoints>
</ChartSeries>
</ChartData>
<CategoryAxis>
<Axis>
<Title>
<Style />
</Title>
<Style>
<FontSize>8pt</FontSize>
</Style>
<MajorGridLines>
<Style>
<BorderWidth>
<Default>1.5pt</Default>
</BorderWidth>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
</MajorGridLines>
<MinorGridLines>
<ShowGridLines>true</ShowGridLines>
<Style>
<BorderStyle>
<Default>Dotted</Default>
</BorderStyle>
</Style>
</MinorGridLines>
<MajorTickMarks>Outside</MajorTickMarks>
<MinorTickMarks>Outside</MinorTickMarks>
<MajorInterval>5</MajorInterval>
<MinorInterval>1</MinorInterval>
<CrossAt>0</CrossAt>
<Margin>true</Margin>
<Visible>true</Visible>
</Axis>
</CategoryAxis>
<DataSetName>Northwind</DataSetName>
<PointWidth>55</PointWidth>
<Type>Bar</Type>
<Top>0.25in</Top>
<Title>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
</Title>
<Width>6.375in</Width>
<CategoryGroupings>
<CategoryGrouping>
<DynamicCategories>
<Grouping Name="ProductCategory">
<GroupExpressions>
<GroupExpression>=Fields!CategoryName.Value</GroupExpression>
</GroupExpressions>
</Grouping>
<Label />
</DynamicCategories>
</CategoryGrouping>
<CategoryGrouping>
<DynamicCategories>
<Grouping Name="ProductName">
<GroupExpressions>
<GroupExpression>=Fields!ProductName.Value</GroupExpression>
</GroupExpressions>
</Grouping>
<Label>=Fields!ProductName.Value</Label>
</DynamicCategories>
</CategoryGrouping>
</CategoryGroupings>
<Height>3.25in</Height>
<SeriesGroupings>
<SeriesGrouping>
<StaticSeries>
<StaticMember>
<Label>Stock</Label>
</StaticMember>
</StaticSeries>
</SeriesGrouping>
</SeriesGroupings>
<Subtype>Plain</Subtype>
<PlotArea>
<Style>
<BackgroundColor>OldLace</BackgroundColor>
</Style>
</PlotArea>
<Left>0.25in</Left>
<ValueAxis>
<Axis>
<Title>
<Caption>Amount</Caption>
<Style />
</Title>
<Style>
<BorderColor>
<Default>IndianRed</Default>
</BorderColor>
<FontSize>8pt</FontSize>
</Style>
<MajorGridLines>
<ShowGridLines>true</ShowGridLines>
<Style>
<BorderColor>
<Default>Blue</Default>
</BorderColor>
<BorderStyle>
<Default>Dashed</Default>
</BorderStyle>
</Style>
</MajorGridLines>
<MinorGridLines>
<ShowGridLines>true</ShowGridLines>
<Style>
<BorderColor>
<Default>CornflowerBlue</Default>
</BorderColor>
<BorderStyle>
<Default>Dotted</Default>
</BorderStyle>
</Style>
</MinorGridLines>
<MinorTickMarks>Cross</MinorTickMarks>
<Min>0</Min>
<MajorInterval>20</MajorInterval>
<MinorInterval>5</MinorInterval>
<Interlaced>true</Interlaced>
<Margin>true</Margin>
<Visible>true</Visible>
<Scalar>true</Scalar>
</Axis>
</ValueAxis>
</Chart>
</ReportItems>
<Style />
<Height>3.75in</Height>
</Body>
<TopMargin>1in</TopMargin>
<DataSources>
<DataSource Name="Northwind">
<rd:DataSourceID>32d95cbf-5e5b-4fb3-a37a-39b9506b8c80</rd:DataSourceID>
<ConnectionProperties>
<DataProvider>SQL</DataProvider>
<ConnectString>data source=(local);initial
catalog=Northwind</ConnectString>
<IntegratedSecurity>true</IntegratedSecurity>
</ConnectionProperties>
</DataSource>
</DataSources>
<Width>6.75in</Width>
<DataSets>
<DataSet Name="Northwind">
<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="NullUnits">
<DataField>NullUnits</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
</Fields>
<Query>
<DataSourceName>Northwind</DataSourceName>
<CommandText>SELECT TOP 10 *, NULL AS NullUnits
FROM [Alphabetical list of products]
WHERE (UnitsOnOrder > 0)</CommandText>
<Timeout>30</Timeout>
</Query>
</DataSet>
</DataSets>
<LeftMargin>1in</LeftMargin>
<rd:SnapToGrid>true</rd:SnapToGrid>
<rd:DrawGrid>true</rd:DrawGrid>
<rd:ReportID>4792d607-5639-4c89-ac36-2794e9e78a74</rd:ReportID>
<BottomMargin>1in</BottomMargin>
</Report>
trying so many things. But the only way I could change the default set colors
was to set another palette in the appearence. Can I apply/define my choice of
colors to the bars? If I can then how? I need to change the colors of the
data that is provided in the report.
thnx in advanceYou will need to have SP1 of RS 2000 installed on the server and designer
machines. In particular, read the following section of the SP1 readme file
about using colors in charts:
http://download.microsoft.com/download/7/f/b/7fb1a251-13ad-404c-a034-10d79ddaa510/SP1Readme_EN.htm#_chart_enhancements
You will find an example that highlights the bars with the minimum and the
maximum values in a regualr bar chart at the bottom of this posting.
--
Robert M. Bruckner
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
All code samples are provided "AS IS" without warranty of any kind, either
express or implied, including but not limited to the implied warranties of
merchantability and/or fitness for a particular purpose.
"Ashinie Perera" <Ashinie Perera@.discussions.microsoft.com> wrote in message
news:EFFC50E4-ACF5-4F6D-B7D3-AB3F30B95903@.microsoft.com...
> How can I change the color of the Bars in the Bar Chart Report? I have
been
> trying so many things. But the only way I could change the default set
colors
> was to set another palette in the appearence. Can I apply/define my choice
of
> colors to the bars? If I can then how? I need to change the colors of the
> data that is provided in the report.
> thnx in advance
============================================
<?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>20</Inclination>
<Shading>Real</Shading>
<WallThickness>25</WallThickness>
<DrawingStyle>Cylinder</DrawingStyle>
<Clustered>true</Clustered>
</ThreeDProperties>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
<Color>Firebrick</Color>
</Style>
<Legend>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
<Position>RightCenter</Position>
</Legend>
<Palette>Excel</Palette>
<ChartData>
<ChartSeries>
<DataPoints>
<DataPoint>
<DataValues>
<DataValue>
<Value>=Fields!UnitsInStock.Value</Value>
</DataValue>
</DataValues>
<DataLabel>
<Style />
</DataLabel>
<Style>
<BackgroundColor>=Switch(Sum(Fields!UnitsInStock.Value) =Max(Fields!UnitsInStock.Value,"Chart1"), "Red",
Sum(Fields!UnitsInStock.Value) = Min(Fields!UnitsInStock.Value,"Chart1"),
"Yellow", true, "Green")</BackgroundColor>
</Style>
<Marker>
<Size>6pt</Size>
</Marker>
</DataPoint>
</DataPoints>
</ChartSeries>
</ChartData>
<CategoryAxis>
<Axis>
<Title>
<Style />
</Title>
<Style>
<FontSize>8pt</FontSize>
</Style>
<MajorGridLines>
<Style>
<BorderWidth>
<Default>1.5pt</Default>
</BorderWidth>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
</MajorGridLines>
<MinorGridLines>
<ShowGridLines>true</ShowGridLines>
<Style>
<BorderStyle>
<Default>Dotted</Default>
</BorderStyle>
</Style>
</MinorGridLines>
<MajorTickMarks>Outside</MajorTickMarks>
<MinorTickMarks>Outside</MinorTickMarks>
<MajorInterval>5</MajorInterval>
<MinorInterval>1</MinorInterval>
<CrossAt>0</CrossAt>
<Margin>true</Margin>
<Visible>true</Visible>
</Axis>
</CategoryAxis>
<DataSetName>Northwind</DataSetName>
<PointWidth>55</PointWidth>
<Type>Bar</Type>
<Top>0.25in</Top>
<Title>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
</Title>
<Width>6.375in</Width>
<CategoryGroupings>
<CategoryGrouping>
<DynamicCategories>
<Grouping Name="ProductCategory">
<GroupExpressions>
<GroupExpression>=Fields!CategoryName.Value</GroupExpression>
</GroupExpressions>
</Grouping>
<Label />
</DynamicCategories>
</CategoryGrouping>
<CategoryGrouping>
<DynamicCategories>
<Grouping Name="ProductName">
<GroupExpressions>
<GroupExpression>=Fields!ProductName.Value</GroupExpression>
</GroupExpressions>
</Grouping>
<Label>=Fields!ProductName.Value</Label>
</DynamicCategories>
</CategoryGrouping>
</CategoryGroupings>
<Height>3.25in</Height>
<SeriesGroupings>
<SeriesGrouping>
<StaticSeries>
<StaticMember>
<Label>Stock</Label>
</StaticMember>
</StaticSeries>
</SeriesGrouping>
</SeriesGroupings>
<Subtype>Plain</Subtype>
<PlotArea>
<Style>
<BackgroundColor>OldLace</BackgroundColor>
</Style>
</PlotArea>
<Left>0.25in</Left>
<ValueAxis>
<Axis>
<Title>
<Caption>Amount</Caption>
<Style />
</Title>
<Style>
<BorderColor>
<Default>IndianRed</Default>
</BorderColor>
<FontSize>8pt</FontSize>
</Style>
<MajorGridLines>
<ShowGridLines>true</ShowGridLines>
<Style>
<BorderColor>
<Default>Blue</Default>
</BorderColor>
<BorderStyle>
<Default>Dashed</Default>
</BorderStyle>
</Style>
</MajorGridLines>
<MinorGridLines>
<ShowGridLines>true</ShowGridLines>
<Style>
<BorderColor>
<Default>CornflowerBlue</Default>
</BorderColor>
<BorderStyle>
<Default>Dotted</Default>
</BorderStyle>
</Style>
</MinorGridLines>
<MinorTickMarks>Cross</MinorTickMarks>
<Min>0</Min>
<MajorInterval>20</MajorInterval>
<MinorInterval>5</MinorInterval>
<Interlaced>true</Interlaced>
<Margin>true</Margin>
<Visible>true</Visible>
<Scalar>true</Scalar>
</Axis>
</ValueAxis>
</Chart>
</ReportItems>
<Style />
<Height>3.75in</Height>
</Body>
<TopMargin>1in</TopMargin>
<DataSources>
<DataSource Name="Northwind">
<rd:DataSourceID>32d95cbf-5e5b-4fb3-a37a-39b9506b8c80</rd:DataSourceID>
<ConnectionProperties>
<DataProvider>SQL</DataProvider>
<ConnectString>data source=(local);initial
catalog=Northwind</ConnectString>
<IntegratedSecurity>true</IntegratedSecurity>
</ConnectionProperties>
</DataSource>
</DataSources>
<Width>6.75in</Width>
<DataSets>
<DataSet Name="Northwind">
<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="NullUnits">
<DataField>NullUnits</DataField>
<rd:TypeName>System.Int32</rd:TypeName>
</Field>
</Fields>
<Query>
<DataSourceName>Northwind</DataSourceName>
<CommandText>SELECT TOP 10 *, NULL AS NullUnits
FROM [Alphabetical list of products]
WHERE (UnitsOnOrder > 0)</CommandText>
<Timeout>30</Timeout>
</Query>
</DataSet>
</DataSets>
<LeftMargin>1in</LeftMargin>
<rd:SnapToGrid>true</rd:SnapToGrid>
<rd:DrawGrid>true</rd:DrawGrid>
<rd:ReportID>4792d607-5639-4c89-ac36-2794e9e78a74</rd:ReportID>
<BottomMargin>1in</BottomMargin>
</Report>
Thursday, February 16, 2012
Changing font color dynamically in Crystal Reports
I have a windows app which uses the free version of Crystal Reports. The idea is that I should allow the users to choose their own font and colors (for example one might want to see the title green and arial). Do you happen to know how I can do that? I don't even know if it is possible given that there is practically no code behind the reports...
Thank you in advance. :)Add parameters to the report for font and font color. Right click the report field, select "format field", click the font tab and click the formula buttons next to each of the font attributes and add the code to read your parameters to make the select settings|||Can you please give me an example?|||Select {?FontColor} <--This is your parameter field
Case "Red": <-You should have a case stament for each color
crRed
Case "Black":
crBlack
Default:
DefaultAttribute
Here are the default color attributes.
crBlack
crMaroon
crGreen
crOlive
crNavy
crPurple
crTeal
crSilver
crRed
crLime
crYellow
crBlue
crFuchsia
crAqua
crWhite
Do the same for the font replacing the colors with the font names.|||But where do I write this code?|||Right click the report field, select "format field", click the font tab and click the formula buttons next to each of the font attributes and add the code to read your parameters to make the selected settings
As I originally stated above..|||try sample code as mentioned below. You can get access to any object in the report and from code, you can change the object property just like you do using visual studio. Sorry for not answering you stright. But this info will very helpful to you I recon.
Private Sub AdjustCarPicSize(ByVal iHeight As Integer, ByVal iWidth As Integer)
'For Each section As CrystalDecisions.CrystalReports.Engine.Section In reportDocument.ReportDefinition.Sections
' For Each reportObject As CrystalDecisions.CrystalReports.Engine.ReportObject In section.ReportObjects
' If reportObject.Kind = ReportObjectKind.SubreportObject Then
' Dim subReport As SubreportObject = CType(reportObject, SubreportObject)
' Dim subDocument As ReportDocument = subReport.OpenSubreport(subReport.SubreportName)
' If (subReport.SubreportName = "CarPic") Then
' For Each section1 As CrystalDecisions.CrystalReports.Engine.Section In subDocument.ReportDefinition.Sections
' For Each reportObject1 As CrystalDecisions.CrystalReports.Engine.ReportObject In section1.ReportObjects
' 'Response.Write(reportObject1.Name)
' If (reportObject1.Name = "carpicimage1") Then
' reportObject1.Height = iHeight
' reportObject1.Width = iWidth
' End If
' Next
' Next
' End If
' End If
' Next
'Next
Dim oCarPic As CrystalDecisions.CrystalReports.Engine.ReportObject = CType(reportDocument.ReportDefinition.Sections("DetailSection6").ReportObjects("Subreport1"), SubreportObject).OpenSubreport("CarPic").ReportDefinition.Sections("ReportHeaderSection2").ReportObjects("carpicimage1")
Thank you in advance. :)Add parameters to the report for font and font color. Right click the report field, select "format field", click the font tab and click the formula buttons next to each of the font attributes and add the code to read your parameters to make the select settings|||Can you please give me an example?|||Select {?FontColor} <--This is your parameter field
Case "Red": <-You should have a case stament for each color
crRed
Case "Black":
crBlack
Default:
DefaultAttribute
Here are the default color attributes.
crBlack
crMaroon
crGreen
crOlive
crNavy
crPurple
crTeal
crSilver
crRed
crLime
crYellow
crBlue
crFuchsia
crAqua
crWhite
Do the same for the font replacing the colors with the font names.|||But where do I write this code?|||Right click the report field, select "format field", click the font tab and click the formula buttons next to each of the font attributes and add the code to read your parameters to make the selected settings
As I originally stated above..|||try sample code as mentioned below. You can get access to any object in the report and from code, you can change the object property just like you do using visual studio. Sorry for not answering you stright. But this info will very helpful to you I recon.
Private Sub AdjustCarPicSize(ByVal iHeight As Integer, ByVal iWidth As Integer)
'For Each section As CrystalDecisions.CrystalReports.Engine.Section In reportDocument.ReportDefinition.Sections
' For Each reportObject As CrystalDecisions.CrystalReports.Engine.ReportObject In section.ReportObjects
' If reportObject.Kind = ReportObjectKind.SubreportObject Then
' Dim subReport As SubreportObject = CType(reportObject, SubreportObject)
' Dim subDocument As ReportDocument = subReport.OpenSubreport(subReport.SubreportName)
' If (subReport.SubreportName = "CarPic") Then
' For Each section1 As CrystalDecisions.CrystalReports.Engine.Section In subDocument.ReportDefinition.Sections
' For Each reportObject1 As CrystalDecisions.CrystalReports.Engine.ReportObject In section1.ReportObjects
' 'Response.Write(reportObject1.Name)
' If (reportObject1.Name = "carpicimage1") Then
' reportObject1.Height = iHeight
' reportObject1.Width = iWidth
' End If
' Next
' Next
' End If
' End If
' Next
'Next
Dim oCarPic As CrystalDecisions.CrystalReports.Engine.ReportObject = CType(reportDocument.ReportDefinition.Sections("DetailSection6").ReportObjects("Subreport1"), SubreportObject).OpenSubreport("CarPic").ReportDefinition.Sections("ReportHeaderSection2").ReportObjects("carpicimage1")
Subscribe to:
Posts (Atom)