This is a migrated thread and some comments may be shown as answers.

RadCartesianChart : Any property to say that there is Data on chart.

7 Answers 137 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Kz
Top achievements
Rank 1
Kz asked on 07 Dec 2015, 06:11 PM

Hi There,

 Is there any way where we can find if chart is some data or not. I know it will display "No Data" template when there is no data I want know a property which triggers it. Why I need so because we have chart and some other UI  element like grid... which should syn other UI element when there is some data on chart.

Basically I am looking  for some property like "IsChartHasSomeData"  . Please help me to know this  I mean how can we do this.?

 

 

7 Answers, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 08 Dec 2015, 09:40 AM
Hi,

The chart does not have a property to indicate whether the empty content message is shown. However, you can deduct this from the information in the chart, if it has no series - the empty content message is shown. If it has series, but none of the series have data points - again the message is shown. I suspect that if you use MVVM you can easily track if the chart is fed by some items source or not. Let us know how it goes.

Regards,
Petar Marchev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Kz
Top achievements
Rank 1
answered on 08 Dec 2015, 05:54 PM

Well.. 

 

I did this EmptyContent="{Binding NoDataDisplay,Mode=TwoWay}"  . when there is no data  " NoDataDisplay"  is set with string "No Data to plot."

 But when  chart gets data  above property(EmptyContent) is not Set.Hence so I dont know when data has arrived .

 So I still have issue . Please help if you any other idea.

 

Thankyou

0
Petar Marchev
Telerik team
answered on 09 Dec 2015, 09:35 AM
Hi Sri,

You are mistaken the purpose of the EmptyContent property. It is the content that gets displayed when there is no data. It is not set/reset in order to notify you in code when there is no data.

As I mentioned earlier, if you use MVVM, this means that in the view models you know if you have or have not passed any items for display, so when there are no items, the chart is empty. I will give you a very simple example - if your view model is named MainViewModel, it probably has a property similar to Data. Data is some collection that has a Count property. When the count is zero - there is no data in the chart. When the count is not zero, there is some data in the chart. So, if you use MVVM it should be obvious when there is and when there isn't data in the chart.

Regards,
Petar Marchev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Kz
Top achievements
Rank 1
answered on 09 Dec 2015, 07:05 PM

Understood. that. We are exposing Observablecollection properties on Viewmodel. this collection be set based on some events... 

And events are based on some calculations.  So there is need to say that chart has some data or not i.e calculations result data point count may be zero.  when Chart has no data we will display some other custom UI elemnts on chart.. for this reason we are looking for some kind of property or some work around.

0
Petar Marchev
Telerik team
answered on 10 Dec 2015, 09:25 AM
Hello Sri,

I am a bit confused. Do you still need our help?

You mentioned that the observable collection is set in some events. If these events are in your view models, you can execute a quick check when they occur - if the observable collection is empty or not. If the collection is empty - the chart is empty. So you can expose a new property in your view models to indicate whether or not there is any data.

Even if these events are not in the view models, you can add a collection changed handler to the observable collection and get the same results.

Once you introduce this IsDataEmpty property in your view models, you can easily update the UI when there is and when there is no data.

Let us know if you need further assistance.

Regards,
Petar Marchev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Kz
Top achievements
Rank 1
answered on 10 Dec 2015, 04:45 PM

I know we can do this from viewmodel. but due to complexity of view model and event logic we have to write alot of plumbing code.

So was trying to check if we can find any thing on chart itself.

0
Accepted
Petar Marchev
Telerik team
answered on 15 Dec 2015, 09:25 AM
Hello Sri,

I have attached a small project that demonstrates one possible way to detect whether the empty content presenter is visible or not. Essentially, we are looking inside the visual tree to find the empty content presenter and start listening for visibility changes. We understand that the given work-around is a bit cumbersome and we would suggest that you only use it if you insist on this functionality and cannot achieve it via view models. Let us know if you need more information.

Regards,
Petar Marchev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Chart
Asked by
Kz
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Kz
Top achievements
Rank 1
Share this question
or