Open etnbrd opened 8 years ago
In the following mwe, pie.entityNearest returns undefined, where it should returns one of the pie slices. (Or I am missing something)
<!DOCTYPE html> <html> <head> <title></title> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.16/d3.js"></script> <script type="text/javascript" src="../node_modules/plottable/plottable.js"></script> <link rel="stylesheet" type="text/css" href="../node_modules/plottable/plottable.css"> </head> <body> <svg id='pie'></svg> <script type="text/javascript"> var scale = new Plottable.Scales.Linear(); var colorScale = new Plottable.Scales.InterpolatedColor(); colorScale.range(["#414B5E", "#0AFC9E"]); var dataset = new Plottable.Dataset([{ perc: 3 },{ perc: 4 },{ perc: 5 }]); var pie = new Plottable.Plots.Pie() .addDataset(dataset) .sectorValue(function(d) { return d.perc; }, scale) .attr("fill", function(d) { return d.perc; }, colorScale) var interaction = new Plottable.Interactions.Pointer(); interaction.onPointerMove(function (point) { var nearestEntity = pie.entityNearest(point); console.log(nearestEntity, point); // <============ undefined }) interaction.attachTo(pie); pie.renderTo("svg#pie"); </script> </body> </html>
pie.entitiesAt can be used instead of pie.entityNearest.
pie.entitiesAt
pie.entityNearest
In the following mwe, pie.entityNearest returns undefined, where it should returns one of the pie slices. (Or I am missing something)