Giter Site home page Giter Site logo

Comments (5)

sean-mcl avatar sean-mcl commented on June 6, 2024 1

Should be similar to the hover event.
See
Plotly.Blazor.Examples/Components/Hover.razor

You create a reference to the chart using @ref and then call the subscribe method. You can use the AfterRender-Method, provided by the chart component, to subscribe after the chart has been rendered.

I think the return type of the values (X and Y) is JsonElement, so you have to parse it too.

In my opinion, the event mechanism and return values should be overhauled and extended to all/more event arguments.

from plotly.blazor.

sean-mcl avatar sean-mcl commented on June 6, 2024 1

Released.

from plotly.blazor.

acrow59 avatar acrow59 commented on June 6, 2024

Ahh, thank you! I was just missing the subscribe event. Seems to work fine for the Scatter graph, but for the Pie chart it returns null for both X and Y values. I also tried implementing the Hover event for Pie Chart to see if I could get the selected piece that way, but it's also just returning null for both X and Y values. Do you know of a way to retrieve which specific slice of the pie chart has been clicked?

from plotly.blazor.

acrow59 avatar acrow59 commented on June 6, 2024

It looks like the issue is with how the plotly-interop.js is setup. It's currently designed to only return data with an X and Y value, so for charts like Pie that instead use Value and Label, it will always return null. I've created a PR to address this. With it, both Click and Hover events will return the Value/Label instead if X/Y data is not present.

PR: #270

from plotly.blazor.

sean-mcl avatar sean-mcl commented on June 6, 2024

Thanks for your contribution!
Will create a new release in the next hour, have to update several dependencies first.

from plotly.blazor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.