SSRS customized bar chart color - ssrs-2008

I've to show colors depending of the percentages of each bar in my chart report.
I'm using a expression in a "Series Properties"
=IIf (Fields!TotalComplete.Value / Fields!TotalJobs.Value <= 85, "Red",
IIf (Fields!TotalComplete.Value / Fields!TotalJobs.Value >= 97, "Green", "Orange"))
But all bar are showing in Red color
What I'm setting bad?
Thanks,
Eliana

I think your problem is that you are comparing to 85 and 97 when you probably ought to be comparing to .85 and .97. Also, you need to work with aggregate values, like this:
=iif(sum(Fields!TotalComplete.Value)/sum(Fields!TotalJobs.Value) <= .85, "Red", iif(sum(Fields!TotalComplete.Value)/sum(Fields!TotalJobs.Value) >= .97, "Green", "Orange"))
If that doesn't solve the problem, try creating a table using the same groupings you have for your chart and put this expression into a text box so that you can see what value is calculating:
sum(Fields!TotalComplete.Value)/sum(Fields!TotalJobs.Value)

i think u can try Switch Clause for this,
syntax will be
=Switch(
(Fields!TotalComplete.Value / Fields!TotalJobs.Value) <= 85, "Red",
(Fields!TotalComplete.Value / Fields!TotalJobs.Value) >= 97, "Green",
"Orange"
)

Related

How to get first elements from a pyspark array?

I have an array and I just keep a specific column from it like this in PySpark:
c = [ "green", "blue", "red", "yellow",... ]
And I want to keep the n first elements of this column
How can I do this please ? I know is a simple question but I don't find the solution ...
Thanks

Interrupt a line in Chart.js lines

I've a weird situation in chart.js, see the picture
Basically a dataset with 4 date and 4 numbers. All 4 numbers value are 1 (doesnt matter).
But actually the real data need to show just 2 intervals (1/1/2020 -> 2/2/2020) and (3/4/2021->6/6/2021). Basically without the segment in the middle.
In this case there is no way Chart.js would be able to understand to not drawn that segment, all values are 1 in all 4 different dates.
So the only solution in my mind is to sub divide all the intervals so I can place a NaN in the middle and use something like stepped:true for the line. But with a lot of data I basically double the numbers of dates making the graph more confusing.
So the question is.. Is there any way to specify for given point if it's a start or an end ?
Or maybe there is a better approach instead of a single line dataset?
Thank you.
Just pass 2 datasets:
const labels = Utils.months({count: 7});
const data = {
labels: labels,
datasets: [{
label: 'My First Dataset',
data: [65, 59, 80],
fill: false,
borderColor: 'rgb(75, 192, 192)',
tension: 0.1
},{
label: 'My 2nd Dataset',
data: [null, null, null, 81, 56, 55, 40],
fill: false,
borderColor: 'rgb(75, 40, 192)',
tension: 0.1
}]
};
If You pass objects instead of arrays as data, then you do not even have to pad with nulls

Custom Chart Fill / Pattern

I am struggling to define the fill color and fill pattern of a stacked column chart. To clarify, I have one series value, and two series groupings (RepairLevel, InProcess).
In the fill color expression I have:
=Switch( Fields!RepairLevel.Value = "Major", "red"
,Fields!RepairLevel.Value = "Mid", "orange"
,Fields!RepairLevel.Value = "Minor", "yellow"
,Fields!RepairLevel.Value = "NA", "grey"
,Fields!RepairLevel.Value = "Unspecified", "light grey" )
In the fill pattern expression I have entered:
=Switch( Fields!InProcess.Value = True, "BackwardDiagonal"
,Fields!InProcess.Value = False, "None" )
It seems that the fill color is working properly. However, the fill pattern is not -- I am getting various fill patterns. Thanks in advance for any insights, I truly appreciate your time.

Assign a color to individual row numbers

I am trying to assign an individual color to each row in a group. There are approximately 50 rows I need to assign a color and they all must be unique. What would be the easiest way to do this?
I do not want to do the alternating row colors:
"=IIf(RowNumber("DataSet1") Mod 2 = 1, "White","Blue")",
but if there was a way to modify this expression to do 50 colors and then repeat I'd be okay with that.
you can use choose . otherwise use custom code function
=Choose(ROWNUMBER(nothing) mod 50, "Brown", "Blue", "GoldenRod", "Olive", "MediumTurquoise","Red", "Green", "DeepSkyBlue", "Yellow", "Chocolate", "Purple", "DarkOrange" ,.....)

Regarding Jasper report bar chart

I'm using jasper ireport 4.0.1 for developing. And I need to realize a bar graph being shown according to the imported 2 parameter one is for the used and the other is the total value. I want the left part of this bar represented in red color and the length will be changed according to the proportion of the used value out of the total also the used value need to be shown on this part of bar and the rest of the bar in green colour with the length regarding the total minus by the used value. How can I realize that, any help will be appreciated!
Let say the total value is 45
If the used value is 24 then the bar graph will show as follow
If the used value is 44 then the bar graph will looks like this
Regards,
You can achieve that by defining 2 parameters:
max: maximum value
proportion: value when it should switch between blue and green.
Then you add a stacked bar chart with 3 series:
Series1: series expression: "RED", category expression $F{<field>}, value expression $F{<value>}
Series2: series expression: "BLUE", category expression $F{<field>}, value expression $F{<value>} < $P{proportion} ? $P{max} - $F{<value>} : 0
Series3: series expression: "GREEN", category expression $F{<field>}, value expression $F{<value>} >= $P{proportion} ? $P{max} - $F{<value>} : 0