Brush Color is incorrect for CrossTab

Stimulsoft Reports.WEB discussion
Post Reply
salexn
Posts: 12
Joined: Wed Feb 17, 2021 1:21 pm

Brush Color is incorrect for CrossTab

Post by salexn »

Hello Team!
need to specify the color of the total column using this rule
Green: 100% - 71%
Yellow: 41% - 70%
Red: 0% - 40%
Grey: N/A

I use the following code to achieve this (ProcessCell event):

decimal val = 0.0M;
if (e.Row > 1) {
if (Decimal.TryParse(OverallScore.DataTable.Rows[e.Row - 2][1].ToString(), out val)){
e.Text = String.Format("{0:P2}", val);
if (val == -1.0M) {
e.Text = "N/A";
((StiText)(sender)).Brush = new Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.LightGray);
} else
if (val >= 0.0M && val < 0.4M) {
((StiText)(sender)).Brush = new Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.Red);
} else
if (val >= 0.4M && val < 0.7M) {
((StiText)(sender)).Brush = new Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.Orange);
} else
if (val >= 0.7M) {
((StiText)(sender)).Brush = new Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.Green);
}
}
}

But for some reason the result is incorrect
The attachment Incorrect Color.png is no longer available
I have attached the example

Moreover, when I preview it in Cloud it doesn't show the colors at all
The attachment No Colors.png is no longer available
Can you check what is wrong?
Attachments
Incorrect Color.png
Incorrect Color.png (14.93 KiB) Viewed 549 times
Lech Kulikowski
Posts: 6196
Joined: Tue Mar 20, 2018 5:34 am

Re: Brush Color is incorrect for CrossTab

Post by Lech Kulikowski »

Hello,

Please send us a sample report with test data that reproduces the issue for analysis.

> Moreover, when I preview it in Cloud it doesn't show the colors at all

On the Cloud, events are not supported.

Thank you.
Post Reply