Dynamic Data Binding

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
mweaver
Newbie
Newbie
Posts: 10
Joined: Tue Apr 08, 2003 4:00 am

Dynamic Data Binding

Post by mweaver » Mon Oct 31, 2005 6:07 pm

I'm looking for some ideas or suggestions about creating dynamic data binding for a chart. For example, consider this scenario. The user opens a database view (in a DataTable) that contains several columns of data for the last X weeks. The user creates a Chart that contains three line series (each series corresponds to a different column in the view). They then set series color, point style, axis, header, footer, etc. Now they want to save the chart. Next week, they want to open the chart and have it automatically use the current data (i.e. the view will now contain the current weeks worth of data). They do not want to redo the chart.

Thoughts:

- saving the .ten with data will save a "static" copy of the data, so re-opening the .ten will not show the current data on the graph ...

- if I save the .ten without data, then i'll have to re-create the series with the new DataTable, but then I will need to know what columns were used to create each series, so that information will need to be stored somewhere ...

Any other ideas or suggestions?

tomster
Newbie
Newbie
Posts: 20
Joined: Tue Aug 02, 2005 4:00 am
Location: Stockholm, Sweden

Post by tomster » Tue Nov 01, 2005 8:36 am

I do what you need.

You really don't need to do a lot.

Lets say you have three columns a, b and c. When you create your chart each series will have something like this:
a.YValues.DataMember = "a";
a.YValues.DataSource = yourdatatable;

As you can see there is very little you need to do here! I save the .ten file to a database as a blob and retrieve it and if you just replace the datasource with your updated datatable it should "just work". If it doesn't, you might have to save extra info for each series and write a method that "syncs" your series with the database, i.e. sets all the DataMembers etc for them again.

As I understand it, saving a chart without data only means that the actual data points aren't saved, everything else still is, like DataMember info etc.

I hope this provides some value, I don't have the time to provide you with a lot of code but there really isn't that much code involved except for the export code and the import code.

The answer to your last statement is basically: that information is stored in the .ten file.

Cheers,
Tommie

Post Reply