Indexing Data

Data plotted in a series can be accessed by indexing each point in the series. This data can be accessed using: 

plotName.Series[#].Points[#].X

For example:

<xyPlot name="aPlot">
  <series name="thisSeries" manual="true" draw="points" />
  <series name="otherSeries" manual="true" draw="points" capacity="1" />
</xyPlot>

<script>
  local x, y;
  local plotPointer = aPlot.thisSeries;

  for x = -1, 1, 0.1 do
  y = math.pow(x,2)
  plotPointer:Add(x,y)
  end
  plotPointer:Update()
</script>

<label name="labelName" />

<slider min="1" max="21" value="1">
  <onValueChanged>
    xVal = aPlot.Series[1].Points[value].X
    yVal = aPlot.Series[1].Points[value].Y
    labelName.Text = string.format("(%.2f, %.2f)", xVal, yVal)
    aPlot.otherSeries:Add(xVal, yVal)
    aPlot.otherSeries:Update()
  </onValueChanged>
</slider>