Auto refresh serie when chage data in DataSourse

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Nik
Newbie
Newbie
Posts: 9
Joined: Wed Mar 07, 2012 12:00 am

Auto refresh serie when chage data in DataSourse

Post by Nik » Wed Oct 10, 2012 9:51 am

Hi
I created points serie

Code: Select all

                    Steema.TeeChart.Styles.Points _seriesPoints = new Steema.TeeChart.Styles.Points();
                    _seriesPoints.bBrush.Color = _colSerie;
                    _seriesPoints.Pointer.Style = _pointerStyles;
                    _seriesPoints.DataSourse = myDataSet.Tables["myTable"];
                    _seriesPoints.YValues.DataMember = _strAxisY;
                    _seriesPoints.XValues.DataMember = _strAxisX;
                    tChart1.Series.Add(_seriesPoints); 
In the table data changing online and I want look the changes on chart.
For this I created System.Timers.Timer _tmr with _tmr.Elapsed += new System.Timers.ElapsedEventHandler(tmr_ChartProcessor);
and wrote

Code: Select all

        private void tmr_ChartProcessor(object sender, EventArgs e)
        {
            foreach (Steema.TeeChart.Styles.Series _ser in tChart1.Series) {
                if (!_ser.Visible) continue;
                if (_ser.DataSource != null)    _ser.CheckDataSource();
                _ser.Repaint();
            }
            tChart1.Refresh();
        }
Questions:
1. Why serie on chart not change without tChart1.Refresh() ? Why _ser.Repaint() is not enough ?
2. When serie repain (may be when chart refresh) I look blinking points - how remove the blinking ?
3. Exist any way repain serie without using timer, example, for event data change in table or other ?

Thank Y

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Auto refresh serie when chage data in DataSourse

Post by Narcís » Thu Oct 11, 2012 7:32 am

Hi Nik,
1. Why serie on chart not change without tChart1.Refresh() ? Why _ser.Repaint() is not enough ?
Isn't CheckDataSource() working? What about RefreshSeries() instead?
2. When serie repain (may be when chart refresh) I look blinking points - how remove the blinking ?
Try toggling AutoRepaint as I explained on this thread.
3. Exist any way repain serie without using timer, example, for event data change in table or other ?
Yes, you can do as in the All Features\Welcome !\Components\Chart Grid example in the features demo, available at TeeChart's program group.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Nik
Newbie
Newbie
Posts: 9
Joined: Wed Mar 07, 2012 12:00 am

Re: Auto refresh serie when chage data in DataSourse

Post by Nik » Thu Oct 11, 2012 10:36 am

Isn't CheckDataSource() working?
Look above

Code: Select all

_seriesPoints.DataSource = myDataSet.Tables["myTable"];
imho, which means that _ser.DataSource mast be equal != null

AutoRepaint - it is good, but
myDataSet.Tables["myTable"] not have event CurrentCellChanged how have dataGrid1

and how make _ser.CheckDataSource(); ?
On Timer ?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Auto refresh serie when chage data in DataSourse

Post by Narcís » Thu Oct 11, 2012 10:59 am

Hi Nik,

Can you please attach a simple example project we can run "as-is" to reproduce the problem here? You can create a DataSet at run-time as in the example Christopher Ireland posed here. Thanks in advance.
AutoRepaint - it is good, but
myDataSet.Tables["myTable"] not have event CurrentCellChanged how have dataGrid1
Unless a more adequate event exists you should probably call CheckDataSource() manually every time the data source is updated.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Nik
Newbie
Newbie
Posts: 9
Joined: Wed Mar 07, 2012 12:00 am

Re: Auto refresh serie when chage data in DataSourse

Post by Nik » Thu Oct 11, 2012 11:39 am

I can send/attach my form, but
My myForm(with chart and dataset) created in library because the launch from other programm (base_programm)
Dataset passing as parametr in myForm.
And base_programm changing data in dataset tables.

Y can't run it. Attach myForm ?

Therefore in myForm not exist events for changing data.
And, imho, Dataset.Table don't have events "changed_data/cell" so.

2 main questions:
1. When serie repain (may be when chart refresh) I look blinking points - how remove the blinking ?
2. Exist any way repain serie without using timer, example, for event data change in table or other ?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Auto refresh serie when chage data in DataSourse

Post by Narcís » Thu Oct 11, 2012 2:34 pm

Hi Nik,
Y can't run it. Attach myForm ?
We would really appreciate if you created a simple example project we can run "as-is" to reproduce the problem here. Something similar as the example in the thread I pointed you in my previous post.
1. When serie repain (may be when chart refresh) I look blinking points - how remove the blinking ?
Doesn't Autorepaint help here?
2. Exist any way repain serie without using timer, example, for event data change in table or other ?
You need to notify the chart data has changed in some way: an event from the data source, calling CheckDataSource, forcing the chart to repaint, etc. If you attach a sample project reproducing your problem we will try to help you find the best solution for your scenario.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Nik
Newbie
Newbie
Posts: 9
Joined: Wed Mar 07, 2012 12:00 am

Re: Auto refresh serie when chage data in DataSourse

Post by Nik » Fri Oct 12, 2012 8:29 am

See attached file
Project OptionMonitor

If in tmr_ChartProcessor comment tChart1.Refresh();
then chart not repaint series with any combination _ser.Paint() and _ser.RefreshSeries
Attachments
MyControlLib.rar
(37.37 KiB) Downloaded 451 times

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Auto refresh serie when chage data in DataSourse

Post by Sandra » Mon Oct 15, 2012 9:34 am

Hello Nik,

We haven't achieved execute your project, so, appears next Argument exception:
ErrorProject.jpg
ErrorProject.jpg (37.45 KiB) Viewed 9643 times
Can you tell us what do we do to solve the problem? Or if you prefer, you can send us a correct project that we can run as-is here.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply