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, default_content, row) { return default_content.replace("sin(x)", "1.5 + 1.5 sin(" + row.x + ")"); }, xLabelMargin: 10, integerYLabels: true });