Profile Picture

Databinding several series from a database

Posted By Miquel Vila 14 Years Ago
Author
Message
Miquel Vila
questionmark Posted 14 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 4, Visits: 1
I need to draw diferent line series, and I have all the values from the series in my database where each value has an identifier of the serie witch it belongs.

When databinding a line serie, can I specify a filter based on the serie id so it only draws its values?

Milen Metodiev
Posted 14 Years Ago
View Quick Profile
Forum Member

Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)

Group: Nevron Team
Last Active: 14 Years Ago
Posts: 48, Visits: 1

Hi Miguel,

You cannot make the binding filter the records, but you can filter them in advance - for example you can use a separate data adapter for each series and the adapter can filter the values by series id.

Best Regards,
Milen



Miquel Vila
Posted 14 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: Forum Members
Last Active: 14 Years Ago
Posts: 4, Visits: 1
Thanks for your reply.
The problem is that I have more than 30 series, and some of this series have more than one value per second, and after some time the database load gets really high and the chart refreshes slowly (I'm trying to refresh the chart every second).

The scenario is that I receive series values over TCP/IP, and as I said there is a lot of information as each of this series has at least one value per second. I need to chart all this data "realtime", so right now I have a program that receives the data over TCP and stores it into the database, and the charting program that binds each series to its data by filtered dataadapters, but it gets really slow after some time. I don't really need to show all the received values, showing the values from the last 5 seconds would be ok as long as the chart can be scrolled back when acquisition is stopped, but I guess dataadapters ask for all the data at each refresh so the database load gets high when the value count is big.

What would be the best solution to achieve this? Should I change the dataadapter query at each refresh to filter and get only the values that are going to be drawn? Should I forget about the database and feed the chart as I receive the values over ethernet? That would imply feeding from another thread and I'm not sure if this would be a good solution.

Thanks,
Miquel

Milen Metodiev
Posted 14 Years Ago
View Quick Profile
Forum Member

Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)Forum Member (48 reputation)

Group: Nevron Team
Last Active: 14 Years Ago
Posts: 48, Visits: 1

Hi Miquel,

I don't think the data binding can help you much in this case. The multiple database queries that have to be performed every second definitely add significant overhead which can be avoided with some custom code. You can store the values that come from the socket into some sort of buffer and feed them directly to the chart. If you want to display just the last several values you have two options:

1. Keep just the latest values inside the chart data storage and remove the older values. Since you will need the whole data in the end of the session - you'll have to store all the values in some other storage.

2. Store all the data in the chart and use a custom view range for the X axis to display the latest ones - I guess in this case the chart will be updated more slowly.

Regarding threading - you are not supposed to call directly methods of the chart control from another thread, but you can use the Invoke method.

Best Regards,
Milen





Similar Topics


Reading This Topic