Skip to content

Real Data Chart Vb.net

New Discussion
Salvador Ramos
Salvador Ramos asked on Apr 1, 2016 12:28 AM

Dear Infragistics Team,

Can you helpme with a sample for real time data on vb.net? I wanna simulate a response spectrum with almost 10,000 points. This is my class and I wanna plot in real time, can you helpme?: I really appreciate the support.

Private Function centroide() As DataPointsCollection

Dim Data1 As DataPointsCollection = New DataPointsCollection()

Dim Propiedades As New Object_properties(DG1)
Dim Xcg_ As Double = Object_properties.Xcg
Dim Ycg_ As Double = Object_properties.Ycg

Dim point1 As DataPoint = New DataPoint()

point1.X = Xcg_
point1.Y = Ycg_
Data1.Add(point1)

Return Data1

End Function

Private Function scannedimage(Datagrid As DataGridView) As DataPointsCollection
Dim Data2 As DataPointsCollection = New DataPointsCollection()
Dim DataG_ As DataGridView = Datagrid
Dim DGi As Integer

For DGi = 0 To DataG_.Rows.Count – 1

Dim point2 As DataPoint = New DataPoint()
point2.X = DataG_.Item(1, DGi).Value
point2.Y = DataG_.Item(2, DGi).Value
Data2.Add(point2)

Next DGi

Return Data2

End Function

Dim Data As DataPointsCollection = scannedimage(Datagrid)
Dim Data2 As DataPointsCollection = centroide()
Dim XAxis As NumericXAxis = New NumericXAxis()
Dim YAxis As NumericYAxis = New NumericYAxis()
Dim Series As ScatterLineSeries = New ScatterLineSeries()
Dim Series2 As ScatterLineSeries = New ScatterLineSeries()
Dim Propiedades As New Object_properties(DG1)
Dim Xmin As Double = (Object_properties.Totalxmin) * 1.1
Dim Xmax As Double = (Object_properties.Totalxmax) * 1.1
Dim Ymin As Double = Object_properties.Totalymin
Dim Ymax As Double = (Object_properties.Totalymax) * 1.1
Dim Inx As Double
Dim Iny As Double

Inx = Xmax + Math.Abs(Xmin)
Iny = Ymax – Ymin

Series.DataSource = Data
Series.XMemberPath = “X”
Series.YMemberPath = “Y”
Series.XAxis = XAxis
Series.YAxis = YAxis
Series.Thickness = 2
Series.Brush = New SolidColorBrush(Color.Black)
Series.MarkerType = Infragistics.Win.DataVisualization.MarkerType.None

Series2.DataSource = Data2
Series2.XMemberPath = “X”
Series2.YMemberPath = “Y”
Series2.XAxis = XAxis
Series2.YAxis = YAxis
Series2.MarkerBrush = New SolidColorBrush(Color.Black)
Series2.MarkerOutline = New SolidColorBrush(Color.Black)
Series2.MarkerType = Infragistics.Win.DataVisualization.MarkerType.Tetragram

XAxis.CrossingValue = 0
XAxis.TickLength = 3
XAxis.TickStroke = New SolidColorBrush(Color.Black)
XAxis.TickStrokeThickness = 0.05
XAxis.Title = “meters(m)”
XAxis.TitleFontFamily = “Arial Narrow”
XAxis.TitleTextStyle = FontStyle.Bold
XAxis.TitleTextColor = New SolidColorBrush(Color.Black)
XAxis.TitleFontSize = 12
XAxis.LabelFontFamily = “Arial Narrow”
XAxis.LabelTextColor = New SolidColorBrush(Color.Black)
XAxis.LabelFontSize = 10
XAxis.MinimumValue = Xmin
XAxis.MaximumValue = Xmax
XAxis.Interval = Inx
XAxis.MajorStroke = New SolidColorBrush(Color.DarkGray)
XAxis.MajorStrokeThickness = 1
XAxis.LabelExtent = 30

YAxis.CrossingValue = 0
YAxis.TickLength = 3
YAxis.TickStroke = New SolidColorBrush(Color.Black)
YAxis.TickStrokeThickness = 0.01
YAxis.Title = “meters(m)”
YAxis.TitleTextStyle = FontStyle.Bold
YAxis.TitleFontFamily = “Arial Narrow”
YAxis.TitleTextColor = New SolidColorBrush(Color.Black)
YAxis.TitleFontSize = 12
YAxis.LabelFontFamily = “Arial Narrow”
YAxis.LabelTextColor = New SolidColorBrush(Color.Black)
YAxis.LabelFontSize = 10
YAxis.MinimumValue = Ymin
YAxis.MaximumValue = Ymax
YAxis.Interval = Iny
YAxis.MajorStroke = New SolidColorBrush(Color.DarkGray)
YAxis.MajorStrokeThickness = 1
YAxis.LabelExtent = 50

