javascript - Making the horizontal axis labels clickable -


i have question regarding google charts (column charts) in specific.
"how make "date" clickable can open modal dialog (jquery) external page?"

example
have added example illustrate mean, done in photoshop.
able bring alert dialog when click of bars, that's not looking for.

i have tried search it, unable find something.
attached code used making bars clickable, maybe knows how modify without having google it.

var handler = function(e) {     var sel = chart.getselection();     sel = sel[0];     if (sel && sel['row'] && sel['column']) {       var message = "hi..";       alert(message);     } } google.visualization.events.addlistener(chart, 'select', handler); 

any assistance appreciated. - robert.

if use 'click' handler instead of 'select' handler, can more interact other parts of chart.

here's example: http://jsfiddle.net/6ljhv/6/

your event object, e, have targetid property.

this targetid not documented, if run debugger, can sense of ids like.

on various axis charts (line, column, etc.) targetid of axis labels this: haxis#0#label#1. break down, means clicked on second label of first horizontal axis (0 based index).

given that, can dissect targetid figure out label clicked on data if it's discrete.

(if data continuous, there isn't 1:1 relationship labels , rows of data)

var handler = function(e) {     var parts = e.targetid.split('#');     if (parts.indexof('label') >= 0) {         var idx = parts[parts.indexof('label') + 1];         alert(data.getvalue(0, parseint(idx)));     } }; google.visualization.events.addlistener(chart, 'click', handler); 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -