Page 1 of 1

Repainting Chart

Posted: Wed Mar 02, 2011 3:44 pm
by 16658659
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

Re: Repainting Chart

Posted: Wed Mar 02, 2011 4:55 pm
by 10050769
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,

Re: Repainting Chart

Posted: Thu Mar 03, 2011 12:30 pm
by 16658659
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...

Re: Repainting Chart

Posted: Thu Mar 03, 2011 12:55 pm
by 16658659
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....

Re: Repainting Chart

Posted: Thu Mar 03, 2011 2:51 pm
by 10050769
Hello Digitec,

Could you send please a simple project we can reproduce exactly your problem here?

Thanks,

Re: Repainting Chart

Posted: Thu Mar 03, 2011 3:32 pm
by 16658659
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?

Re: Repainting Chart

Posted: Thu Mar 03, 2011 5:03 pm
by 10050769
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,

Re: Repainting Chart

Posted: Fri Mar 04, 2011 1:53 pm
by 16658659
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.

Re: Repainting Chart

Posted: Mon Mar 07, 2011 4:46 pm
by 16658659
Hello Sandra

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

Re: Repainting Chart

Posted: Tue Mar 08, 2011 9:31 am
by 16658659
Hi Sandra

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

Please see my previous posts and answer to your questions.

Re: Repainting Chart

Posted: Tue Mar 08, 2011 9:33 am
by 16658659
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....

Re: Repainting Chart

Posted: Tue Mar 08, 2011 9:59 am
by narcis
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.

Re: Repainting Chart

Posted: Tue Mar 08, 2011 11:39 am
by Pep
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.

Re: Repainting Chart

Posted: Tue Mar 08, 2011 12:34 pm
by 16658659
Thank you for your answer.

Ill try this today and provide feedback.

Again, thank you.

Re: Repainting Chart

Posted: Mon Mar 14, 2011 10:23 am
by 16658659
HI, just to confirm that all is OK now.

Thank you for your help.