Hello,
I have a list of objects (a linq2sql query I convert to a list) that I want to use as a datasource for a RadHTMLChart. The data look like this:
Employee WorkDay Performance
Jane 2014-01-01 300
Jane 2014-01-02 287
John 2014-01-02 324
Jane 2014-01-03 151
John 2014-01-03 139
.....
I want performance to be the Y Axis, WorkDay to be the X Axis and for the data to be grouped into series using the Employee name. I have read the help information and viewed all of the demos but I can't seem to get it right. If I pre-define the series in the aspx it works, but I can't seem to make it render correctly from just providing a data source.
Here is one of the attempts, where I am close, but the different series don't align to the x-axis.
The result looks like the attached chart. It's close but I don't see the x labels (Should show the date) and the data is therefore not aligned to the proper x axis.
Thanks for any help!
I have a list of objects (a linq2sql query I convert to a list) that I want to use as a datasource for a RadHTMLChart. The data look like this:
Employee WorkDay Performance
Jane 2014-01-01 300
Jane 2014-01-02 287
John 2014-01-02 324
Jane 2014-01-03 151
John 2014-01-03 139
.....
I want performance to be the Y Axis, WorkDay to be the X Axis and for the data to be grouped into series using the Employee name. I have read the help information and viewed all of the demos but I can't seem to get it right. If I pre-define the series in the aspx it works, but I can't seem to make it render correctly from just providing a data source.
Here is one of the attempts, where I am close, but the different series don't align to the x-axis.
Dim
q = emp.BenchmarkForTask(50, 3,
"12/1/13"
)
' This gets my data
Dim
lemp
As
String
=
""
lemp =
""
chrtPerformanceNew.PlotArea.XAxis.Name =
"Employee"
chrtPerformanceNew.PlotArea.XAxis.DataLabelsField =
"Employee"
' Load each series from the data:
For
Each
tmp
In
q.OrderBy(
Function
(x) x.Employee)
If
lemp <> tmp.Employee
Then
Dim
x
As
New
Telerik.Web.UI.LineSeries
x.Name = tmp.Employee
x.DataFieldY =
"Performance"
x.LabelsAppearance.Visible =
False
x.TooltipsAppearance.DataFormatString =
"{WorkDay} - YO!"
x.LabelsAppearance.DataField =
"WorkDay"
chrtPerformanceNew.PlotArea.Series.Add(x)
lemp = tmp.Employee
End
If
Next
' Load data into series. How to I set it to the correct X axis?
For
Each
tmp
In
q.OrderBy(
Function
(x) x.WorkDay)
Dim
i
As
Integer
= 0
For
i = 0
To
chrtPerformanceNew.PlotArea.Series.Count - 1
If
chrtPerformanceNew.PlotArea.Series(i).Name = tmp.Employee
Then
Dim
ca
As
Telerik.Web.UI.LineSeries = chrtPerformanceNew.PlotArea.Series(i)
Dim
si
As
New
Telerik.Web.UI.SeriesItem
si.Name = tmp.WorkDay
si.TooltipValue = tmp.WorkDay &
" -> "
& tmp.Employee
si.YValue = tmp.Performance
ca.Items.Add(si)
End
If
Next
Next
The result looks like the attached chart. It's close but I don't see the x labels (Should show the date) and the data is therefore not aligned to the proper x axis.
Thanks for any help!