# sample element

Type: | Graphs
Attributes: | x • y
See: | datacurve

The sample tag is used inside a datacurve tag to add an individual point to the curve.
The sample tag has two attributes, x and y, both of which are mandatory. Generally these are numbers, but the x attribute may also be specified as an ISO-8601 or RFC-822 date to plot date values (don't forget to set the xaxis-formatter attribute of the graph to a Date formatter when doing this). See the x attribute page for more information on formats.
Using both a sample with a date and a sample with a number as the x value will generally give incorrect results.

This graph shows two curves, one DATACURVE and one SIMPLECURVE

    <linegraph width="300" height="300">
      <datacurve name="Actual Measurements" color="red" marker="circle only">
        <sample x="10" y="24.5"/>
        <sample x="11" y="32"/>
        <sample x="12" y="20.7"/>
      </datacurve>
      <simplecurve name="Projected Measurements" method="mypackage.GuessValues" color="blue"/>
    </linegraph>

This linegraph plots date values.

    <linegraph width="300" height="300" xaxis-formatter="date()">
      <datacurve name="Plotting dates" marker="circle">
        <sample x="2001-10-01" y="1"/>
        <sample x="2001-10-15" y="2"/>
        <sample x="2001-10-22" y="3"/>
      </datacurve>
    </linegraph>

This linegraph plots dates and times.

    <linegraph width="300" height="300" xaxis-formatter="date()">
      <datacurve name="Plotting times" marker="circle">
        <sample x="2001-10-01 12:00" y="1"/>
        <sample x="2001-10-01 13:00" y="2"/>
        <sample x="2001-10-01 14:00" y="3"/>
      </datacurve>
    </linegraph>