ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Threshold alert code for vb.net.
Posted by Luiz on Aug-20-2022 06:34
Attachments:
Hi Peter!

Could you please show me the frmzoomscrolltrack threshold alert code for vb.net like that attached VBA sample picture?

Thanks in advance.

Luiz
Captura.JPG

  Re: Threshold alert code for vb.net.
Posted by Peter Kwan on Aug-23-2022 03:49
Hi Luiz,

ChartDirector for ASP/COM/VB includes and example for VB6 as follows:

https://www.advsofteng.com/doc/cdcom.htm#realtimedemo.htm

For VB.NET, you can simply translate the VB6 code to VB.NET syntax:

' Add a red mark line to the chart, with the mark label shown at the left of
' the mark line.
Dim m As Mark
m = c.yAxis().addMark(thresholdValue, &HFF0000, "Alarm = " & thresholdValue)
m.setAlignment(Chart.Left)
m.setBackground(&HFFCCCC)

If dataSeries3(UBound(dataSeries3)) > thresholdValue Or _
   dataSeries2(UBound(dataSeries2)) > thresholdValue Then
    ' Add an alarm message as a custom text box on top-right corner of the
    ' plot area if the latest data value exceeds threshold.
   c.addText(575, 62, "Alarm - Latest Value Exceeded Threshold", _
                "Arial Bold", 10, &HFFFFFF, Chart.TopRight).setBackground(&HDD0000)
End If

' Fill the region above the threshold as semi-transparent red (80ff8888)
c.addInterLineLayer(layer.getLine(1), m.getLine(), &H80FF8888, Chart.Transparent)
c.addInterLineLayer(layer.getLine(2), m.getLine(), &H80FF8888, Chart.Transparent)

Regards
Peter Kwan