Calendar Chart - Key - Round to two decimal places

9 views
Skip to first unread message

Matt Gelfman

unread,
Apr 3, 2018, 4:35:39 PM4/3/18
to Google Visualization API


I am attempting to round the key value to two decimal places. No matter what I do, I cannot get it to round. Everything else about the chart works perfectly but because the input values are rounded to two decimal places, the key seems to round to many place values. Is there any way to solve this issue? 

I've included this image with key showing the long decimal.


Here is the javascript code:


function drawChart5() {
var dataTable = new google.visualization.DataTable();
dataTable.addColumn({ type: 'date', id: 'Date' });
dataTable.addColumn({ type: 'number', id: 'Hours Trained' });
dataTable.addRows([
[ new Date(2018, 2, 12), 3.75],[ new Date(2018, 2, 13), 2.58],[ new Date(2018, 2, 14), 1.25],[ new Date(2018, 2, 19), 3.33],[ new Date(2018, 2, 20), 2.00],[ new Date(2018, 2, 21), 1.50],[ new Date(2018, 2, 22), 1.25],[ new Date(2018, 2, 23), 2.00],[ new Date(2018, 2, 26), 2.92],[ new Date(2018, 2, 27), 1.92],[ new Date(2018, 2, 28), 1.08],[ new Date(2018, 2, 29), 1.00],[ new Date(2018, 2, 30), 1.50], ]);

var chart = new google.visualization.Calendar(document.getElementById('calendar_basic'));
var options = {
title: "Calendar: Hours Trained Per Day",
height: 350,
backgroundColor: { fill:'transparent' }
};
chart.draw(dataTable, options);

Reply all
Reply to author
Forward
0 new messages