実行イメージ

ソースコード(JavaScript)

<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<script>
    function plot() {
        var riritsu = 0.05;
        var yokin = [100000];
        for (var i = 0; i < 10; i++) {
            var risoku = (yokin[i] * riritsu);
            yokin.push(yokin[i] + risoku);
        }
        var trace1 = {
            y: yokin,
            mode: 'lines+markers',
            type: 'scatter'
        };
        var layout = {
            title:"FUKURI KEISAN",
            xaxis: {title:"Year"},
            yaxis: {title:"Yokin[YEN]"}
        }
        var data = [trace1];
        Plotly.newPlot('myDiv', data, layout);
    }
</script>

ソースコード(HTML)

<body onload="plot()">
     <div id="myDiv"></div>
</body>

Monacaプロジェクト

預金の複利計算とグラフ