Dev with Issues
Dev with Issues

Reputation: 43

Not able to understand .Net Code

Is there any idea what he is doing in the below code at line
"chartSeries.AddItem(new ChartSeriesItem(listData[i].x, listData[i].y));"

I took this code from one forum.
http://www.telerik.com/community/forums/aspnet-ajax/chart/performance-problem-on-line-chart.aspx
I was not able to understand what kind of data holder it is?

Am pulling the data from in dataset format, If I could bind my dataset with listdata, I would acheive this development. But am not undestanding how I need to make this binding.

I have tried as below but didn't worked and throghing an error, please find the attached.

Dim listdata As new DataList 
listdata.DataSource = ds.Tables.Item(0)
listdata.DataBind()  

enter image description here

Original code took from forum

ChartSeries chartSeries = new ChartSeries("Altitude", ChartSeriesType.Line); 
chartSeries.Appearance.ShowLabels = false; 
incrementCount = 1; 

for (int i = 0; i < listData.Count; i = i + incrementCount) 
    {
        chartSeries.AddItem(new ChartSeriesItem(listData[i].x, listData[i].y)); 
    }

RadChart2.AddChartSeries(chartSeries);
RadChart2.PlotArea.XAxis.AxisLabel.TextBlock.Text = "Distance (Miles)"; 
RadChart2.PlotArea.YAxis.AxisLabel.TextBlock.Text = "Yaxislabel";

Upvotes: 0

Views: 99

Answers (1)

RhysW
RhysW

Reputation: 453

I think its as simple as this, the error is that you can't use the word New, the code from the forum says to use new, capitalisation can make all the difference in .NET.

Upvotes: 1

Related Questions