# Examples of the drawing API Y axis

This goes in the documents header:

    <script src="RGraph.common.core.js"></script>
    <script src="RGraph.common.dynamic.js"></script>
    <script src="RGraph.drawing.yaxis.js"></script>

Put this where you want the chart to show up:

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

This is the code that generates the chart:

    <script>
        new RGraph.Drawing.YAxis({
            id: 'cvs',
            x: 50,
            options: {
                max: 100,

                textAccessible: true,
                textAccessiblePointerevents: false
            }
        }).on('click', function (e, obj)
        {
            alert('The Y axis has been clicked!');
        }).on('mousemove', function (e, obj)
        {
            return true;
        }).draw();

        new RGraph.Drawing.YAxis({
            id: 'cvs',
            x: 100,
            options: {
                max: 1000,
                colors: ['#74cfb9']
            }
        }).draw();

        new RGraph.Drawing.YAxis({
            id: 'cvs',
            x: 160,
            options: {
                max: 0.001,
                scaleDecimals: 4,
                colors: ['blue']
            }
        }).draw();

        new RGraph.Drawing.YAxis({
            id: 'cvs',
            x: 250,
            options: {
                max: 0.000001,
                scaleDecimals: 7,
                xaxispos: 'center',
                colors: ['green']
            }
        }).draw();

        new RGraph.Drawing.YAxis({
            id: 'cvs',
            x: 300,
            options: {
                max: 0.1,
                scaleDecimals: 2,
                scaleInvert: true,
                colors: ['red']
            }
        }).draw();
    </script>

« Back