This is a migrated thread and some comments may be shown as answers.
Set filtered items for series
1 Answer 11 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Ion asked on 12 Nov 2013, 02:36 PM

I have a Q3 2012 HtmlRadChart, trying to bind it with List<> values. A list item object has properties CreatedDate, Name and Value. I want to display CreatedDate on XAxis, Name as legend and Value as series. Code:

var source = (from r in readData join sen in equipments on r.EquipmentId equals sen.Id
                          select new
                                Id = r.Id,
                                CreatedDate = r.CreatedDate,
                                Value = r.Value,
                                Name = sen.Name,
                                EquipmentId = sen.Id
            foreach (var equipment in source.Select(src => src.Name).Distinct())
                var equipmentLineSeries = new LineSeries
                                           DataField = "Value",
                                           Name = equipment,
            chart.DataSource = source;

The problem is that chart does not "filter" values, and displays all values for every Name in the names list, overriding the other series displayed.
As you can see in attachment, I have 13 values for all 3 Names (PT206, PT208, PT205) and all of them are displayed for every Name, thus, lines are overriten by each other.
How can I filter data source by names, to display the series correctly?


1 Answer, 1 is accepted

Sort by
Danail Vasilev
Telerik team
answered on 14 Nov 2013, 02:31 PM
Hello Ion,

It seems that DataField property (this property is called DataFieldY now) for each LineSeries refers to the same data source "Value" column. I can suggest that you create different columns in the data source, for example "Value1", "Value2" and "Value3 "and refer them by each series.

Note also that in older versions of RadHtmlChart date axis is not supported and therefore custom manipulations with the XAxis items are required in order to display dates there. More information on the matter is available in this help article.

You may also find useful the HtmlChart - Date Axis and HtmlChart - List Of Custom Objects online demos that sheds more light on configuring date axis and databinding.

Danail Vasilev
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Asked by
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
Share this question