Vis.js graph3d onclick event

Hi, has anyone used the vis.js graph3d library? If so do you know how to capture the z value when clicking a bar? Tried the code below in the graph options but doesn't work? Thanks

tooltip: function onclick(point) {
          alert(point.z);
        }

Open in new window

j789Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

bugadaCommented:
In drawVisualization() function you can specify the tooltip option and do what you want inside.

Example

function drawVisualization() {
   var options = {

        // Option tooltip can be true, false, or a function returning a string with HTML contents
        tooltip: function (point) {
             // parameter point contains properties x, y, z, and data
             // data is the original object passed to the point constructor
            alert(point.z);
            return 'value: <b>' + point.z + '</b><br>';
        }
}

Open in new window

0
j789Author Commented:
Thanks for the response Bugada.

Do you know how to make the alert(point.z) trigger when the bar is clicked instead of it being triggered onmouseover?

Thanks
0
bugadaCommented:
oh yes sorry, the correct option is:

function drawVisualization() {
   var options = {

        onclick: function (point) {
            alert(point.z);
        }
}

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

j789Author Commented:
Thanks for your help Bugada.
0
j789Author Commented:
Do you know how to control the colour of the bars? For example I would like to show the bars for warehouse a in blue and the bars for warehouse b in red (where the warehouses are on the y axis). Then is possible use a different shade of blue and red to indicate the values. Do you know if this can be done? Thanks
0
bugadaCommented:
Try adding data to dataSet assigning different fieldId depending on the wharehouse. Then using those ids, you can customize the css to give the color you want to bars.

Just my 2 cents, cause I've never done it before.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.