Tuesday, March 27, 2012
Customized color in Column chart?
using column chart. Now I would like to give customized color to each column
in this chart but don't know how to implement it.
Please help me out from this situation!
Thanks,
SachinBasically the only way I have figured it outs is by going to the chart
properties>data tab>edit your value>appearance tab>click series style button
at bottom> fill tab. Once there you can eithere choose a different color
for all the bars or if you want a specific color for each bar showing up you
have to click on the expression button and write a iif statement stating
those colors. If you have any more questions let me know.
"Sachin Punatar" <Sachin Punatar@.discussions.microsoft.com> wrote in message
news:D685EB20-4E10-4214-B62D-7FC932E019EE@.microsoft.com...
>I am using MS Reporting 2000 for Report where in one of the report I am
> using column chart. Now I would like to give customized color to each
> column
> in this chart but don't know how to implement it.
> Please help me out from this situation!
> Thanks,
> Sachin
>|||Ben,
Thanks a tone for your reply.
This is absolutely right. But in my case i am using MS Reporting 2000 where
i am not able to have series style option in Appearance tab in data section.
To come out from this issue I have created one SetColor fuction in code
window of Report property but i am not sure how and where to call this
function so that it will create custom color for series. See Below example:
Public Function SetColor(N As String) As String
Select Case N
Case "Incurred"
Return "#fa8072"
Case "Billable"
Return "#eee8aa"
Case "Billed"
Return "#c0ffc0"
Case "Collected"
Return "#4169e1"
End Select
End Function
Now what i tried to call this function from Data-->Values-->Edit-->Value
property. And i am still not able to get appropriate output.
Please let me know is there any other work around for this.
Thanks in advance.
Sachin Punatar
"Ben Watts" wrote:
> Basically the only way I have figured it outs is by going to the chart
> properties>data tab>edit your value>appearance tab>click series style button
> at bottom> fill tab. Once there you can eithere choose a different color
> for all the bars or if you want a specific color for each bar showing up you
> have to click on the expression button and write a iif statement stating
> those colors. If you have any more questions let me know.
> "Sachin Punatar" <Sachin Punatar@.discussions.microsoft.com> wrote in message
> news:D685EB20-4E10-4214-B62D-7FC932E019EE@.microsoft.com...
> >I am using MS Reporting 2000 for Report where in one of the report I am
> > using column chart. Now I would like to give customized color to each
> > column
> > in this chart but don't know how to implement it.
> >
> > Please help me out from this situation!
> >
> > Thanks,
> > Sachin
> >
>
>|||Sachin Punatar wrote:
> > "Sachin Punatar" <Sachin Punatar@.discussions.microsoft.com> wrote in message
> > news:D685EB20-4E10-4214-B62D-7FC932E019EE@.microsoft.com...
> > >I am using MS Reporting 2000 for Report where in one of the report I am
> > > using column chart. Now I would like to give customized color to each
> > > column
> > > in this chart but don't know how to implement it.
> > >
> > > Please help me out from this situation!
> > >
> > > Thanks,
> > > Sachin
Give this a try:
http://blogs.msdn.com/bwelcker/archive/2005/05/20/420349.aspx
(Courtesy of Brian Welcker)
Sean G.|||Sean -
Thanks for your favorable reply.
I have tried out with similar way as it was mentioned in below article:
http://blogs.msdn.com/bwelcker/archive/2005/05/20/420349.aspx
But I am not able to set customized color for each column in the chart.
Please let me know if this requires SP1 or SP2 in my machine.
Because when I tried to call custom function written in code window of
Report property, it returns nothing. I have wrote "code.SetColor(values)" in
Data-->Values-->Edit--> Value tab but i dont think that it is calling custom
funciton properly. I strongly have doubts that it willl require SP1 or SP2 on
my machine.
Please verify and clear my doubts on this.
Seeking for your help.
Thanks in advance,
Sachin Punatar
"SeanGerman@.gmail.com" wrote:
> Sachin Punatar wrote:
> > > "Sachin Punatar" <Sachin Punatar@.discussions.microsoft.com> wrote in message
> > > news:D685EB20-4E10-4214-B62D-7FC932E019EE@.microsoft.com...
> > > >I am using MS Reporting 2000 for Report where in one of the report I am
> > > > using column chart. Now I would like to give customized color to each
> > > > column
> > > > in this chart but don't know how to implement it.
> > > >
> > > > Please help me out from this situation!
> > > >
> > > > Thanks,
> > > > Sachin
>
> Give this a try:
> http://blogs.msdn.com/bwelcker/archive/2005/05/20/420349.aspx
> (Courtesy of Brian Welcker)
>
> Sean G.
>sql
Customize toolbar
Is it possible ? How ?It is possible in SP1. Check the SP1 readme for documentation on how to
supply a custom stylesheet.
--
This posting is provided "AS IS" with no warranties, and confers no rights
"Karine" <Karine@.discussions.microsoft.com> wrote in message
news:6D953609-51E1-4FDA-BDFF-67A2D01491E1@.microsoft.com...
> I want to customize the toolbar (change color, button...).
> Is it possible ? How ?
Tuesday, March 20, 2012
Custom Series Color Problem
series.
The problem is that I want to specify a transparent color (Alpha = 50%).
Is there any way of doing this? It seems that you can only enter colors that
have RGB values, not ARGB values. (The System.Drawing.Color.FromArgb function
does not work in an expression).
At the moment, I am using the Semi-Transparent palette, but would like to
choose the colors myself as opposed to having them chosen for me.
--
cjARGB colors are not supported.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"CJ" <CJ@.newsgroup.nospam> wrote in message
news:E7870F65-DE71-4D39-9D47-748EB3FE7444@.microsoft.com...
>I am using SP1 and am trying to use the new custom color feature for chart
> series.
> The problem is that I want to specify a transparent color (Alpha = 50%).
> Is there any way of doing this? It seems that you can only enter colors
> that
> have RGB values, not ARGB values. (The System.Drawing.Color.FromArgb
> function
> does not work in an expression).
> At the moment, I am using the Semi-Transparent palette, but would like to
> choose the colors myself as opposed to having them chosen for me.
> --
> cj|||Will this be available in a future version?
"Lev Semenets [MSFT]" wrote:
> ARGB colors are not supported.
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "CJ" <CJ@.newsgroup.nospam> wrote in message
> news:E7870F65-DE71-4D39-9D47-748EB3FE7444@.microsoft.com...
> >I am using SP1 and am trying to use the new custom color feature for chart
> > series.
> > The problem is that I want to specify a transparent color (Alpha = 50%).
> > Is there any way of doing this? It seems that you can only enter colors
> > that
> > have RGB values, not ARGB values. (The System.Drawing.Color.FromArgb
> > function
> > does not work in an expression).
> > At the moment, I am using the Semi-Transparent palette, but would like to
> > choose the colors myself as opposed to having them chosen for me.
> > --
> > cj
>
>|||It is on the wishlist for a future version.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"CJ" <CJ@.newsgroup.nospam> wrote in message
news:B6B8C17A-19FC-4A5A-BDA3-24C7E5A962B4@.microsoft.com...
> Will this be available in a future version?
> "Lev Semenets [MSFT]" wrote:
> > ARGB colors are not supported.
> >
> > --
> > This posting is provided "AS IS" with no warranties, and confers no
rights.
> >
> >
> > "CJ" <CJ@.newsgroup.nospam> wrote in message
> > news:E7870F65-DE71-4D39-9D47-748EB3FE7444@.microsoft.com...
> > >I am using SP1 and am trying to use the new custom color feature for
chart
> > > series.
> > > The problem is that I want to specify a transparent color (Alpha =50%).
> > > Is there any way of doing this? It seems that you can only enter
colors
> > > that
> > > have RGB values, not ARGB values. (The System.Drawing.Color.FromArgb
> > > function
> > > does not work in an expression).
> > > At the moment, I am using the Semi-Transparent palette, but would like
to
> > > choose the colors myself as opposed to having them chosen for me.
> > > --
> > > cj
> >
> >
> >
Custom Series Color in SP1 Charts
and am unable to find documentation on it.
I read a post here on trying the Choose() function in the fill color portion
of the series value, but my chart goes gray in the layout mode, and then in
the preview mode it just shows the default colors.
Any documentation on this I can read?Keep in mind that expressions cannot be evaluated in design mode.
From the SP1 Readme about chart enhancements:
http://download.microsoft.com/download/7/f/b/7fb1a251-13ad-404c-a034-10d79ddaa510/SP1Readme_EN.htm#_chart_enhancements
"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."
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Matt" <Matt@.discussions.microsoft.com> wrote in message
news:1AA68AB0-128E-44B2-8519-6357D7EBD465@.microsoft.com...
> I'm trying to figure out how to create a custom series color in a bar
chart,
> and am unable to find documentation on it.
> I read a post here on trying the Choose() function in the fill color
portion
> of the series value, but my chart goes gray in the layout mode, and then
in
> the preview mode it just shows the default colors.
> Any documentation on this I can read?|||That makes sense,
But still having an issue of what function to use in the fill color field.
I have
=IIf( Fields!descriptn.Value = "Self", "white","Transparent")
But it seems to ingore it.
"Robert Bruckner [MSFT]" wrote:
> Keep in mind that expressions cannot be evaluated in design mode.
> From the SP1 Readme about chart enhancements:
> http://download.microsoft.com/download/7/f/b/7fb1a251-13ad-404c-a034-10d79ddaa510/SP1Readme_EN.htm#_chart_enhancements
> "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."
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Matt" <Matt@.discussions.microsoft.com> wrote in message
> news:1AA68AB0-128E-44B2-8519-6357D7EBD465@.microsoft.com...
> > I'm trying to figure out how to create a custom series color in a bar
> chart,
> > and am unable to find documentation on it.
> >
> > I read a post here on trying the Choose() function in the fill color
> portion
> > of the series value, but my chart goes gray in the layout mode, and then
> in
> > the preview mode it just shows the default colors.
> >
> > Any documentation on this I can read?
>
>|||There might be multiple issues here:
* A chart is similar to a matrix. Therefore a "cell" (datapoint) in a chart
can actually contain multiple rows depending on the groupings applied. Using
Fields!description.Value will always return the first value if multiple rows
are present.
If series groupings are present in the chart, you have to use
=First(Fields!description.Value, "NameOfInnermostSeriesGrouping") to get the
correct datapoint value in your expression. You might also want to check
this thread:
http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.sqlserver.reportingsvcs&mid=15f4e34b-345a-4876-8cbe-734b9e4dfa53&sloc=en-us
* Transparent is not a valid color. The only exceptions are currently the
chart area and the plot area fill colors (it's on the wishlist for
extensions in a future release).
Since transparent is not valid color, it gets ignored and the default color
(from the palette) applies. If you want to "hide" entire
datapoints/categories, you can filter them. If you have a solid plotarea
background color you could also assign the plotarea color to hide
datapoints.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Matt" <Matt@.discussions.microsoft.com> wrote in message
news:917930D0-5D0E-4231-A6BD-1B58602D4D9F@.microsoft.com...
> That makes sense,
> But still having an issue of what function to use in the fill color field.
> I have
> =IIf( Fields!descriptn.Value = "Self", "white","Transparent")
> But it seems to ingore it.
> "Robert Bruckner [MSFT]" wrote:
> > Keep in mind that expressions cannot be evaluated in design mode.
> > From the SP1 Readme about chart enhancements:
> >
http://download.microsoft.com/download/7/f/b/7fb1a251-13ad-404c-a034-10d79ddaa510/SP1Readme_EN.htm#_chart_enhancements
> > "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."
> >
> > --
> > This posting is provided "AS IS" with no warranties, and confers no
rights.
> >
> >
> > "Matt" <Matt@.discussions.microsoft.com> wrote in message
> > news:1AA68AB0-128E-44B2-8519-6357D7EBD465@.microsoft.com...
> > > I'm trying to figure out how to create a custom series color in a bar
> > chart,
> > > and am unable to find documentation on it.
> > >
> > > I read a post here on trying the Choose() function in the fill color
> > portion
> > > of the series value, but my chart goes gray in the layout mode, and
then
> > in
> > > the preview mode it just shows the default colors.
> > >
> > > Any documentation on this I can read?
> >
> >
> >|||We create one particular line chart in which the number of lines will be
different based on what the user selects when printing the report. They graph
the performance of their portfolio to that of 1-5 different indices. So the
chart will have between 2 and 6 different lines on it.
In the data tab of the chart, we have one item listed under values, one
under category groups, and one under series groups.
Everything works great. Our problem is that when there are so many lines
that the chart uses a Green and LightGreen color for two of the lines, our
client can't tell those two colors apart and wants us to use a different
color than LightGreen.
We have tried to use the various suggestions seen in this and other blogs to
customize the color but it doesn't work.
Can anyone help us? I can provide more info if needed.
This is what we have tried under
Edit Value=>Appearance=>Series Style=>Fill=>Color=>Expression:
=Choose(Fields!uv_port_type.Value,"Red","Blue","Green","Yellow","Purple","Orange")
=CStr(Choose(Fields!uv_port_type.Value,"Red","Blue","Green","Yellow","Purple","Orange"))
= Choose(First(Fields!uv_port_type.Value,
"dsUnitValues"),"Red","Blue","Green","Yellow","Purple","Orange")
= CStr(Choose(First(Fields!uv_port_type.Value,
"dsUnitValues"),"Red","Blue","Green","Yellow","Purple","Orange"))
(We also tried "IIF" statements.)
Thank you!
Jen
"Robert Bruckner [MSFT]" wrote:
> There might be multiple issues here:
> * A chart is similar to a matrix. Therefore a "cell" (datapoint) in a chart
> can actually contain multiple rows depending on the groupings applied. Using
> Fields!description.Value will always return the first value if multiple rows
> are present.
> If series groupings are present in the chart, you have to use
> =First(Fields!description.Value, "NameOfInnermostSeriesGrouping") to get the
> correct datapoint value in your expression. You might also want to check
> this thread:
> http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.sqlserver.reportingsvcs&mid=15f4e34b-345a-4876-8cbe-734b9e4dfa53&sloc=en-us
> * Transparent is not a valid color. The only exceptions are currently the
> chart area and the plot area fill colors (it's on the wishlist for
> extensions in a future release).
> Since transparent is not valid color, it gets ignored and the default color
> (from the palette) applies. If you want to "hide" entire
> datapoints/categories, you can filter them. If you have a solid plotarea
> background color you could also assign the plotarea color to hide
> datapoints.
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Matt" <Matt@.discussions.microsoft.com> wrote in message
> news:917930D0-5D0E-4231-A6BD-1B58602D4D9F@.microsoft.com...
> > That makes sense,
> >
> > But still having an issue of what function to use in the fill color field.
> >
> > I have
> >
> > =IIf( Fields!descriptn.Value = "Self", "white","Transparent")
> >
> > But it seems to ingore it.
> >
> > "Robert Bruckner [MSFT]" wrote:
> >
> > > Keep in mind that expressions cannot be evaluated in design mode.
> > > From the SP1 Readme about chart enhancements:
> > >
> http://download.microsoft.com/download/7/f/b/7fb1a251-13ad-404c-a034-10d79ddaa510/SP1Readme_EN.htm#_chart_enhancements
> > > "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."
> > >
> > > --
> > > This posting is provided "AS IS" with no warranties, and confers no
> rights.
> > >
> > >
> > > "Matt" <Matt@.discussions.microsoft.com> wrote in message
> > > news:1AA68AB0-128E-44B2-8519-6357D7EBD465@.microsoft.com...
> > > > I'm trying to figure out how to create a custom series color in a bar
> > > chart,
> > > > and am unable to find documentation on it.
> > > >
> > > > I read a post here on trying the Choose() function in the fill color
> > > portion
> > > > of the series value, but my chart goes gray in the layout mode, and
> then
> > > in
> > > > the preview mode it just shows the default colors.
> > > >
> > > > Any documentation on this I can read?
> > >
> > >
> > >
>
>|||I found the following on SQLJunkies.. Seems to work:
--
Need a custom palette for your charts? Embed the function below into your
report, and set the Data > Values > Appearance > Series Style > Fill to the
custom function =Code.SetColor. Replace the nnnn's below with the hex codes
you need. See http://www.321webmaster.com/colorconverter.php for an RGB to
hex converter online. And hug the Reporting Services developers for adding
custom color functionality into SP1.
Function SetColor As String
Static ColorCode as Integer
ColorCode = ColorCode + 1: If ColorCode > 5 then ColorCode = 1
Select Case ColorCode
Case 1:
SetColor = "#00nnnn" ' Bluish
Case 2:
SetColor = "#78nnnn" ' Greenish
Case 3:
SetColor = "#E2nnnn" ' Reddish
Case 4:
SetColor = "#00nnnn" ' Navyish
Case 4:
SetColor = "#CCnnnn" ' Yellowish
Case 5:
SetColor = "#00nnnn" ' Light Blueish
Case Else:
SetColor = "#000000" ' Black (placeholder)
End Select
End Function
--
I have a where I need to show an average value in bar graph, but how many
values went into that average is also important. I pull back a percentage in
the query and then created a function that based on a percentage, returns a
color. Added =Code.FunctionName(pct) to the series fill and voila!
George
"Jen Rubin" wrote:
> We create one particular line chart in which the number of lines will be
> different based on what the user selects when printing the report. They graph
> the performance of their portfolio to that of 1-5 different indices. So the
> chart will have between 2 and 6 different lines on it.
> In the data tab of the chart, we have one item listed under values, one
> under category groups, and one under series groups.
> Everything works great. Our problem is that when there are so many lines
> that the chart uses a Green and LightGreen color for two of the lines, our
> client can't tell those two colors apart and wants us to use a different
> color than LightGreen.
> We have tried to use the various suggestions seen in this and other blogs to
> customize the color but it doesn't work.
> Can anyone help us? I can provide more info if needed.
> This is what we have tried under
> Edit Value=>Appearance=>Series Style=>Fill=>Color=>Expression:
> => Choose(Fields!uv_port_type.Value,"Red","Blue","Green","Yellow","Purple","Orange")
> => CStr(Choose(Fields!uv_port_type.Value,"Red","Blue","Green","Yellow","Purple","Orange"))
> = Choose(First(Fields!uv_port_type.Value,
> "dsUnitValues"),"Red","Blue","Green","Yellow","Purple","Orange")
> = CStr(Choose(First(Fields!uv_port_type.Value,
> "dsUnitValues"),"Red","Blue","Green","Yellow","Purple","Orange"))
> (We also tried "IIF" statements.)
> Thank you!
> Jen
>
> "Robert Bruckner [MSFT]" wrote:
> > There might be multiple issues here:
> > * A chart is similar to a matrix. Therefore a "cell" (datapoint) in a chart
> > can actually contain multiple rows depending on the groupings applied. Using
> > Fields!description.Value will always return the first value if multiple rows
> > are present.
> > If series groupings are present in the chart, you have to use
> > =First(Fields!description.Value, "NameOfInnermostSeriesGrouping") to get the
> > correct datapoint value in your expression. You might also want to check
> > this thread:
> > http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.sqlserver.reportingsvcs&mid=15f4e34b-345a-4876-8cbe-734b9e4dfa53&sloc=en-us
> >
> > * Transparent is not a valid color. The only exceptions are currently the
> > chart area and the plot area fill colors (it's on the wishlist for
> > extensions in a future release).
> > Since transparent is not valid color, it gets ignored and the default color
> > (from the palette) applies. If you want to "hide" entire
> > datapoints/categories, you can filter them. If you have a solid plotarea
> > background color you could also assign the plotarea color to hide
> > datapoints.
> >
> > --
> > This posting is provided "AS IS" with no warranties, and confers no rights.
> >
> >
> > "Matt" <Matt@.discussions.microsoft.com> wrote in message
> > news:917930D0-5D0E-4231-A6BD-1B58602D4D9F@.microsoft.com...
> > > That makes sense,
> > >
> > > But still having an issue of what function to use in the fill color field.
> > >
> > > I have
> > >
> > > =IIf( Fields!descriptn.Value = "Self", "white","Transparent")
> > >
> > > But it seems to ingore it.
> > >
> > > "Robert Bruckner [MSFT]" wrote:
> > >
> > > > Keep in mind that expressions cannot be evaluated in design mode.
> > > > From the SP1 Readme about chart enhancements:
> > > >
> > http://download.microsoft.com/download/7/f/b/7fb1a251-13ad-404c-a034-10d79ddaa510/SP1Readme_EN.htm#_chart_enhancements
> > > > "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."
> > > >
> > > > --
> > > > This posting is provided "AS IS" with no warranties, and confers no
> > rights.
> > > >
> > > >
> > > > "Matt" <Matt@.discussions.microsoft.com> wrote in message
> > > > news:1AA68AB0-128E-44B2-8519-6357D7EBD465@.microsoft.com...
> > > > > I'm trying to figure out how to create a custom series color in a bar
> > > > chart,
> > > > > and am unable to find documentation on it.
> > > > >
> > > > > I read a post here on trying the Choose() function in the fill color
> > > > portion
> > > > > of the series value, but my chart goes gray in the layout mode, and
> > then
> > > > in
> > > > > the preview mode it just shows the default colors.
> > > > >
> > > > > Any documentation on this I can read?
> > > >
> > > >
> > > >
> >
> >
> >
Custom Semi-Transparent bar charts?
I know that SSRS 2005 has a built-in semi-transparent color chart palette, but I'd like to define my own custom color semi-transparent palette.
Brian Welker's blog (https://blogs.msdn.com/bwelcker/archive/2005/05/20/420349.aspx) has a terrific post on how to create your own custom color palette, but it generates solid colors. How can it be tweaked to create semi-transparent colors? Is there another function that needs to be created to define the transparency of the color palette?
Thanks in advance,
Pete
Sorry, semi-transparency cannot be achieved by defining your own custom color palette.
There are CustomReportItem-based chart add ins available for RS from third parties (such as Dundas and ChartFX) which will enable that kind of functionality in RS 2005.
-- Robert
|||Bummer.
Can images be used in charts? (I doubt it, but thought I'd inquire.)
Thanks,
Pete
Yes, you can use an image as a background image for the chart plotarea (select the chart and look for the BackgroundImage property in the VS properties window).
-- Robert
|||I should have made my followup question clearer. I meant to ask if images can be used in the actual charting of values, for example to use an image of coins for bar charts whereby the bars on the chart are actually a "stack" of the coins. Or to use an image that gets "stretched" on the bars of a bargraph.
--Pete
|||I believe the plug-in from Dundas ("Dundas Charts for Reporting Services") supports this, but you would need to check with them. It is not supported out of the box with the built-in charts.
-- Robert
|||Transparency is more than possible with ANY system palette or custom palette.
The trick (work-around whatever) lies in modifying the 'alpha' component of the colour for each series in the chart AFTER they have had their colour assigned to them.
ie. i used the code
//set the transparency of the series
if(_abstractChart.Options.Transparency > 0) {
//get the transparency as a percentage
double transPerc = _abstractChart.Options.Transparency / 100.00;
//Alpha value 255 is opaque, 0 is transparent. set the transparency as a % of 255
int alphaValue = (int) (255 * (1-transPerc));
_chart.ApplyPaletteColors();
foreach(Series series in _chart.Series) {
series.Color = Color.FromArgb(alphaValue, series.Color.R, series.Color.G, series.Color.B);
}
}
where
-abstractChart.Options.Transparency is the integer value (between 0 and 100 inclusive) denoting the transparent %.
-_chart is a Dundas.Charting.WebControl.Chart
in my C# application, a percentage value is retrieved from the user from an aspx form. I subtract the tranparent component of the alpha value from the max (255) to get the Opacity, which is what i set in the colour. Giving the user 101 grades of tranparency (no pun intended).
HOWEVER, i actually have a problem. Though this method works fine for bar chart, radar, area line charts, it DOES NOT work for pie charts. The semi-transparent palette works for pie charts, but this method does not.
Perhaps someone with more knowledge of the dundas system could use my solution in the right place to achieve transparency for pie charts?
please?
I thought maybe using this method in Customize, PrePaint or PostPaint event would work. Havent had the chance to try it yet.
Cheers
|||
Okay, i figured it out.
A bar chart has one series object in the Dundas.Charting.WebControl.Chart.Series[] of the chart for every bar, so setting the colour of the series would apply to the bar which that series plots.
A pie chart has one series object for the whole chart, and the slices are individual datapoints within that series.
The solution quite simply is to add another level to the loop which iterates through every datapoint of the current series.
If processing time is a concern there should be a check present for whether the second loop is necessary (so far i have only found it necessary within PIE charts)
if(abstractChart.Options.Transparency > 0) {
//get the transparency as a percentage
double transPerc = abstractChart.Options.Transparency / 100.00;
//Alpha value 255 is opaque, 0 is transparent. set the transparency as a % of 255
int alphaValue = (int) (255 * (1-transPerc));
chart.ApplyPaletteColors();
foreach(Series series in chart.Series) {
if(abstractChart.GetChartType != ChartType.Pie) {
series.Color = Color.FromArgb(alphaValue, series.Color.R, series.Color.G, series.Color.B);
}
else{
foreach(DataPoint dp in series.Points) {
dp.Color = Color.FromArgb(alphaValue, dp.Color.R, dp.Color.G, dp.Color.B);
}
}
}
}
Where
-abstractChart.Options.Transparency is the integer value (between 0 and 100 inclusive) denoting the transparent %.
-_chart is a Dundas.Charting.WebControl.Chart
-abstractChart.ChartType is an identifier for the type of chart we are plotting (Abstract Chart is one of MY classes, as is ChartType)
By the way, this code is called after the chart object has been created, but before returning from the method which created the chart object.
IE.
public Dundas.Charting.WebControl.Chart MakeChart(){
Dundas.Charting.WebControl.Chart chart = new Dundas.Charting.WebControl.Chart();
..
..
..
..
<transparency code>
..
..
..
return chart;
}
any questions?
LiLbUg@.ozemate.com
just an out of topic question: sorry because i need an answer really fast hope you understand....
Hi everyone,
I just inquiring if the 'My subscription' toolbar at the upper right portion of the report manager can be removed? or shall we say hide... If possible, how to remove please help...
Another question is when you click the show details button, the option to delete and move appears but it is initially disabled...is there a way also to hide the move button?
thank you very much...hope to have any response or advice as soon as possible...thanks
|||Hello Thor:
Interesting... I'm a little confused, though. Is your code affecting the Dundas charting component or are you suggesting a way to create charting transparency in reporting services without the need for a third party add-in like Dundas (or ChartFX)?
Thanks,
Pete
|||hey pete
yeh, not sure what you mean, theres alot of syllables in some of those words.
To try to answer your question; i'm using dundas, and the code i supplied directly changes the colour value for datapoint objects/series objects inside a DUNDAS chart. IE i assign a new colour for each datapoint/series in the code, in this case the new colour is the same as the old one (which is assigned from the palette) except the alpha value has been changed.
effectively, any palette can therefore have transparency applied to it, retaining the oiginal colours of the palette.
SO... i think the answer to your question is that this code NEEDS dundas and i affect the instance of the dundas charting component to create transparency.
but technically this should work for any charting tool that allows you to modify the colour of the datapoints in a series after they have been assigned a colour and before they are drawn.
ps. last time i ran my app. it changed the colour for the whole pie chart to the colour of the first datapoint. i think this code would have to be in the PrePaint event (its worked there before).
ill post again when i know for sure.
...Edit...
just read the top post again, and realised you're not using dundas. for some reason i thought this was all about dundas.
anyways, this should work for that charting thing you use IF you can change the colours of the series / datapoints at the right time. Might take some experimenting to figure out where, or even if you can do it.
Monday, March 19, 2012
Custom Report Items
I want change reports' style after the deployment, so each client can have his style.
Nobody know I can do?
(change the color of table/matrix, insert a image...)Hi,
this can′t be done by a normal predefined report, you have to use the report builder for that. By creating a report model you wil lhave the avaibility to let the user create his own reports from scratch.
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
Friday, February 24, 2012
Custom color for text
Hello. I have a textbox in which I want to customize the color of the text. When you go to Properties->Color, the pull-down lets you choose from a pre-defined list of colors by name (Black, DimGray, Gray, etc.) You can also enter an expression. What I want to do is customize a color that is different than the predefined colors. For example: I want a color that is red 81, blue 81, green 123. The pseudocode for the Expression would be:
= ColorType(81, 81, 123)
Is there a way to do this in Reporting Services? Thanks in advance.
Justin
In case anyone is reading this and wants to know the answer, I found out from someone on another forum. This is handled by creating an Expression like this:
=#AABBCC
where AA = the hex value of the red (00-FF)
BB = the hex value of the green (00-FF)
CC = the hex value of the blue
So, if you wanted your color of the text, background, or whatever to be (184, 184, 208), you would use the following expression:
=#B8B8D0
Justin
Custom Code in Chart - background color
public function bdr_chartcolor(xType as string) as string
IF xType = "IR"
return "White"
ELSE
return "Blue"
END IF
end function
HOW and WHERE do I implement it to set the charts background color? Many
properties of objects have EXPRESSION as an option, HOWEVER, there is no
EXPRESSION as a type for a chart's background color in the properties.Chart area, Fill.
"MSSQLServerDeveloper" <MSSQLServerDeveloper@.discussions.microsoft.com>
wrote in message news:22B72235-5282-4095-951F-9B9DCF89E0B3@.microsoft.com...
>I have the following very simple code block that I wrote for a chart.
> public function bdr_chartcolor(xType as string) as string
> IF xType = "IR"
> return "White"
> ELSE
> return "Blue"
> END IF
> end function
> HOW and WHERE do I implement it to set the charts background color? Many
> properties of objects have EXPRESSION as an option, HOWEVER, there is no
> EXPRESSION as a type for a chart's background color in the properties.|||Sorry,
plot area, fill.
There are two, the area outside the chart plot area and the area inside the
chart plot area.
Use Code.bdf_chartcolor(...) in the expression editor.
"MSSQLServerDeveloper" <MSSQLServerDeveloper@.discussions.microsoft.com>
wrote in message news:22B72235-5282-4095-951F-9B9DCF89E0B3@.microsoft.com...
>I have the following very simple code block that I wrote for a chart.
> public function bdr_chartcolor(xType as string) as string
> IF xType = "IR"
> return "White"
> ELSE
> return "Blue"
> END IF
> end function
> HOW and WHERE do I implement it to set the charts background color? Many
> properties of objects have EXPRESSION as an option, HOWEVER, there is no
> EXPRESSION as a type for a chart's background color in the properties.