var decimal_data = []; for (var x = 0; x <= 360; x += 10) { decimal_data.push({ x: x, y: 1.5 + 1.5 * Math.sin(Math.PI * x / 180).toFixed(4) }); } window.m = Morris.Line({ element: 'graph', data: decimal_data, xkey: 'x', ykeys: ['y'], labels: ['sin(x)'], parseTime: false, hoverCallback: function (index, options) { var row = options.data[index]; return "1.5 + 1.5 sin(" + row.x + ") = " + row.y; }, xLabelMargin: 10 });