Comments (5)
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.
Released.
from plotly.blazor.
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.
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.
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)
- Add a function to get the selected points in Blazor HOT 1
- Stacked Bar Chart - chart.React() - Cannot access a disposed object.\r\nObject name: 'DotNetObjectReference HOT 2
- Cannot hide axis ticks HOT 2
- Error in Plotly.Blazor.PlotlyChart.OnAfterRenderAsync(Boolean firstRender) when trying to display plot HOT 1
- Add Plotly: Cytoscape HOT 1
- Async Function chart.React() is awaitable but blocks UI HOT 5
- Add "plotly-basic.min.js" to the project. HOT 5
- Add BubbleChart HOT 1
- What causes "Error: Microsoft.JSInterop.JSException: Could not find 'plotlyInterop.newPlot' ('plotlyInterop' was undefined)."? HOT 5
- Examples not working HOT 1
- Chart not rendering when data is set inside OnParametersSet HOT 1
- X-axis DateTime rounded to nearest second HOT 2
- Add offset by X, not only by Y
- RelayoutEventData error with Date Xaxis HOT 3
- Correct Implementation of X-Axis RangeSlider
- How to change X axis tick format?
- Click event doesn't work for heatmaps.
- Issue updating to 4.2.0 HOT 3
- Component Render Error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plotly.blazor.