Open DaveSimmons1234 opened 5 years ago
This isn’t implemented yet, but in principle shouldn’t be too hard if you want to take a stab at it! :)
On Sat, Nov 10, 2018 at 04:03 DaveSimmons1234 notifications@github.com wrote:
Hi there,
Can I click on a plot.ly bar graph and have it return an array of records e.g. like:
pivotData.forEachMatchingRecord(filters, function(record){ int_ids.push(record.int_id); });
Within a clickCallback like method?
This would be super useful.
Thanks a lot for your help. D.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nicolaskruchten/pivottable/issues/1048, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMbA6zlijDOAnXEVacZlTVVpJOrdi_rks5utpZWgaJpZM4YX5o4 .
:-) I have tried but a wee pointer in the right direction to get me started would be most appreciated.
D.
Hello,
Thanks for pivoting.js, it's really a great tool. I'm also interested in a clickCallBack on graphs. Could you guide me to the solution?
Thank you in advance.
Hi, I managed to get a working solution in the end using the following:
Hi Dave,
Thank you for your answer. I'm now able to catch the event when the graph is clicked. But, I didn't find a robust solution to find the associated data of the pivot table. Do you have a solution? Regards.
Hi there.
So you should have something like
result[0].on('plotly_click', function(data){
})
You can then access the data object
result[0].on('plotly_click', function(data){
var selRow = data.points[0].y;
var selCol = data.points[0].data.name;
})
Hi Dave,
Thank you for your answer. With this code: `myPlot[0].on('plotly_click', function(click_data){ console.log(click_data);
let filters = {};
let rows = document.ptablehandler.rows;
let rowsValues = click_data.points[0].data.name.split('-');
for(let i=0; i<rows.length; ++i) {
filters[rows[i]]=rowsValues[i];
}
let cols = document.ptablehandler.cols;
var colsValues = click_data.points[0].x.split('-');
for(let i=0; i<cols.length; ++i) {
filters[cols[i]]=colsValues[i];
}
debugger
drilldown(click_data.event, click_data.points[0].y, filters, data);
});`
I'm able to build a filter usable in the same function used by clickCallBack. But:
Thank you in advance.
Doesn't anyone have an answer? Is it possible to change the values separator "-" by an other character (for example: "|")?
Hi there,
Can I click on a plot.ly bar graph and have it return an array of records e.g. like:
pivotData.forEachMatchingRecord(filters, function(record){ int_ids.push(record.int_id); });
Within a clickCallback like method?
This would be super useful.
Thanks a lot for your help. D.