How do I raise an event to return a result when a line chart item is clicked?
For example, a line point (row, col (x,y) - or preferably index) and have it return the value(s) to my sub...
I would then take this position and plot it on a google map (ie change the map marker color).
The above produces a nice alert with all the data needed... but how to save as B4J var that I can access?
Thanks
For example, a line point (row, col (x,y) - or preferably index) and have it return the value(s) to my sub...
I would then take this position and plot it on a google map (ie change the map marker color).
B4X:
google.visualization.events.addListener(chart, 'select', selectHandler);
function selectHandler() {
var selection = chart.getSelection();
var message = '';
for (var i = 0; i < selection.length; i++) {
var item = selection[i];
if (item.row != null && item.column != null) {
var str = data.getFormattedValue(item.row, item.column);
message += '{row:' + item.row + ',column:' + item.column + '} = ' + str + '\n';
} else if (item.row != null) {
var str = data.getFormattedValue(item.row, 0);
message += '{row:' + item.row + ', column:none}; value (col 0) = ' + str + '\n';
} else if (item.column != null) {
var str = data.getFormattedValue(0, item.column);
message += '{row:none, column:' + item.column + '}; value (row 0) = ' + str + '\n';
}
}
if (message == '') {
message = 'nothing';
}
alert('You selected ' + message);
// ${selected} = message;
};
The above produces a nice alert with all the data needed... but how to save as B4J var that I can access?
Thanks
Last edited: