If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Hybrid View

Real-time graph using Mschart

Hi guys,

I am trying to plot a real time graph using Mschart control. I have an array Tot(). Each time Tot() gets new value the Mschart is plotted. My problem is instead of showing the graph, the Mschart control is just flickering. can anyone pl help me.

A few questions about MSChart

Hello All
I just started my first VB project and run into some similar problems as decribed in that thread. I am not that big of a programmer so I started with a simple task. My little program reads voltage from Keithley model 2000 DMM and plots them on the screen. I did the plotting in PictureBox with the following code inside a for loop (for now I am just reading 2000 data points and plting them)

The above code takes care of the scaling allright but it shows the graph after all 2000 data points were collected.
So my question is: How do I update the graph after each and every single point?
I tried the code posted by mstraf (as is, not with my data points). It worked but the graph was flickering and I do not want that. Ideally I want the MSChart plot area to be of a fixed width (even when it is empty) and the data beeing plotted as they come. Your help is greatly appriciated.

Thank You Marco for your post. I am so new to VB that I had to spend some time figuring out what that Picture1.Scale method was doing. I think that I understand that now. I achived very simmilar effect with Scale.Height and Scale.Width properties of my PictureBox.
Regarding Your first bit of code there. I am not sure what it is doing, i.e. how do You know that I am redim-ing my array? There is a text control on my form in which user specifies how many data point he/she wants to take and that array is reDim-ed once before I start filling it up. Sorry if my not including that bit of code caused that misunderstanding.
I added an extra button to my form for testing purposes and that code inside it:

and when I click the button the chart flickers and does not show anything (no points). Could You tell me what am I doing wrong here?
Another question regarding MSChart would be the following: When You place new MSChart on your form it shows some lines. Where are those data point comming from?