Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microstrategy Using a visualization as a selector D3 costum chart

I'm trying to use a visualization as a selector on a D3 costum chart. I'm following the SDK documentation Here, and I can't make my example work.

Basicly I star by declaring "me" var and enable the "use as filter" option.

var me = this;
this.addUseAsFilterMenuItem();

Then, when appending de svg element, I add the clear and end selecion methods:

var g = d3.select(this.domNode).append("svg")
    .attr("width", width + margin.left + margin.right)
    .attr("height", height + margin.top + margin.bottom)
    .append("g")
    .attr("transform", "translate(" + margin.left + "," + margin.top + ")")
    .on("click", function(d) {
        if (event.target.classList.contains('bar')) {
            me.clearSelections();
            me.endSelections();
            return true;
        } else {
            return true;
        }
     });

When getting data I use the hasSelection attribute:

var data = this.dataInterface.getRawData(mstrmojo.models.template.DataInterface.ENUM_RAW_DATA_FORMAT.TREE, {
  hasSelection: true
 }).children;

And when adding the "applyselection" method on my bars:

 g.selectAll(".bar")
.data(data)
.enter()
.append("rect")
.attr("class", "bar")
.attr("x", function(d) {
    return x(d.name);
})
.attr("y", function(d) {
    return y(d.value);
})
.attr("height", function(d) {
    return height - y(d.value);
})
.attr("width", x.rangeBand())
.style("fill", function(d) {

})
.on("click", function(d) {
    me.applySelection(d.selection);
});

But it does not work. I manage to console d.selection on the bar click event, i it's undifined.

Can some one please give me a hand on this?

Thank you.

like image 204
Bruno Ferreira Avatar asked Mar 15 '17 09:03

Bruno Ferreira


People also ask

How do I add visualization in MicroStrategy?

MicroStrategy Desktop on Windows and MacOpen a dossier. Click the + button under Custom in the Gallery of visualizations on the right and choose Import Visualization. On the Import Visualization dialog, navigate to the plug-in . zip file for the custom visualization you want to import and click Open.

What is visualization as a filter in MicroStrategy?

You can select attribute elements or metric values to filter data that appears in a visualization by creating a visualization filter. Create a visualization filter by dragging attributes and metrics from the Datasets panel. Open the dossier you want to modify.

Is MicroStrategy a visualization tool?

The MicroStrategy Visualization SDK provides APIs, sample code, documentation, and the Custom Visualization Tool. This tool is designed to help users quickly and easily create the file and folder structure of a visualization plug-in that is integrated with MicroStrategy.

What is Selector MicroStrategy?

Selectors provide dossier-style documents with interactivity, allowing each user to change how they see the data. A selector can change panels, the focus of a grid or graph report, or dynamic text fields (a text field that is a reference to an object on a report) in a panel stack, as described below.


1 Answers

I was able to find out what was wrong with my code, after spending many many hours on this. The selection method must be called like this:

.on("click", function(d, i) {
    me.applySelection(data[i].attributeSelector);
    return true;
});
like image 95
Bruno Ferreira Avatar answered Sep 23 '22 03:09

Bruno Ferreira