The Measurement Studio .NET WaveformPlot does not currently have an equivalent for CWPlot's FillToBase property. In the meantime, though, you can use the WaveformPlot's custom drawing services to emulate this functionality. For example, if you dropped a new WaveformGraph on a form, you could copy and paste the following code to draw bar graphs on the WaveformPlot:
Private Sub OnBeforeDrawPlot(ByVal sender As Object, ByVal e As BeforeDrawXYPlotEventArgs) Handles WaveformPlot1.BeforeDraw
DrawBarGraph(e, 0, Color.BurlyWood, Color.Firebrick)
End Sub
Shared Sub DrawBarGraph(ByVal e As BeforeDrawXYPlotEventArgs, ByVal baseYValue As Double, ByVal outlineColor As Color, ByVal fillColor As Color)
Dim plot As XYPlot = e.Plot
Dim g As Graphics = e.Graphics
If plot.HistoryCount > 0 Then
' Clip the data to just what will be drawn with the current axis ranges.
Dim xData() As Double, yData() As Double
plot.ClipData(xData, yData)
' Calculate the screen coordinates of a base y value and the clipped data.
Dim baseY As Double = CType(plot.MapPoint(e.Bounds, 0, baseYValue).Y, Double)
Dim points As PointF() = plot.MapData(e.Bounds, xData, yData, False)
Dim outlinePen As Pen = Nothing
Dim fillBrush As Brush = Nothing
Try
outlinePen = New Pen(outlineColor)
fillBrush = New SolidBrush(fillColor)
' Iterate through the mapped points and calculate the bar, fill it, and outline it
For i As Integer = 0 To points.Length - 2
Dim currentPoint As PointF = points(i)
Dim nextPoint As PointF = points(i + 1)
Dim barX As Single = currentPoint.X
Dim barY As Single = currentPoint.Y
Dim barWidth As Single = nextPoint.X - currentPoint.X
Dim barHeight As Single = baseY - currentPoint.Y
g.FillRectangle(fillBrush, barX, barY, barWidth, barHeight)
g.DrawRectangle(outlinePen, barX, barY, barWidth, barHeight)
Next
Finally
If Not outlinePen Is Nothing Then
outlinePen.Dispose()
outlinePen = Nothing
End If
If Not fillBrush Is Nothing Then
fillBrush.Dispose()
fillBrush = Nothing
End If
End Try
' Cancel any further drawing since we completely handled the drawing of the plot.
e.Cancel = True
End If
End Sub
Hope this helps.
- Elton