Creating a Line Chart

To create a Line Chart you just have to add the Highchart .Net LineChart control on your aspx page setting the id, height and width:

 <highchart:LineChart id="hcVendas" runat="server" Width="500" Height="350" />

Set the title and categories, and bind your data collection to your control:

//Defining Axis
  hcVendas.YAxis.Add(new YAxisItem { title = new Title("Faturamento") });
  hcVendas.XAxis.Add(new XAxisItem { categories = new[] { "1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002" } });
 
//New data collection
var series = new Collection<Serie>();
series.Add(new Serie { data = new object[] { 400, 435, 446, 479, 554, 634, 687, 750, 831 } });
 
//bind 
hcVendas.DataSource = series;
hcVendas.DataBind();

That's all! Just build and run your web application, the result should be like this:

image

You can also add Title, Subtitle and multiple visual settings.

See a working line chart created by Highcharts .Net :  http://highcharts.paulovich.com.br/Sample01.aspx

Return to Index

Last edited Jan 18, 2012 at 9:00 PM by alrcastro, version 8

Comments

No comments yet.