如何编辑CDE仪表板中的默认工具提示?如果饼图的工具提示如下:
Series: Fuel
Category : D
Value: 0.15
我想将系列,类别,价值更改为其他标题。 三江源
答案 0 :(得分:1)
以下是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; }
答案 1 :(得分:0)
更改CDEdashboard工具提示,将此功能添加到Post Fetch。
function f(data) {
this.chartDefinition.dimensions = {
series: {isHidden: true},
category: {label: "Category"},
value: {label: "Value" }
};
return data;
}