Brush Color is incorrect for CrossTab
Posted: Wed Feb 17, 2021 1:40 pm
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 I have attached the example
Moreover, when I preview it in Cloud it doesn't show the colors at all Can you check what is wrong?
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 I have attached the example
Moreover, when I preview it in Cloud it doesn't show the colors at all Can you check what is wrong?