Repainting Chart

TeeChart for ActiveX, COM and ASP
Post Reply
Digitec
Newbie
Newbie
Posts: 10
Joined: Mon Feb 28, 2011 12:00 am
Contact:

Repainting Chart

Post by Digitec » Wed Mar 02, 2011 3:44 pm

Hi

Designing in Visual Basic.

I need to know how to refresh my chart.

1) Chart is open in a form
2) Data read into Series0 using the dataset.

Now data changes in the table, but I dont seem to be able to get the Chart to repaint the new data unless I close and reopen the form.

Tried tchart1.repaint on a button click event, but doesnt refresh.

Any ideas please.

Thanks

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

Re: Repainting Chart

Post by Sandra » Wed Mar 02, 2011 4:55 pm

Hello Digitec,

If you want refresh data, you must use property of series CheckDataSource as do in below lines of code:

Code: Select all

  TChart1.Series(0).CheckDataSource
But if you want redraw the chart, you need use TChart.Environment.InternalRepaint method that as do in next lines:

Code: Select all

    TChart1.Environment.InternalRepaint
I hope will helps.

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

Digitec
Newbie
Newbie
Posts: 10
Joined: Mon Feb 28, 2011 12:00 am
Contact:

Re: Repainting Chart

Post by Digitec » Thu Mar 03, 2011 12:30 pm

Hi Sandra

Thanks for the post, but that didnt help.

I have setup a test access database. In there i have a table with 10 X and Y values.

I drop the activex teechart onto a form and the edit the the control so it is using a Dataset in Series0.

I then generate a bar chart showing all the values. That all works fine.

Now, if a value in the X column of the table changes, how do I show that change on the chart with a refresh option.

At the moment, the only way is to close the form and reopen to show the new values.

Any ideas? Thanks in advance...

Digitec
Newbie
Newbie
Posts: 10
Joined: Mon Feb 28, 2011 12:00 am
Contact:

Re: Repainting Chart

Post by Digitec » Thu Mar 03, 2011 12:55 pm

In addition, I added 2 buttons to the forms.

One clears the chart, this works using TChart4.Series(0).Clear

The other button should show the new underlying data using TChart4.Series(0).CheckDataSource.

But it doesnt, the old data is shown.

Any help would be appricated....

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

Re: Repainting Chart

Post by Sandra » Thu Mar 03, 2011 2:51 pm

Hello Digitec,

Could you send please a simple project we can reproduce exactly your problem 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

Digitec
Newbie
Newbie
Posts: 10
Joined: Mon Feb 28, 2011 12:00 am
Contact:

Re: Repainting Chart

Post by Digitec » Thu Mar 03, 2011 3:32 pm

File attached in next post:

Description of zip file:

1) Contains teedata.mdb
2) Contains teechart.mdb

Teedata.mdb contains a simple table with 2 columns and 10 rows of data. for X and Y values.
Teechart.mdb contains a linked table to teedata.mdb, also a single form with bar chart and 2 buttons.

Button1 clears screen/data - works fine

Button2 reloads the data - does not upload change data in table.

With the chart open, I change some data in the count field and click the Reload button.

New data is not displayed, only old values are dispalyed. It is almost as if it is caching the old series.

Any ideas?
Attachments
teechart.zip
(29.39 KiB) Downloaded 734 times

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

Re: Repainting Chart

Post by Sandra » Thu Mar 03, 2011 5:03 pm

llo Digitec,

Thanks for your project solution, but It doesn't run for me. Please, you could explain step to step, how we do for reproduce your project, so we try to reproduce it and try to help you to solve your problem.

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

Digitec
Newbie
Newbie
Posts: 10
Joined: Mon Feb 28, 2011 12:00 am
Contact:

Re: Repainting Chart

Post by Digitec » Fri Mar 04, 2011 1:53 pm

Your chart doesnt seem to allow for a simple refresh on the data.

1) I have an msaccess form with a bar chart and 2 buttons.

2) I have a table with 2 columns and 10 rows of data - represents X and Y values for bar chart.

3) The bar chart is being populated via your datasource option and using the dataset option within the series0.

4) The form is opened and the chart populates.

5) I know edit some data in the table.

6) I want this new data to appear on the chart.

7) I click a button to reload, the click event has this code:

Private Sub Command2_Click()
TChart0.Series(0).CheckDataSource
End Sub

8) The chart does not repaint with the new data.

9) If I close the form down and re-open, the chart will now show the new data. So how do I get the chart to refesh with the new data without closing and reopening the form.

Digitec
Newbie
Newbie
Posts: 10
Joined: Mon Feb 28, 2011 12:00 am
Contact:

Re: Repainting Chart

Post by Digitec » Mon Mar 07, 2011 4:46 pm

Hello Sandra

Any solution, I need to know this before my right to return of your software option runs out.

Digitec
Newbie
Newbie
Posts: 10
Joined: Mon Feb 28, 2011 12:00 am
Contact:

Re: Repainting Chart

Post by Digitec » Tue Mar 08, 2011 9:31 am

Hi Sandra

I dont appear to be getting any support from your company.

Please see my previous posts and answer to your questions.

Digitec
Newbie
Newbie
Posts: 10
Joined: Mon Feb 28, 2011 12:00 am
Contact:

Re: Repainting Chart

Post by Digitec » Tue Mar 08, 2011 9:33 am

Hello Sandra

I have been waiting 4 days for an answer to what I think should be a pretty straight forward function in your activex control.

As you represent Steema on technical support, do you think you can provide me with an answer.

Thank you....

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

Re: Repainting Chart

Post by Narcís » Tue Mar 08, 2011 9:59 am

Hello Digitec,

I'd like to apologise if you got the impression your posts are ignored, they aren't. Your last reply on this issue was on Friday afternoon around 15:00 CET. Steema Software's support staff doesn't work on weekends so from that I assume that less than 2 working days have passed since. We try to reply on a timely fashion to all technical support inquiries and will try to provide an answer to yours along the day.

Thanks for your patience and understanding.
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

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

Re: Repainting Chart

Post by Pep » Tue Mar 08, 2011 11:39 am

Hello,

first of all, sorry for delay !

Here the answer to your question, hope that it helps. In order refresh the data provided by a DataSet, as datasource, you have to reasign the DataSource once a record have been updated (added, modified, deleted) by code. Here an example of code :

Code: Select all

TChart1.Series(0).DataSource = "DSN=TeeChart Pro Database; TABLE=Employee"
TChart1.Series(0).CheckDataSource
Please, do not hesitate to contact us in case we can be of any further help.

Digitec
Newbie
Newbie
Posts: 10
Joined: Mon Feb 28, 2011 12:00 am
Contact:

Re: Repainting Chart

Post by Digitec » Tue Mar 08, 2011 12:34 pm

Thank you for your answer.

Ill try this today and provide feedback.

Again, thank you.

Digitec
Newbie
Newbie
Posts: 10
Joined: Mon Feb 28, 2011 12:00 am
Contact:

Re: Repainting Chart

Post by Digitec » Mon Mar 14, 2011 10:23 am

HI, just to confirm that all is OK now.

Thank you for your help.

Post Reply