# A Scatter chart which shows financial information

This Scatter chart shows sample fiancial data. It looks like it does because there is many data points.

This goes in the documents header:

    <script src="RGraph.common.core.js"></script>
    <script src="RGraph.scatter.js"></script>

Put this where you want the chart to show up:

    <canvas id="cvs" width="600" height="200">
        [No canvas support]
    </canvas>

This is the code that generates the chart:

    <script>
        // Generate the financial data
        var value = 5,
            data  = [];

        for (var i=0; i<365; i+=1) {
            data.push([i,value]);
            value += RGraph.random(-1, 1);
            value = Math.max(0, value)
            value = Math.min(10, value)
        }

        new RGraph.Scatter({
            id: 'cvs',
            data: data,
            options: {
                ymax: 10,
                xmin: 0,
                xmax: data.length,
                labels: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
                tickmarks: null,
                line: true,
                lineColors: ['red'],
                unitsPre: '$',
                gutterTop: 40,
                gutterLeft: 40,
                title: 'Sample financial data',
                backgroundGridColor: '#eee',
                backgroundGridAutofitNumvlines: 64,
                backgroundGridAutofitNumhlines: 20,
                noxaxis: true
            }
        }).draw();
    </script>