Plotting from dictionary source with the chart control
Plotting from dictionary source with the chart control
Plotting from dictionary source with the chart control
Plotting from dictionary source with the chart control
Plotting from dictionary source with the chart control
Plotting from dictionary source with the chart control Plotting from dictionary source with the chart control Plotting from dictionary source with the chart control Plotting from dictionary source with the chart control Plotting from dictionary source with the chart control Plotting from dictionary source with the chart control Plotting from dictionary source with the chart control Plotting from dictionary source with the chart control
Plotting from dictionary source with the chart control Plotting from dictionary source with the chart control
Plotting from dictionary source with the chart control
Go Back  Xtreme Visual Basic Talk > > > Plotting from dictionary source with the chart control


Reply
 
Thread Tools Display Modes
  #1  
Old 11-26-2012, 05:30 PM
Thunder13 Thunder13 is offline
Newcomer
 
Join Date: Oct 2012
Posts: 1
Default Plotting from dictionary source with the chart control


I'm, fairly new to programming in vb.net(Visual Studio 2010), so this might be something easy or maybe not. But here is my problem I am trying to plot data stored in a dictionary object of Double, Double that is collected from an Oscilloscopes into a line graph. The first part or the key would be the time and the the next number is the value that needs plotted. There would be a total of 2000 points. The graph needs to be scaled as well. I never used the chart control so the more help the better. Below is a part of the dictionary code i need to plot.


Property WaveformData() As Dictionary(Of Double, Double)
Get
Return _WaveformData
End Get

Set(ByVal value As Dictionary(Of Double, Double))
_WaveformData = value
CalculateValues()
End Set
End Property

ReadOnly Property Average() As Double
Get
Return _Average
End Get
End Property

ReadOnly Property RMS() As Double
Get
Return _RMS
End Get
End Property
.........................
............
......

Thanks

Last edited by Thunder13; 11-26-2012 at 05:40 PM.
Reply With Quote
  #2  
Old 11-28-2012, 08:24 PM
hDC_0Plotting from dictionary source with the chart control hDC_0 is offline
Contributor

* Expert *
 
Join Date: Feb 2004
Posts: 560
Default

Hello Thunder13, and welcome to the forum!

Quote:
Originally Posted by Thunder13

I never used the chart control so the more help the better.
Well to start out with, which version of the .Net Framework are you using?

As explained here, the 4.0 Framework has charting built-in,
but here is download for the Microsoft Chart Controls for Microsoft .NET Framework 3.5 (if you don't already have it).
There are also evaluation version of third party controls (like this one) you can use that have chart animation built-in.

You're probably going to start out with looking at the Chart.DataSource Property.
Then you might want to explore the DataPointCollection.DataBind Method
This MSDN "Binding Data to Series (Chart Controls)" page might be something to reference also.

After that you might want to give a read through Alex Gorev's "Data Binding Microsoft Chart Control" MSDN blog article.

The code is mostly C#.Net but this social.msdn thread has some similar code written in VB.Net.

However I agree with the suggestion made in this StackOverflow thread:
Quote:
..my suggestion would be to include the data in a separate control, rather than as part of the chart itself. It would be much easier to work with if you kept it in one of the .net controls that's meant for tabular data, whether you're in winforms or webforms.
This page also had some interesting VB.net code for using a Dictionary object with a chart:
Code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load   
  Dim st As DateTime = New DateTime(2010, 6, 1)   
  Dim dys As Integer = 12   
  Dim dict As Dictionary(Of DateTime, Long) = GetData(st, dys)   
  For Each d As DateTime In dict.Keys   
    Dim xlab As String = d.ToString("M/d")   
    If (d.DayOfWeek = DayOfWeek.Sunday OrElse d.DayOfWeek = DayOfWeek.Saturday) Then   
      Chart1.Series("weekends").Points.AddXY(xlab, dict(d))   
      Chart1.Series("data").Points.AddXY(xlab, 0)   
    Else   
      Chart1.Series("weekends").Points.AddXY(xlab, 0)   
      Chart1.Series("data").Points.AddXY(xlab, dict(d))   
    End If   
  Next   
End Sub   
  
Private Function GetData(ByVal stDt As DateTime, ByVal days As Integer) As Dictionary(Of DateTime, Long)   
  Dim gd As New Dictionary(Of DateTime, Long)   
  Dim r As New Random()   
  Dim wkDt As New DateTime(stDt.Year, stDt.Month, stDt.Day)   
  Dim wkVal As Long = 171   
  For i As Integer = 1 To days   
    gd.Add(wkDt, wkVal)   
    wkDt = wkDt.AddDays(1)   
    If (wkDt.DayOfWeek <> DayOfWeek.Sunday AndAlso wkDt.DayOfWeek <> DayOfWeek.Saturday) Then wkVal -= r.Next(31)   
  Next i   
  Return gd   
End Function
One of the dimpliest ways to get a chart to move is to use a Timer control in combination with a chart control as explained in this eHow article.

There is also this Microsoft Dev Center download:
Dynamic Plotting Of Graph Using VB.NET

Hopefully that's should be enough to get you started extending the limited code snippets you posted and try to get something working.

Last edited by hDC_0; 11-28-2012 at 08:30 PM.
Reply With Quote
Reply

Tags
chart, charts, dictionary, format, line graph


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Plotting from dictionary source with the chart control
Plotting from dictionary source with the chart control
Plotting from dictionary source with the chart control Plotting from dictionary source with the chart control
Plotting from dictionary source with the chart control
Plotting from dictionary source with the chart control
Plotting from dictionary source with the chart control Plotting from dictionary source with the chart control Plotting from dictionary source with the chart control Plotting from dictionary source with the chart control Plotting from dictionary source with the chart control Plotting from dictionary source with the chart control Plotting from dictionary source with the chart control
Plotting from dictionary source with the chart control
Plotting from dictionary source with the chart control
 
Plotting from dictionary source with the chart control
Plotting from dictionary source with the chart control
 
-->