UDCObject.Title = “Digitized Picture”
UDCObject.TitleFontFamily = “Arial Narrow”
UDCObject.TitleFontSize = 18
UDCObject.TitleTextColor = New SolidColorBrush(Color.Black)
UDCObject.TitleTextStyle = FontStyle.Bold
UDCObject.BackColor = New SolidColorBrush(Color.White)
UDCObject.Axes.Add(XAxis)
UDCObject.Axes.Add(YAxis)
UDCObject.Series.Add(Series)
UDCObject.Series.Add(Series2)
UDCObject.HorizontalZoomable = True
UDCObject.VerticalZoomable = True
UDCObject.CrosshairVisibility = Visible

Best Regards,

Salvador

Sign In to post a reply

Replies

  • 0
    Milko Venkov
    Milko Venkov answered on Mar 16, 2016 12:43 PM

    Hello Salvador,

    Thank you for posting in our forum.

    I have checked the code snipped you have posted. Nevertheless I do not have access to the DataGridView you are sending as argument to scannedimage nor to Object_properties class, the code you have posted seams ok. This should draw a ScatterLine chart with the information you are providing via DataGridView. This chart will draw a line connecting all the points and will not draw the points themselves, as you set Series MarkerType to None.

    So please let me know if you face some issue what is it? Form your post I can see that you are trying to create a chart with almost 10000 points. This may lead to big delay of chart painting depending on the complexity of data points. If this is your issue one possible solution is to set the Resolution property of your series to some appropriate value. The bigger this property is the less point chart will draw. You may use code like this:

    Series.Resolution = 100

    If you are facing some other issue please let me know.

    Thank you for using Infragistics Controls.

    • 0
      Salvador Ramos
      Salvador Ramos answered on Mar 16, 2016 4:27 PM

      Dear Milko,

      Thankyou for answerme. Well the problem is that, I wanna make a real time graph. The idea is as the platform calculate or similar, the graph draw point by point. do yo have a sample in vb.net? can you helpme?.

      On the other hand, do you have any sample for advanced scatter style?. I was looking for on the websitehelp and also in the blogs, but i couldn't found it. I wanna do this on vb.net: 1) Make a dynamic label showing the coordinates o values of the graph or also a tooltip showing the crosshair points; 2) Differents spaces on majorgrid and minor grid. In specific i wanna just draw the outsidelines of the chart area (not the control). 3)  Resize markers.

      I really appreciate your help and support. I hope you can helpme.

      Best Regards,

      Salvador.

      • 0
        Milko Venkov
        Milko Venkov answered on Mar 17, 2016 10:04 AM

        Hello Salvador,

        Thank you for your feedback.

        Please find bellow answers to your questions:

        • The idea is as the platform calculate or similar, the graph draw point by point. Do you have a sample in vb.net? Can you help me – what you need to do is to add points to your DataPointsCollection. Each point you add will be shown of the chat. You can also set series TransitionDuration property to animate the point addition. Please check the attached sample where I have implement this;
        • Make a dynamic label showing the coordinates of values of the graph or also a tooltip showing the crosshair points – you can track the mouse position in the chart by handling MouseMove event. Please check the attached sample where I have shown how to achieve this;
        • Different spaces on major grid and minor grid. In specific I want to just draw the outside lines of the chart area (not the control) – I am not sure if I understand what you need here. If you need only the chart without any axes you can skip drawing of the axes. Please try to send me some screenshot showing which parts of the chart you need and which you do not;
        • Resize markers – I am not sure what this means too. If you need to zoom and pan the chart you can allow the end user to do so either by using some buttons, scroll bars and etc. controls or by interact with mouse and keyboard. Please, if this is what you need, check the following link about chart navigation http://help.infragistics.com/Doc/WinForms/current/CLR4.0/?page=DataChart_Chart_Navigation.html

        Please let me know if you need any additional information.

      • 0
        Salvador Ramos
        Salvador Ramos answered on Apr 1, 2016 12:28 AM

        Dear Milko,

        Thankyou so mucho for your helpme, i really appreciate the support, but i have 2 more question on infragistics vb.net. Please, can you helpme?

        1) I wanna resize the markers on the scatter lines series  (in the ultradatachart i wanna make bigger makers) can you helpme?

        2)  I wanna highlight the points insicde the chart with movement mouse event (when the crosshair lines pass trought the points chart, the point chart hightlight).

        I hope you can helpme again. Really, thank you.

        Best Regards,

        Salvador

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Salvador Ramos
Favorites
0
Replies
4
Created On
Apr 01, 2016
Last Post
10 years, 6 months ago

Suggested Discussions

Created by

Created on

Apr 1, 2016 12:28 AM

Last activity on

Feb 20, 2026 12:50 PM