Flickering ChartListBox

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
JHirsch
Newbie
Newbie
Posts: 16
Joined: Tue Jul 20, 2004 4:00 am
Location: USA

Flickering ChartListBox

Post by JHirsch » Thu Jul 22, 2004 3:12 pm

HI,

I am using a 2D Line chart and updating it in real-time by adding points on the end of several series (12 to be exact). I could not figure out how to get a vertical scrollbar into a legend, so I used the ChartListBox and associated it with the chart control. This works as desired, but there is constant flickering in the listbox and I am assuming that the action of adding points is casuing this. Any suggestions on how to fix this problem? I have tried setting the ControlStyle of the parent form to double buffering, etc. but that did not help my situation.

Thanks,
Jim

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Thu Jul 22, 2004 11:55 pm

Hi Jim,
flickering in the listbox and I am assuming that the action of adding points is casuing this. Any suggestions on how to fix this problem? I have tried setting the ControlStyle of the parent form to
I cannot reproduce the problem here (I don't see the fickering) using the latest release available on our web site and the following code :

Code: Select all

private void Form1_Load(object sender, System.EventArgs e)
{
for (int i=0;i<13;i++)
{
tChart1.Series.Add (new Steema.TeeChart.Styles.Line());
tChart1.Series[i].FillSampleValues(10);
tChart1.Legend.Visible = false;
chartListBox1.Chart = tChart1;
}

private void timer1_Tick(object sender, System.EventArgs e)
{
Random a = new Random();
for (int i=0;i<13;i++)
{
tChart1.Series[i].Add(a.Next(10));
}
}
Could you please post the code you're using here so I can see if it can be solved ?

JHirsch
Newbie
Newbie
Posts: 16
Joined: Tue Jul 20, 2004 4:00 am
Location: USA

Post by JHirsch » Fri Jul 23, 2004 2:56 pm

Hi Pep,

I zipped up a project and uploaded it to steema.pulic.attachments that demonstrates the flicker of the chartlistbox.

Jim

JHirsch
Newbie
Newbie
Posts: 16
Joined: Tue Jul 20, 2004 4:00 am
Location: USA

Post by JHirsch » Fri Jul 23, 2004 6:56 pm

I figured it out. The flickering is a result of the way I have bundled the chart and chart list box into a class to contain them. The theory is that when the chart updates its axes, it causes a repaint for the whole class, thus making the chart list box flicker. I have tried a few ways to resolve the flickering but have been unsuccessful so far.

Jim

JHirsch
Newbie
Newbie
Posts: 16
Joined: Tue Jul 20, 2004 4:00 am
Location: USA

Post by JHirsch » Fri Jul 23, 2004 9:40 pm

More info for you. The easiest way to see this problem is create a form, then put a panel in the form. Put a TChart into the panel and then put a ChartListBox into the same panel. Adding points onto the graph at any interval will make the ChartListBox flicker.

Jim

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Tue Jul 27, 2004 12:18 pm

Hi Jim,
More info for you. The easiest way to see this problem is create a form, then put a panel in the form. Put a TChart into the panel and then put a ChartListBox into the same panel. Adding points onto the graph at any interval will make the ChartListBox flicker.
I followed your instructions adding a button onto the panel with the following code:

Code: Select all

private void button1_Click(object sender, System.EventArgs e) {
	tChart1.Series.Add(new Steema.TeeChart.Styles.Line());
	tChart1.Series[tChart1.Series.Count - 1].FillSampleValues();
}
I'm afraid I can't see any flickering when clicking the button.
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

JHirsch
Newbie
Newbie
Posts: 16
Joined: Tue Jul 20, 2004 4:00 am
Location: USA

Post by JHirsch » Tue Jul 27, 2004 2:32 pm

Hi Chris,

I provided a sample in the public.attachments newsgroup that shows the chartlistbox flickering.

I did not mention a button flickering problem so I am a little confussed as to what you are refering to in your reply.

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Tue Jul 27, 2004 3:25 pm

Hi Jim,

Try commenting out the line:
currentLine.fastLine.Color = graphColor;

in the AddPoint() method of your EquationGraph.

This property only needs to be set once, not each time you add a point in.
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

JHirsch
Newbie
Newbie
Posts: 16
Joined: Tue Jul 20, 2004 4:00 am
Location: USA

Post by JHirsch » Tue Jul 27, 2004 6:53 pm

Hi Chris,

I have corrected that problem (setting the color each time) since I sent the sample to you and it still does not solve the flickering problem.

Thanks,
Jim

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Wed Jul 28, 2004 10:56 am

Hi Jim,
I have corrected that problem (setting the color each time) since I sent the sample to you and it still does not solve the flickering problem.
It does here. These are the steps I followed (all using TeeChart for .NET v1.1.1644.16795, the latest publicly available version):
1. Download TestGraphFlickerApp.zip from the message on news://www.berneda.com/steema.public.attachments with the subject "Flicker Chartlistbox example for Pep Take 3".
2. Run the project "as-is" - the ChartListBox flickering can clearly be seen.
3. Comment out the line currentLine.fastLine.Color = graphColor; - the ChartListBox flickering can clearly not be seen.

Can you reproduce this behaviour at your end using the same TeeChart for .NET version?

If you are still experiencing problems, please upload a fresh project I can run "as-is" to:
news://www.berneda.com/steema.public.attachments

Many thanks!
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

JHirsch
Newbie
Newbie
Posts: 16
Joined: Tue Jul 20, 2004 4:00 am
Location: USA

Post by JHirsch » Wed Jul 28, 2004 4:08 pm

Hi Chris,

Thanks. With that clue I figured it out in my main application and all is working. The only remaining issue that would be nice to have fixed but is not critical is that when I initially set the color of the lines, the chartlistbox flickers as a result of this change. So basically, if I have 12 series, it flickers 12 times then is displayed normally.

Does the chartlistbox component have double buffering enabled ? For example:

Code: Select all

this.SetStyle( ControlStyles.DoubleBuffer |
               ControlStyles.ResizeRedraw |
               ControlStyles.AllPaintingInWmPaint | 
               ControlStyles.UserPaint, true);
this.UpdateStyles();
Thanks,
Jim

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Fri Jul 30, 2004 9:39 am

Hi Jim,
Does the chartlistbox component have double buffering enabled ?
No, it doesn't. The ChartListBox inherits from the standard System.Windows.Forms.ListBox whose default setting for double buffering is false.

Can you not set AutoRepaint to false to avoid this problem?
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

JHirsch
Newbie
Newbie
Posts: 16
Joined: Tue Jul 20, 2004 4:00 am
Location: USA

Post by JHirsch » Fri Jul 30, 2004 2:47 pm

Hi Chris,

I am a little confussed at your reply. The Chart Listbox does not have a publicly accessible property of AutoRepaint. The TeeChart does have this property and setting it to false has no effect on the flickering problem of the Chart Listbox.

The only reason I asked about double-buffering is that the flickering is a well documented problem with listbox controls and derived controls.
See:
http://msdn.microsoft.com/library/defau ... lsamp4.asp
Since you have a custom control ChartListBox you could add double-buffering easily.

I tried the other available method of using the Chart Listbox BeginUpdate/EndUpdate pair of methods and did not see any difference in the flickering.

Thanks,
Jim

Post Reply