google / google-visualization-issues

288 stars 35 forks source link

Google Sankey color error #2976

Open Agustinsn opened 1 year ago

Agustinsn commented 1 year ago

Hello, im getting: jsapi_compiled_ui_module.js:226 Error: attribute x1: Expected length, "undefined". This make all node colors are black, even the basic example show node and links black. It was working fine until an update made by a worker to the page and I couldn't find the error, any ideas?

dlaliberte commented 1 year ago

That kind of error message means there is some internal error that, at the very least, is caused by something unexpected. It might be that your data or options are causing some conflict, but if so, the library should detect that situation and report a more readable error message. But we can't tell what that conflict might be, how to fix it, or how to workaround it, without seeing an example that reproduces the problem.

Could you build a minimal example on jsfiddle, or a similar site?

Agustinsn commented 1 year ago

That kind of error message means there is some internal error that, at the very least, is caused by something unexpected. It might be that your data or options are causing some conflict, but if so, the library should detect that situation and report a more readable error message. But we can't tell what that conflict might be, how to fix it, or how to workaround it, without seeing an example that reproduces the problem.

Could you build a minimal example on jsfiddle, or a similar site?

Im getting that error even with basic example from official page. This is how is show https://ibb.co/2W4FcHM and this is the console error https://ibb.co/BgvYXDP

`function drawChart() { var data = new google.visualization.DataTable(); data.addColumn('string', 'From'); data.addColumn('string', 'To'); data.addColumn('number', 'Weight'); data.addRows([ [ 'A', 'X', 5 ], [ 'A', 'Y', 7 ], [ 'A', 'Z', 6 ], [ 'B', 'X', 2 ], [ 'B', 'Y', 9 ], [ 'B', 'Z', 4 ] ]);

// Sets chart options.
var options = {
  width: 600,
};

// Instantiates and draws our chart, passing in some options.
var chart = new google.visualization.Sankey(document.getElementById('sankey_basic'));
chart.draw(data, options);

}`

Agustinsn commented 1 year ago

The error was an Object.prototype. I dont really know how that affect the graphic

dlaliberte commented 1 year ago

Ah, since the example works on the Google Charts documentation pages, that means the cause of your problem is likely an incompatibility with other code that is loaded into your document. If you can simplify your document to remove or disable all other code, then you can narrow down to find the specific conflict and then we may be able to find a fix or workaround.