如何根据 TOP(x) 样式查询使用静态范围和显示成员
How to use a static range and display members according a TOP(x) style query
我们正在尝试添加一个滑块 jquery 小部件,并希望定义一个静态范围,比如从 0% 到 100% 的百分比。
然后我们想使用滑块在该范围内的值作为 TOP(x) 的参数,如图所示。
这可能吗?
有什么提示吗?
我已经为您创建了一个示例报告,请使用默认的 [Sales] 架构导入它
https://drive.google.com/file/d/0B3kSph_LgXizdk9OdnlTWkxHa1U/view?usp=sharing
您可以通过使用下一个序列来实现此功能:
- 创建滑块小部件
- 打开小部件选项对话框并配置小部件属性
- Select 查询向导 -> 查询类型:Mdx 层次结构
- 添加单个随机层次结构以绕过验证(它将被替换)
- Initial Selection设置默认值(即10%)
- 将代码添加到您的报告中javascript
viz.filters.Slider.prototype.componentWillMount = function(){
if(_.isArray(this.props.items))
this.setState({
entities:new viz.EntityData(this.props.items),
range:_.map(this.props.defaults,"uniqueName")
});
}
viz.filters.Slider.prototype.onBuildAllDone = function(){
if(!_.isEmpty(this.state.range)) {
this.fireEvent(vizEventType.onSelection,
this.createEvent(this.state.range));
this.fireEvent(vizEventType.onNewLabel,
this.createEvent(this.state.range));
}
}
function consumeEvent( context, event ) {
if (event.name == 'ic3-report-init') {
// Following code will replace a data provider for Slider
// with generated numbers. But to do so, you'll need UID of
// the Slider widget, in this example it's "w1"
var widget = event.value.widgetMgr().getItemById("w1");
_.assign(widget.builder().guts_, {
items:_.times(100, function(idx){
return {
name:idx + 1 + "%",
uniqueName:idx + 1
}
})})
}
}
我们正在尝试添加一个滑块 jquery 小部件,并希望定义一个静态范围,比如从 0% 到 100% 的百分比。 然后我们想使用滑块在该范围内的值作为 TOP(x) 的参数,如图所示。
这可能吗? 有什么提示吗?
我已经为您创建了一个示例报告,请使用默认的 [Sales] 架构导入它 https://drive.google.com/file/d/0B3kSph_LgXizdk9OdnlTWkxHa1U/view?usp=sharing
您可以通过使用下一个序列来实现此功能:
- 创建滑块小部件
- 打开小部件选项对话框并配置小部件属性
- Select 查询向导 -> 查询类型:Mdx 层次结构
- 添加单个随机层次结构以绕过验证(它将被替换)
- Initial Selection设置默认值(即10%)
- 将代码添加到您的报告中javascript
viz.filters.Slider.prototype.componentWillMount = function(){
if(_.isArray(this.props.items))
this.setState({
entities:new viz.EntityData(this.props.items),
range:_.map(this.props.defaults,"uniqueName")
});
}
viz.filters.Slider.prototype.onBuildAllDone = function(){
if(!_.isEmpty(this.state.range)) {
this.fireEvent(vizEventType.onSelection,
this.createEvent(this.state.range));
this.fireEvent(vizEventType.onNewLabel,
this.createEvent(this.state.range));
}
}
function consumeEvent( context, event ) {
if (event.name == 'ic3-report-init') {
// Following code will replace a data provider for Slider
// with generated numbers. But to do so, you'll need UID of
// the Slider widget, in this example it's "w1"
var widget = event.value.widgetMgr().getItemById("w1");
_.assign(widget.builder().guts_, {
items:_.times(100, function(idx){
return {
name:idx + 1 + "%",
uniqueName:idx + 1
}
})})
}
}