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

New To Telerik Trying to empty a chart

4 Answers 51 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 23 Sep 2009, 09:48 PM
Hi,
I'm brand new to Telerik and I'm feeling kind of stupid.
I have a 2D Stacked Bar Chart

I am trying to refresh the data after a set interval.  I'm creating a dashboard application.
Whenever I refresh the data the new data is just getting added to the old data.
I tried setting the itemsource to nothing but it does not seem to make any difference.

The code I'm using was basically cannibalized from one of the demos and I really don't know what I'm doing.

First off how do I remove the data before adding it again?

Second is there a good place someone can point me to, to learn more about the following objects?
SeriesMapping, DataSeries, ItemMapping, DataPointMember.... I'm having a hard time understanding when to use what.

Thanks in advance and I apologize for my ignorance.
Tim

4 Answers, 1 is accepted

Sort by
0
Tim
Top achievements
Rank 1
answered on 24 Sep 2009, 01:28 PM
I figured out my problem,
I was using

RadChart2.SeriesMappings.add(item)
to insert the values
I was attempting to remove values by setting RadChart2.ItemSource = Nothing
Instead I am now saying
RadChar2SeriesMappings.RemoveAt(0) for each of my items and that seems to be working.
I would still appreciate some information on
SeriesMapping, DataSeries, ItemMapping, DataPointMember...
If anyone can point me towards some good resources I would appreciate it.
Thanks,
Tim

0
Dwight
Telerik team
answered on 28 Sep 2009, 08:02 AM
Hello Tim,

I would recommend reading the following topics from our online help.
Here is an exert, I would like to stress out:

Change Notification Support

RadChart also provides full support for change notification -- changes in data sources that implement the INotifyCollectionChanged or the IBindingList interfaces are properly tracked and reflected by the UI.

Kind regards,
Evtim
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Rakhi
Top achievements
Rank 1
answered on 05 Oct 2010, 10:38 AM
radchart.itemssource=  dt ('dt as datatable)
but its not working ?
What should i do ?

Rakhi
0
Vladimir Milev
Telerik team
answered on 11 Oct 2010, 08:18 AM
Hi Rakhi,

I have just tested the following code and it works fine. Please, give it a try and let me know your results:
DataTable dt = new DataTable();
 
dt.Columns.Add(new DataColumn() { DataType = typeof(string), ColumnName = "Name" });
dt.Columns.Add(new DataColumn() { DataType = typeof(double), ColumnName = "Value" });
 
dt.Rows.Add("Apples", 35d);
dt.Rows.Add("Oranges", 28d);
dt.Rows.Add("Tomatols", 32d);
 
SeriesMapping mapping1 = new SeriesMapping();
mapping1.ItemMappings.Add(new ItemMapping("Name", DataPointMember.XCategory));
mapping1.ItemMappings.Add(new ItemMapping("Value", DataPointMember.YValue));
RadChart1.SeriesMappings.Add(mapping1);
RadChart1.ItemsSource = dt;


Greetings,
Vladimir Milev
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
Chart
Asked by
Tim
Top achievements
Rank 1
Answers by
Tim
Top achievements
Rank 1
Dwight
Telerik team
Rakhi
Top achievements
Rank 1
Vladimir Milev
Telerik team
Share this question
or