anychart.onDocumentReady(function() {
var data = anychart.data.set([
["John", 10000, 12000, 20000, 16000],
["Jake", 12000, 15000, 19000, 21000],
["Peter", 16000, 17000, 21000, 22000]
var Quarter1 = data.mapAs({x: [0], value: [1]});
var Quarter2 = data.mapAs({x: [0], value: [2]});
var Quarter3 = data.mapAs({x: [0], value: [3]});
var Quarter4 = data.mapAs({x: [0], value: [4]});
var chart = anychart.column();
var tooltip = chart.legend().tooltip();
tooltip.format(function(){
return this.meta.legendTooltipText;
var legend = chart.legend();
legend.position("right");
legend.itemsLayout("vertical");
legend.titleSeparator(true);
var title = legend.title();
title.text("Total sales<br><i style=\"color: #999; font-weight: 400; font-size: 11px;\">(Year 2004)</i>");
chart.title("Legend Title Configuration");
var series1 = chart.column(Quarter1);
series1.name("Quarter 1");
legendTooltipText:"<b>Year:</b> 2004"+
"<br><b>Quarter:</b> first"+
"<br><b>Total sales: </b>"+(Quarter1.get(0,"value") + Quarter1.get(1,"value") + Quarter1.get(2,"value"))+
"<br><b>Best result</b>: "+
var series2 = chart.column(Quarter2);
series2.name("Quarter 2");
legendTooltipText:"<b>Year:</b> 2004"+
"<br><b>Quarter:</b> second"+
"<br><b>Total sales: </b>"+(Quarter2.get(0,"value")+Quarter2.get(1,"value")+Quarter2.get(2,"value"))+
"<br><b>Best result</b>: "+Quarter2.get(Quarter2.find("value",Math.max(Quarter2.get(0,"value"),Quarter2.get(1,"value"),Quarter2.get(2,"value"))),"x")
var series3 = chart.column(Quarter3);
series3.name("Quarter 3");
legendTooltipText: "<b>Year:</b> 2004"+
"<br><b>Quarter:</b> third"+
"<br><b>Total sales: </b>"+(Quarter3.get(0,"value")+Quarter3.get(1,"value")+Quarter3.get(2,"value"))+
"<br><b>Best result</b>: "+Quarter3.get(Quarter3.find("value",Math.max(Quarter3.get(0,"value"),Quarter3.get(1,"value"),Quarter3.get(2,"value"))),"x")
var series4 = chart.column(Quarter4);
series4.name("Quarter 4");
legendTooltipText:"<b>Year:</b> 2004"+
"<br><b>Quarter:</b> fourth"+
"<br><b>Total sales: </b>"+(Quarter4.get(0,"value")+Quarter4.get(1,"value")+Quarter4.get(2,"value"))+
"<br><b>Best result</b>: "+Quarter4.get(Quarter4.find("value",Math.max(Quarter4.get(0,"value"),Quarter4.get(1,"value"),Quarter4.get(2,"value"))),"x")
var xAxis = chart.xAxis();
var yAxis = chart.yAxis();
chart.container("container");