question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

chartEvents not working/fired for Sankey Diagram

See original GitHub issue

Based on Listening to chart events example, I was trying to implement the same for Sankey Diagram. But the callback event is never fired. I wonder if there is any other way for callback on select of a particular node in Sankey diagram? Below is the code that I am using:

import React, { Component } from 'react'
import Chart from 'react-google-charts'

const data = [
  ["From", "To", "Weight"],
  ["A", "X", 5],
  ["A", "Y", 7],
  ["A", "Z", 6],
  ["B", "X", 2],
  ["B", "Y", 9],
  ["B", "Z", 4]
];

const options = {};

const chartEvents = [
  {
    eventName: "select",
    callback(chartWrapper) {
      console.log("Selected ", chartWrapper.getChart().getSelection());
    }
  }
];
class SankeyChart extends Component {
  render() {
    return(
      <div style={{padding: 10}}>
        <Chart
          chartType="Sankey"
          width="600px"
          height="200px"
          data={data}
          chartEvents={chartEvents}
        />
      </div>
    )
  }
}

export default SankeyChart

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
indigolaincommented, Sep 20, 2018

@PhaniKumarAdiraju Glad to hear that it worked partially. I’ve created a sandbox for you to check out. I think this will answer your questions! https://codesandbox.io/s/rw34j2ywy4

Cheers!

2reactions
indigolaincommented, Sep 19, 2018

@PhaniKumarAdiraju I created a pull request to fix the sample, which might be related to your situation. Would this fix your events not firing? https://github.com/rakannimer/react-google-charts/pull/250

Read more comments on GitHub >

github_iconTop Results From Across the Web

chartEvents not working in react-google-charts's sankey ...
I tried codesandbox with this issue and console.log() didn't appear when React.StrictMode is selected. It didn't happen with other graph ...
Read more >
Sankey chart shows 'no data found' error
While analyzing flow telemetry, adding filters and/or facets to the sankey diagram results in an error that no data could be found. Sankey...
Read more >
sankey diagram not working - Microsoft Power BI Community
I am trying to create a sankey diagram with very simple data. I get a blank box with a title. Suggestions for getting...
Read more >
4 use-cases for Sankey Charts - Towards Data Science
So here I would like to state the use-cases where Sankey charts makes sense. Analysing flow. When Sankey diagram originated in 1898, its...
Read more >
Sankey Diagram | Charts - Google Developers
Note: Avoid cycles in your data: if A links to itself, or links to B which links to C which links to A,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found