ZingChart: Adding Click Event Listeners for Scale Labels


To click on scale labels you will use our label_click  API event 

zingchart.bind('myChart', 'label_click', function(e) {
    console.log('label_click', e);
});

You also have to add the attribute flat:false  because by default labels are not clickable to save memory and quicken the rendering process. This is because sometimes there are many thousands of labels on the chart. So by adding flat:false  you are adding event listeners to the labels.

scaleX: {
      // set scale label
      label: {
        text: 'Days'
      },
      item: {
        flat: false
      },
      // convert text on scale indices
      labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
    },

Relative Documentation:

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us