简体   繁体   English

BIRT CELL 条件突出显示

[英]BIRT CELL CONDITIONAL HIGHLIGHTING

I need to color some rows in a report table with BIRT.我需要用 BIRT 为报告表中的某些行着色。 There is already something similar discussed but it is not enough for me.已经有类似的讨论,但对我来说还不够。

What I would like to do is color the cells like Excel does with its conditional formatting ie I have several rows and I want to color them acoording to its “intensity”.我想做的是像 Excel 这样的单元格用它的条件格式着色,即我有几行,我想根据它的“强度”给它们着色。 For example, r1= 10, r2= 20, r3= 100. I would see r3 with the most saturated color and r1 with the least.例如,r1= 10, r2= 20, r3= 100。我会看到 r3 的颜色最饱和,而 r1 的颜色最少。

在此处输入图像描述

Cheers!干杯!

You can do this with Javascript inside the onCreate event.您可以在 onCreate 事件中使用 Javascript 执行此操作。 Probably better for the data item itself, not for the cell containing the item.对于数据项本身可能更好,而不是包含该项目的单元格。

At least this is easy with table items, but it seems you are using a cross tab.至少这对于表格项目很容易,但似乎您正在使用交叉表。 The following guide is for TABLEs: You can access the value with the ususal row["NAME"] syntax in the onCreate event, even though the palette does not offer it.以下指南适用于 TABLE:您可以在 onCreate 事件中使用通常的 row["NAME"] 语法访问该值,即使调色板不提供它。 So, for example (untested):因此,例如(未经测试):

var cell_value = row["NAME"];
var intensity = do_something_to_compute_this_from(cell_value);
// should be in the range 0.0 to 1.0
// Now compute RGB values from a "base" RGB ( 0 .. 255 )
var white = [255, 255, 255];
var base = [ 0, 60, 0 ]; // some green
var result = [];
for (var i=0; i<3; i++) {
    var w = white[i];
    var b = base[i];
    var r = int( intensity * b + (1-intensity) * w ); 
    result.push(r);
}
this.getStyle().backgroundColor = "RGB(" + result[0] + "," + result[1] + "," + result[2] + ")";

Have you tried using the Conditional Formatting associated with the Highlight feature?您是否尝试过使用与突出显示功能相关的条件格式?

You would click on the cell where you want the conditional formatting.您将单击需要条件格式的单元格。 Click on the highlights tab Click on Add Set up your condition Set up your preferred format单击突出显示选项卡单击添加设置您的条件设置您的首选格式

enter image description here .在此处输入图像描述 I tried sending a screenshot of the screen where the conditional formatting is set up, but I guess I'm too new to this format.我尝试发送设置条件格式的屏幕截图,但我想我对这种格式太陌生了。 Let me know if you need more information.如果您需要更多信息,请与我们联系。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM