I have an ssrs report where I have many pie charts with the fields pass and fail as well as up to 3 other miscellaneous fields and I wish to be able to color the pass always green and the fail always red but the other fields could be a default value. Is this even possible to do? I have seen code examples with code for custom color in pie charts but I have no clue how to do this and have not found where I would put my custom code. What im trying to do is slightly different from what all those other examples do whith only defining a few fields.
=Switch
(
Fields!ResultTypeDescription.Value = "Pass", "Green",
Fields!ResultTypeDescription.Value = "Fail", "Red",
Fields!ResultTypeDescription.Value = "Assigned To Machine", "Blue",
Fields!ResultTypeDescription.Value = "Not Yet Assigned", "Orange",
True , "Gray"
)
In order to get our dynamic coloring working,i overrode the colors from the palette. This is how it’s done. Right-click on the pie and select Series Properties. Select the Fill page and click the Expression (fx) button to define the color.
Related
I am using below code to color my pies in Pie chart so that each pie will have the same color of its value range. This code is working fine.
for I = 1 to UBound (vntValues)
myseries.Points(I).Interior.color = Range(s).cells(I).interior.color
next I
I want to change the font color of each pie according to the its value range. I tried below code but its not working.
myseries.Points(I).Font.color = Range(s).cells(I).Font.color
Its giving the error as
object doesn't support this property or method.
Can you please help me with the correct method to do it.
Thanks.
Semi-tested:
mySeries.Points(I).DataLabel.Characters.Font.Color = Range(s).cells(I).Font.color
I have a Kendo for Angular column chart where we change the colors. The colors of the bars changed, but the Legend is still showing the default colors. Anybody know what Im missing?
https://stackblitz.com/edit/angular-8smzaw
The colours in the legend correspond to the colours of the series. Setting the colours of each column does not change the series. You need to remove the color settings and set the series instead.
Your template definitions should look something like this:
<kendo-chart [seriesColors]="['#4F81BD', '#C0504D']">
<kendo-chart-legend position="top"></kendo-chart-legend>
<kendo-chart-axis-defaults>
<kendo-chart-axis-defaults-labels format="c0"></kendo-chart-axis-defaults-labels>
</kendo-chart-axis-defaults>
<kendo-chart-tooltip format="{0:C}"></kendo-chart-tooltip>
<kendo-chart-series>
<kendo-chart-series-item
*ngFor="let item of detailSeries"
[data]="item.items" [name]="item.value"
field="value" categoryField="service"
type="column">
</kendo-chart-series-item>
</kendo-chart-series>
<kendo-chart-category-axis>
<kendo-chart-category-axis-item>
<kendo-chart-category-axis-item-labels [rotation]="-45"></kendo-chart-category-axis-item-labels>
</kendo-chart-category-axis-item>
</kendo-chart-category-axis>
</kendo-chart>
I have 2 columns of data for my chart, but the second one is optional (with an IF formula).
I want the legend to only show the relevant series.
Because the legend is visible even if there is no data for the second column, I wrote this in the cell for the series name:
=IF(…………;"blabla";"")
Now the legend has no label and only the (yellow dashed) line appears:
How can I hide both the label and the line in this legend if the series has no data?
You can use VBA to realize this.
in Excel 2013 onward model
you can use Chart.FullSeriesCollection to select your series and toggle its Isfiltered properties
Like
If.....Then
ChartObjects("xxxx").Chart.FullSeriesCollection(2).IsFiltered = True
Else
ChartObjects("xxxx").Chart.FullSeriesCollection(2).IsFiltered = False
End if
If you are using old excel, like excel 2007, excel 2010.. you should only use Chart.legend.legendEntries(2).Delete to get rid of the legend. if you wanna toggle it back, you should use chart.hasLegend = false, Chart.hasLegend = true to make it back
I'm using Power Builder 10.5 and I'm having a problem that seems simple at first, but can't get near the solution.
Is it possible to color rows differently depending on a condition? I have a select statement that retrieves numerous rows, that have different status: status A means the row is active, ERR that something is wrong, F that is finished, and so on...
What I need is the color of the column with status "ERR" to be red, and the color of the column with status "A" to be green. All else columns may be white.
I can do only half the job at the moment. I've added a dummy field in my Data Window, called "color". For all the cells I've written this in the design view, background color properties..
IF ( color =1, 65280, 16777215)
Now I move to the clicked event of my OK button where I retrieve data...
dw_1.Retrieve()
FOR ll_=1 to dw_1.RowCount()
ls_status=dw_1.GetItemString(ll_,"status")
IF ls_status='A' THEN
dw_1.SetItem(ll_, 'color', 1)
ELSEIF ls_status='ERR' THEN
??????
END IF
NEXT
The part with question marks is where I can't move forward. This highlights all my rows where status is "OK" green, but I can't seem to get the error ones red. I've tried manipulating the code in background color properties (trying to give him a condition if color=2), but I just keep getting the "Expression not valid" message.
Modify method also didn't help me much, as I can't seem to make him color only does rows with "ERR" status using Modify method.
Any advice will help.
You should set your 'color' column in the SQL statement itself.
SQL something like
CASE status WHEN 'ERR' THEN 'R' WHEN 'A' THEN 'G' END
Then in an expression on the background color of the columns of your datawindow you can put something like
if (color[0] = 'R', RGB(255,0,0), if (color[0] = 'G', RGB(0,255,0), RGB(0,0,0)))
In the datawindow properties of the object or band, go to the background tab. The Color property has a little button with an equal sign (=) on it. Click that and write an expression to derive a RGB value based on the value of a column.
I wrote an article about this stuff here: PBDJ Article
You can use case statements in the computed property. Something like this:
case( status when 'ERR' then RGB(255,0,0) when 'A' then RGB(0,255,0) else RGB(0,0,0) )
I'm using a rdlc report.
I have a text field 'surname' and a boolean field 'sales'.
Depending on the value of the boolean field I want the text to be red or black.
Looking at examples I should be changing the text color.
But the label on the dialog box when I select 'expression' says 'Set expression for:Value' but I think I should be a able to select to set the expression for color.
I have the following expresion but it just displays the text "Black" and "Red" in the text box.
=IIF(Fields!sales.Value,"Black","Red")
Seems like you are putting expression for value of Textbox. Instead put for Font Color
=IIf(fields!sales.Value = "true","Black","Blue")
To set expression for fontcolor
Textbox properties --> color --> Expression.
Let me know if it works for you
IIF(Fields!MiCampo.value = "Bueno","Green","Red")
other solution...
Fields!MiCampo.value TYPE string
VALUE IS = "Orange"
In expression...
=Fields!MiCampo.value.ToString()