Chart widgets can receive the chart's bar data by defining a ChartWidget_OnContextChange() handler. The parameter which is passed to this function contains a candles[] array, as well as an instrumentId and timeframe. The handler is called on initial load of your widget, followed by any addition to the list of candles or any re-load following a change of instrument or timeframe.
Changes to the current in-progress candle can be received using a ChartWidget_OnCandleChange() handler. The parameter passed to this function contains a single candle object.
For example:
Framework.ChartWidget_OnContextChange = function(data) {
// Store the list of candles in data.candles[]
}
Framework.ChartWidget_OnCandleChange = function(data) {
// Update the previous stored list from data.candle
}