Adjusting charts: Line chart
Note
If you don't like the line being drawn outside of the chart area
(ie in the
margins where the title or the labels are) you can use the
outofboundsClip
option.
The Line chart can be adjusted by dragging the line(s) up and down. When you click on a line to adjust it (and hold the mouse button down) you can then retrieve the relevant details of that point from the registry:
RGraph.Registry.get('adjusting.shape');
<script>
line = new RGraph.Line({
id: 'cvs',
data: [
[45,74,84,85,45,35,65,68,87,97,45,34,12],
[15,14,12,16,18,19,14,12,74,84,95,65,35]
],
options: {
xaxisLabels: ['Kev','Matt','Rich','Dave','Iggy','Polly','Fiona','Fred','Pete','Lou','Fred','Bob'],
linewidth: 2,
marginInner: 10,
shadow: false,
adjustable: true,
title: 'An adjustable line chart',
outofbounds: true,
spline: true,
tickmarksStyle: 'circle',
tickmarksSize: 5
}
}).draw();
</script>
The RGraph adjusting events
There are three RGraph events associated with adjusting. The
adjustbegin
event fires when adjusting begins,
much like the
mousedown
event. The adjust
event fires during adjusting,
much like the mousemove
event. The adjustend
event fires when adjusting is finished, much like the mouseup
event.