You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am not getting click event on click of category label (xticks) of bar chart. I am using 'plotly_click'.
Below is the code
HTML -
<head>
<!-- Plotly.js -->
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
</head>
<body>
<div id="myDiv" style="width: 480px; height: 400px;"><!-- Plotly chart will be drawn inside this DIV --></div>
<script>
<!-- JAVASCRIPT CODE GOES HERE -->
</script>
</body>
Javascript -
var trace1 = {
x: ['giraffes', 'orangutans', 'monkeys'],
y: [20, 14, 23],
name: 'SF Zoo',
type: 'bar'
};
var trace2 = {
x: ['giraffes', 'orangutans', 'monkeys'],
y: [12, 18, 29],
name: 'LA Zoo',
type: 'bar'
};
var data = [trace1, trace2];
var layout = {barmode: 'group'};
Plotly.newPlot('myDiv', data, layout);
var myDiv = document.getElementById('myDiv');
myDiv.on('plotly_click', function(data){
alert('chart clicked');
});
I am able to get click event on actual bars but I am looking for click event on category label under bar.
In below image I am looking for click event on 'giraffes'. Thanks for the help in advance.
The text was updated successfully, but these errors were encountered:
I am not getting click event on click of category label (xticks) of bar chart. I am using 'plotly_click'.
Below is the code
HTML -
Javascript -
I am able to get click event on actual bars but I am looking for click event on category label under bar.

In below image I am looking for click event on 'giraffes'. Thanks for the help in advance.
The text was updated successfully, but these errors were encountered: