New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

Array

This help article describes which properties to use to bind the ASP.NET AJAX Chart to an Array and presents a code example. To bind a RadHtmlChart to an Array object, you assign the RadHtmlChart DataSource property to the array and then call the RadHtmlChart DataBind() method. The y-axis automatically adjusts to accommodate the values and its appearance can be controlled more precisely via its properties. Example 1 demonstrates data binding to an array of doubles.

Example 1: The RadHtmlChart markup that is bound to an array of doubles in Example 2.

ASP.NET
<telerik:RadHtmlChart runat="server" ID="RadHtmlChart1">
	<PlotArea>
		<Series>
			<telerik:LineSeries Name="2011">
				<TooltipsAppearance DataFormatString="{0}%" />
				<LabelsAppearance Visible="false" />
			</telerik:LineSeries>
		</Series>
		<XAxis>
			<Items>
				<telerik:AxisItem LabelText="January" />
				<telerik:AxisItem LabelText="Februrary" />
				<telerik:AxisItem LabelText="March" />
				<telerik:AxisItem LabelText="April" />
				<telerik:AxisItem LabelText="May" />
				<telerik:AxisItem LabelText="June" />
				<telerik:AxisItem LabelText="July" />
				<telerik:AxisItem LabelText="August" />
				<telerik:AxisItem LabelText="September" />
				<telerik:AxisItem LabelText="October" />
				<telerik:AxisItem LabelText="November" />
				<telerik:AxisItem LabelText="December" />
			</Items>
		</XAxis>
		<YAxis>
			<LabelsAppearance DataFormatString="{0}%" />
		</YAxis>
	</PlotArea>
	<Legend>
		<Appearance Visible="false" />
	</Legend>
	<ChartTitle Text="IE market share in 2011">
	</ChartTitle>
</telerik:RadHtmlChart>

Example 2: Binding the chart from Example 1 to an array of doubles.

C#
protected void Page_Load(object sender, System.EventArgs e)
{
	double[] ValuesArray = { 26.6, 26.5, 25.8, 24.3, 24.9, 23.2, 22.0, 22.4, 22.9, 21.7, 21.2, 20.2 };
	RadHtmlChart1.DataSource = ValuesArray;
	RadHtmlChart1.DataBind();
}

See Also

In this article
See Also
Not finding the help you need?
Contact Support