Author Topic: Need Visual Basic Strip Chart Object  (Read 5716 times)

0 Members and 1 Guest are viewing this topic.

Offline Sal Ammoniac

  • Frequent Contributor
  • **
  • Posts: 880
  • Country: us
    • Embedded Tales Blog
Need Visual Basic Strip Chart Object
« on: June 01, 2011, 10:17:09 pm »
My son is working on a project to monitor water levels in a tank. An MCU and sensor collect the water level information and send it to a PC over a serial line. He's displaying the water level as numerical values in a Visual Basic program, but would like to display it as a graph that constantly updates and scrolls to the left as more data come in.

Anyone know of a strip chart object compatible with Visual Basic Express 2010?
 

Offline deef

  • Newbie
  • Posts: 4
Re: Need Visual Basic Strip Chart Object
« Reply #1 on: June 02, 2011, 12:30:46 am »
I've had quite a bit of success embedding Excel charts in VB.net. If you have MS Office installed, this is a pretty straight forward method of graphically plotting the data. Embedding Office Objects makes stylizing the chart and adding/removing data easy. Not to mention it wouldn't surprise me if the standard methods of regression analysis (trendline) were included as well.

I've embedded both graphs and spreadsheets hooked into a .PDF export function.

You can add these Excel "controls" to your toolbox by choosing the appropriate .Net Framework controls. For example:
"Right Click Toolbar" > Choose Items > ".Net Framework Controls" > Microsoft.Office.Tools.Excel > Chart
"Right Click Toolbar" > Choose Items > ".Net Framework Controls" > Microsoft.Office.Tools.Excel > ChartSheet
"Right Click Toolbar" > Choose Items > ".Net Framework Controls" > Microsoft.Office.Tools.Excel > Workbook (For a spreadsheet).

Now, these items will only be accessible if MS Office is installed.

As for the "scrolling" nature you're describing, I'd simply set the extents of the chart up with an array that is refreshed at some kind of periodic timer -- or on a "new data" event of some kind.
« Last Edit: June 02, 2011, 12:37:46 am by deef »
 

Offline PeterG

  • Frequent Contributor
  • **
  • Posts: 813
  • Country: au
Re: Need Visual Basic Strip Chart Object
« Reply #2 on: June 02, 2011, 04:12:09 am »
I have used this control a few times. It is easy to customize as well.

http://www.codeproject.com/KB/vb/tracker.aspx

Regards
Testing one two three...
 

Offline Sal Ammoniac

  • Frequent Contributor
  • **
  • Posts: 880
  • Country: us
    • Embedded Tales Blog
Re: Need Visual Basic Strip Chart Object
« Reply #3 on: June 02, 2011, 11:10:04 pm »
I have used this control a few times. It is easy to customize as well.

http://www.codeproject.com/KB/vb/tracker.aspx

Looks just like the Task Manager performance display. Is there source code available for this control? It looks like all the interesting stuff is done in a DLL.

I need to slow it way down. My updates are only once per minute, and the slowest speed setting seems to be around one update per second.
 

Offline PeterG

  • Frequent Contributor
  • **
  • Posts: 813
  • Country: au
Re: Need Visual Basic Strip Chart Object
« Reply #4 on: June 03, 2011, 12:37:54 am »
There is a link to download the source on the page.
You could remove the timer and use an event to trigger an update of the display.

Regards
Testing one two three...
 

Offline Mechatrommer

  • Super Contributor
  • ***
  • Posts: 9073
  • Country: my
  • reassessing directives...
Re: Need Visual Basic Strip Chart Object
« Reply #5 on: June 03, 2011, 01:05:40 am »
since i'm an oldtimer, i dont have to suggest to you. but i suggest that you suggest your son to build his own control, that will be more fun, more control and do whatever you want. if you have to use others control, then you have to know how to workaround it, such as storing your data in memory and keep updating the same data every second for that 1 minute. here's my graph control that i build for myself, its not good, but it can demonstrate how to diy control. it got nothing except drawing lines, but once you got the grasp, you can add "sweet and sour" to it, text label etc. need alot of translation though i think from vb6 to vb express. FWIW.
« Last Edit: June 03, 2011, 01:07:16 am by Mechatrommer »
if something can select, how cant it be intelligent? if something is intelligent, how cant it exist?
 

Offline strantor

  • Contributor
  • Posts: 20
Re: Need Visual Basic Strip Chart Object
« Reply #6 on: September 28, 2011, 10:24:40 am »
Hey, sorry to sign up here just to necropost, but in the link in post # 2 by PeterG do you know if there's a way to have more than one line on the chart? I figured out how to change the speed on it with a separate trackbar, but I need at least 3 traces on the plot.
 

Offline PeterG

  • Frequent Contributor
  • **
  • Posts: 813
  • Country: au
Re: Need Visual Basic Strip Chart Object
« Reply #7 on: September 28, 2011, 10:47:43 am »
It has been a while since i played with that control. You should be able to adapt t to draw 3 traces. If not you can search the website for other controls.

Regards
Testing one two three...
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf