'Draws the selected Curves, internal routine
Private Sub DrawCurvesInternal
Private c, nc, s, col, w As Int
Private x0, y0, x1, y1 As Int
Private pthCurves As B4XPath
If lstCurvesToDisplay.Size = 0 Then
Return
End If
pthCurves.Initialize(Graph.Left, Graph.Top)
pthCurves.LineTo(Graph.Right, Graph.Top)
pthCurves.LineTo(Graph.Right, Graph.Bottom)
pthCurves.LineTo(Graph.Left, Graph.Bottom)
pthCurves.LineTo(Graph.Left, Graph.Top)
xcvsGraph.ClipPath(pthCurves)
If mGraphWithMissingData = False Then
For nc = 0 To lstCurvesToDisplay.Size - 1
c = lstCurvesToDisplay.Get(nc)
If mUseCustomColors = False Then
col = CurveColor(nc)
w = CurveWidth(nc)
Else
col = CurveCustomColor(c)
w = CurveCustomWidth(c)
End If
x0 = Graph.Left
y0 = Graph.Bottom - (CurveY(c, ScaleX.IBegin) - ScalesY(c).MinVal) * ScalesY(c).Scale
For s = ScaleX.IBegin + 1 To ScaleX.IEnd
x1 = Graph.Left + (CurveX(s) - CurveX(ScaleX.IBegin)) * ScaleX.Scale
y1 = Graph.Bottom - (CurveY(c, s) - ScalesY(c).MinVal) * ScalesY(c).Scale
xcvsGraph.DrawLine(x0, y0, x1, y1, col, w)
x0 = x1
y0 = y1
Next
Next
Else
For nc = 0 To lstCurvesToDisplay.Size - 1
c = lstCurvesToDisplay.Get(nc)
If mUseCustomColors = False Then
col = CurveColor(nc)
w = CurveWidth(nc)
Else
col = CurveCustomColor(c)
w = CurveCustomWidth(c)
End If
x0 = Graph.Left
y0 = Graph.Bottom - (CurveY(c, ScaleX.IBegin) - ScalesY(c).MinVal) * ScalesY(c).Scale
For s = ScaleX.IBegin + 1 To ScaleX.IEnd
x1 = Graph.Left + (CurveX(s) - CurveX(ScaleX.IBegin)) * ScaleX.Scale
y1 = Graph.Bottom - (CurveY(c, s) - ScalesY(c).MinVal) * ScalesY(c).Scale
If CurveY(c, s - 1) < mMissingDataValue And CurveY(c, s) < mMissingDataValue Then
xcvsGraph.DrawLine(x0, y0, x1, y1,col, w)
End If
x0 = x1
y0 = y1
Next
Next
End If
xcvsGraph.Invalidate
xcvsGraph.RemoveClip
End Sub