CORRECT CHART:
COLUMN CHART LOGIC:
google.charts.load('current', { 'packages': ['corechart'] });
google.charts.setOnLoadCallback(drawChart, true);
function drawChart() {
// Create our data table out of JSON data loaded from server.
var data = new google.visualization.DataTable(dataTable);
var view = new google.visualization.DataView(data);
view.setColumns([0, 1, {
calc: 'stringify',
sourceColumn: 1,
type: 'string',
role: 'annotation',
}]);
var options = {
height: 275,
width: 375,
bar: {groupWidth:'35%'},
vAxis: {
gridlines: {
color: 'transparent'
},
textPosition: 'none',
textStyle: {
bold: false,
fontSize: '0',
paddingRight: '100',
marginTop: '100'
},
textPosition: 'none',
viewWindow: {
//min: data.getColumnRange(1).min + (data.getColumnRange(1).min / 5),
max: data.getColumnRange(1).max + (data.getColumnRange(1).max / 5),
}
},
hAxis: {
slantedText: true,
slantedTextAngle: 90,
textStyle: {
fontName: 'Whitney HTF Light',
},
},
legend: {
position: 'none',
textStyle: {
bold: false,
color: 'black',
fontName: 'Whitney HTF Light',
}
},
tooltip: {
trigger: 'none'
},
annotations: {
alwaysOutside: true,
textStyle: {
fontName: 'Whitney HTF Light',
fontSize: 10,
color: 'black',
},
stem: {
length: 5,
color: 'transparent',
},
},
chartArea: {
height: '45%',
width: '75%',
left: 20,
top: 10,
},
legend: {
position: 'bottom',
textStyle: {
fontName: 'Whitney HTF Light',
fontSize: 10,
color: 'black',
},
},
colors: ["#D30D2B", "#7C232E"]
};
var chart_div = document.getElementById(id);
var chart = new google.visualization.ColumnChart(chart_div);
chart.draw(view, options);
}
}