pentaho CDE气泡图的条件格式 [英] pentaho CDE conditional formatting of bubble chart
问题描述
我在CDE中使用了CCC热网格来创建带有不同颜色气泡的气泡图.我的数据集只有6个值:(1、1.1、2、2.1、3、3.1).我将 sizeRole 属性设置为值",以便气泡的大小根据这六个值的大小而变化.或者,我可以将 colorRole 属性设置为"value".我设置了三种颜色:绿色(1),黄色(2)和红色(3).
I have used CCC Heat Grid in CDE to create a bubble chart with bubbles of different colors. My data set has only 6 values: (1, 1.1, 2, 2.1, 3, 3.1). I have sizeRole property to "value" so that the size of the bubble varies based on the magnitude of these six values. Alternative, I could have set colorRole property to "value". I have set three colors: green (1), yellow (2) and red (3).
现在,我想将1设为绿色,将2设为黄色,将3设为红色;以及最大恒定尺寸为1.1、2.1和3.1.值1.1、2.1和3.1代表我的数据集中的警报,因此我希望它们具有最大气泡大小或其他一些有区别的可视元素.
Now, what I want to have 1 as green, 2 as yellow and 3 as red; and biggest constant size for 1.1, 2.1 and 3.1. The values 1.1, 2.1 and 3.1 represent alarms in my data set, so I want them to be of biggest size bubble or some other differentiating visual element.
我在执行前尝试了以下方法,但没有运气
I tried the following in pre-execution but no luck
function changeBubbles(){
var cccOptions = this.chartDefinition;
// For changing extension points, a little more work is required:
var eps = Dashboards.propertiesArrayToObject(cccOptions.extensionPoints);
// add extension points:
eps.bar_shape = function getShape(){
var val = this.scene.vars.value.value;
if(val == 1.1 || val == 2.1 || val == 3.1){
return 'cross';
}
else {}
};
// Serialize back eps into cccOptions
cccOptions.extensionPoints = Dashboards.objectToPropertiesArray(eps);
}
我们如何实现这一目标?
How can we achieve this?
推荐答案
我希望答案仍然有意义,因为这是一个较晚的答复.
I hope the answer is still relevant, given that this is a late response.
要使用气泡,您应该具有useShapes: true
.
您可以使用shape选项设置其他恒定形状.例如,shape: "cross"
.
To use bubbles you should have useShapes: true
.
You can set a different constant shape by using the shape option. For example, shape: "cross"
.
要使气泡大小恒定,应将"sizeRole"设置为null:sizeRole: null
.气泡将占据所有可用的单元格"大小.
To have the bubble size be constant, you should set the "sizeRole" to null: sizeRole: null
. Bubbles will take all of the available "cell" size.
然后,"value"列应由"colorRole"拾取,但要明确,请指定:colorRole: "value"
.
Then, the "value" column should be picked up by the "colorRole", but to be explicit, specify: colorRole: "value"
.
默认情况下,由于颜色角色将绑定到连续的尺寸(值"),因此色标也将是连续的.
By default, because the color role will be bound to a continuous dimension ("value"), the color scale will be continuous as well.
要使其成为离散比例,请将值"维度更改为离散比例:
To make it a discrete scale, change the "value" dimension to be discrete:
dimensions: {
"value": {isDiscrete: true}
}
最后,要确保将颜色映射到所需的值,请指定"colorMap"选项:
Finally, to ensure that the colors are mapped to the desired values, specify the "colorMap" option:
colorMap: {
"1": "green",
"2": "yellow",
"3": "red"
}
就是这样.我希望这是可行的:-)
That's it. I hope this just works :-)
这篇关于pentaho CDE气泡图的条件格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!