Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide return value on selected point/points #68

Closed
happyshows opened this issue Aug 18, 2015 · 6 comments
Closed

Provide return value on selected point/points #68

happyshows opened this issue Aug 18, 2015 · 6 comments

Comments

@happyshows
Copy link

Hi,

I'm wondering if tauCharts.js could provide such api so that hrbrmstr/taucharts could be able to call and fetch the values to R shiny instead of hack.

With this return value it would add more value to interactive analysis on R Shiny (drill down capabilities)

Would you please consider as feature improvement, thanks.

@vladminsky
Copy link
Contributor

Hi @happyshows

Currently I'm reworking legend and tooltip plugins to event / data-based approach.

Usage pattern looks like:

chart.select((node) => node.config.type === "ELEMENT.POINT")
     .on("click", (dataRow) => ...)
     .on("mouseover", (dataRow) => ...)
     .on("mouseout", (dataRow) => ...)

It looks like for drill down capabilities we need to introduce some kind of brushing also.

Do you think it is good enough? Would like to know how you "see" the API.

I'm ready to discuss API. Don't hesitate to share your thoughts on the topic.

@timelyportfolio
Copy link

@vladminsky I think that would be great. Ref to the issue on the R side -> hrbrmstr/taucharts#1.

Here is the little bit of code that I suggested as a hack, but if fails with tau_legend since legend removes the elements. Your solution would solve problems such as these.

  d3.select(this.el).selectAll(\'[class^="graphical-report"] .i-role-datum\')[0].forEach(
    function(el){
      el.addEventListener( "click", function(e) {
        alert( "clicked " + JSON.stringify(d3.select(e.target).datum().data) );
      })
    })

@happyshows
Copy link
Author

@vladminsky I won't be the best person to comment on the best implementation details, as I'm more familiar with R than js. @hrbrmstr could provide more valuable input...

@vladminsky
Copy link
Contributor

@timelyportfolio & @happyshows

I got your point guys.

@vladminsky
Copy link
Contributor

Shortcut for subscription described above:

        var chart = new tauCharts.Chart(cfg);
        chart.renderTo('#target');
        chart.on('elementclick', function (chartRef, e) {
            console.log(e.data);    // data behind an element
            console.log(e.event);   // click event object
            console.log(e.element); // DSL node instance like ELEMENT.POINT

The elementclick, elementmouseover, elementmouseout events are supported now

@timelyportfolio
Copy link

great, look forward to putting it to use. Thanks so much @vladminsky for your responsiveness and diligence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants