# A Scatter chart getting the X/Y value

X:
Y:

The Line chart has no concept of an X-axis scale. The values that you supply are simply spaced equally across the chart. The Scatter chart on the other hand does have an X-axis scale, so you can have an uneven distribution of elements across the chart if you so wished.

Because the X-axis is scaled this means that you can get the relevant X value from a `click` or `mousemove` event. You can also get the relevant Y value so you then have an (X,Y) coordinate pair. The code to achieve this is as follows. It uses the RGraph replacement for the `mousemove` event but this is not a requirement:

This goes in the documents header:

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

Put this where you want the chart to show up:

    <div style="float: right; width: 600px">
        <canvas id="cvs" width="600" height="250">[No canvas support]</canvas>
        <div style="position: relative; left: 25px; width: 550px">
            X: <input type="text" id="x" /><br />
            Y: <input type="text" id="y" />
        </div>
    </div>

This is the code that generates the chart - it should be placed AFTER the canvas tag(s):