Tutorials

Events

VobcoCharts includes many events on which you can set your functions to be called and modify VobcoCharts behaviour, or lunch your custom code. To subscribe to event you can use following code:

chart.on('event_name', function() {
    //your code...
    console.log('event_name triggered!');
});

This is list of events and when they happen:

  • canvas_created - triggers after canvas HTML element is created inside container element
  • before_data_load - triggers just before data will be loaded, DataLoader object is passed to this event so here you can still change loading url, or modify dataloader
  • data_loaded - triggers after data is loaded, but before chart is created, ideal time to jump in and change maybe data, or to use charts data to display it in datagrid on your website. Here you can also change settings.
  • chart_initialized - triggers after chart is initialized, it's probably most used event because this is where you have chart completelly initialized and can call any function like setStartAndEndIndex, change any setting and etc.
  • ticker_changed - triggers after ticker is changed in toolbar, before this event data is already loaded
  • enter_full_screen - triggers after chart entered full screen mode
  • exit_full_screen - triggers after chart exits full screen mode
  • indicator_added - triggers after indicator has been added to chart
  • grid_added - triggers after grid has been added to chart (triggered before indicator_added when new indicator requires new grid)