Check documentation for the latest version of dhtmlxSuite Events DHTMLX Docs

Events

dhtmlxChart allows handling different kinds of events in your application. It can be mouse click or click on item. The field of actions is rather wide.

You can attach several handlers to the same event, and all of them will be executed.

Event names are case-insensitive.

Adding event

If you need to attach event to an application, use attachEvent() method.

BarChart.attachEvent("onItemClick", function(id){
    BarChart.remove(id);
    return true;
})

In the code snippet showed above, event handler allows you to delete from the Bar Chart the bar you click on by using the remove() method.

Deleting Event

You can also delete event if you need. The detachEvent() method helps you here.

var myEvent = BarChart.attachEvent("onItemClick", function(id){
      BarChart.remove(id);
      return true;
});
BarChart.detachEvent(myEvent);

The following events are available in chart:

  • Before Events:
  • After Events:
  • Item Events:
  • Mouse Events:
    • onMouseMove - occurs when mouse pointer is pointed over an item;
    • onMouseMoving - fired when mouse pointer is moved over a chart;
    • onMouseOut - called when the mouse pointer is moved out of item area;
  • XML Events
    • onXLE - invoked when XML parsing is over, data are already available;
    • onXLS - occurs when XML parsing starts;

Related sample:  Events

Back to top