Webdatarocks Reportsetup:如何显示同一属性("唯一名称")的多个聚合



假设我的数据源显示了按产品类型分组的不同产品的价格和数量。

是否有可能为每个属性显示两列(两个用于价格,两个用于数量),其中一个显示平均值,另一个显示标准?

您可以为每个值字段添加第二个聚合作为计算值:

measures: [{
uniqueName: "Price",
aggregation: "stdevs",
caption: "STDEV of Price"
},
{
uniqueName: "PriceAverage",
formula: "average('Price')",
caption: "Average of Price"
}]

下面是一个完整的例子:

var pivot = new WebDataRocks({
container: "#wdr-component",
toolbar: true,
report: {
dataSource: {
dataSourceType: "csv",
filename: "https://cdn.webdatarocks.com/data/data.csv"
},
options: {
showAggregationLabels: false
},
slice: {
rows: [{
"uniqueName": "Category"
}],
columns: [{
"uniqueName": "Measures"
}],
measures: [{
uniqueName: "Price",
aggregation: "stdevs",
caption: "STDEV of Price"
},
{
uniqueName: "PriceAverage",
formula: "average('Price')",
caption: "Average of Price"
},
{
uniqueName: "Quantity",
aggregation: "stdevs",
caption: "STDEV of Quantity"
},
{   uniqueName: "QuantityAverage",
formula: "average('Quantity')",
caption: "Average of Quantity"
},
]
},
formats: [{
name: "", //default format
decimalPlaces: 2,
currencySymbol: "$",
currencySymbolAlign: "left"
}]
}
});
<link href="https://cdn.webdatarocks.com/latest/webdatarocks.min.css" rel="stylesheet"/>
<script src="https://cdn.webdatarocks.com/latest/webdatarocks.toolbar.min.js"></script>
<script src="https://cdn.webdatarocks.com/latest/webdatarocks.js"></script>
<div id="wdr-component"></div>

相关内容

  • 没有找到相关文章

最新更新