如何在 CDE 仪表板中编辑默认工具提示?如果饼图的工具提示是这样的:
Series: Fuel
Category : D
Value: 0.15
我想将系列、类别、值更改为其他标题。谢谢
这是 pentaho 论坛中的链接:http ://forums.pentaho.com/showthread.php?141559-Edit-Tooltip-in-CDE-dashboard
我试过了,它奏效了。
将 Pentaho 论坛的原始答案复制到 Mogsdad 建议的此处:
每个值在工具提示中显示的标签是相应维度的标签。
如果要显示完全不同的工具提示,则必须指定选项 tooltipFormat。
如果您只想更改显示的标签,则只需更改尺寸的标签。
因为可以使用任意名称定义维度(即使默认名称是众所周知的),所以没有固定的 CDE 属性。名称必须在 JS 代码中更改。
更改默认尺寸的标签
将以下代码添加到 CDE 图表组件的 postFetch 处理程序:
代码:
function f(data) { // Change the labels of the default dimensions // See http://www.webdetails.pt/charts/jsdoc/symbols/pvc.options.charts.Chart.html#dimensions this.chartDefinition.dimensions = { series: {label: "Product Family"}, category: {label: "Period"}, value: {label: "Sales" } }; return data; }
更改尺寸的名称和标签
也可以更改维度的名称以匹配相应业务概念的名称:
代码:
function f(data) { var options = this.chartDefinition; // It is not necessary to explicitly define dimensions // They are created automatically, with appropriate default properties, // when referring to their names in certain other properties. // But we can define them anyway, if we want to change the default labels. // Default labels are taken from the data source, when possible, // or derived from the dimensions' names. // See http://www.webdetails.pt/charts/jsdo...tml#dimensions this.chartDefinition.dimensions = { productFamily: {label: "Product Family"}, period: {label: "Period"}, sales: {label: "Sales" } }; // MAP columns in the data source to corresponding dimensions // See http://www.webdetails.pt/charts/jsdo...t.html#readers options.readers = [{names: "productFamily, period, sales"}]; // MAP dimensions to the chart's Visual Roles // See http://www.webdetails.pt/charts/jsdo...ml#visualRoles // The following can also be set as CDE properties. // The "series" role receives the data of the "productFamily" dimension // See http://www.webdetails.pt/charts/jsdo...tml#seriesRole options.seriesRole = "productFamily"; // The "category" role receives the data of the "period" dimension // See http://www.webdetails.pt/charts/jsdo...l#categoryRole options.categoryRole = "period"; // The "value" role receives the data of the "sales" dimension // See http://www.webdetails.pt/charts/jsdo...html#valueRole options.valueRole = "sales"; return data; }
要更改 CDEdashboard 工具提示,请将此功能添加到 Post Fetch。
function f(data) {
this.chartDefinition.dimensions = {
series: {isHidden: true},
category: {label: "Category"},
value: {label: "Value" }
};
return data;
}