function tooltipFormatter(ctx) {
var events = ctx.getData('events');
var tooltip = document.createElement('div');
var table = document.createElement('table');
var thead = table.createTHead();
thead.style.fontWeight = 'bold';
var tr = thead.insertRow();
var cell = tr.insertCell();
cell.textContent = 'Time';
cell.textContent = 'Event';
cell.textContent = 'Volatility Level';
var tbody = table.createTBody();
for (var i = 0; i < events.length; i++) {
var row = tbody.insertRow();
Object.values(events[i]).forEach(function(value) {
cell.textContent = value;
tooltip.appendChild(table);
return tooltip.innerHTML;
anychart.onDocumentReady(function() {
anychart.data.loadJsonFile(
'https://cdn.anychart.com/samples/calendar-chart/economic-calendar/data.json',
var dataset = anychart.data.set(data);
var mapping = dataset.mapAs({
value: 'averageVolatility'
var chart = anychart.calendar(mapping);
var customColorScale = anychart.scales.linearColor();
customColorScale.colors(['#f1ad37', '#db340a']);
chart.colorScale(customColorScale);
.format(tooltipFormatter);
chart.listen('chartDraw', function() {
document.getElementById('container').style.height = chart.getActualHeight() + 'px';
chart.container('container');