Highcharts .Net (with vb sample)

Highcharts .Net is a charts library written in pure javascript, offering an easy way to add complex charts to your Web application. Highcharts .Net encapsulates the Highcharts API on ASP.net controls making it easier to use.

Project page at codeplex: http://highcharts.codeplex.com

You can see some Highcharts.Net examples at this link: http://highcharts.paulovich.com.br/

Install:

After download the newest release, add it as reference on your web application, and then add it to the page controls on your web.config:

<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
<controls>
<add tagPrefix="highchart" namespace="Highchart.UI" assembly="Highchart"/>
</controls>
</pages>

After that, you only need to import the jQuery script.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>

it’s ready to use 😉

aspx:

 

<highchart:columnchart id="hcVendas" width="600" height="400" runat="server"></highchart:columnchart>

VB Sample:



Imports Highchart.Core
Partial Class Teste01
Inherits System.Web.UI.Page

Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load

'Eixo Y--------------------------------------------------------------------------
Dim YItem As New YAxisItem
With YItem
Dim tituloY As New Highchart.Core.Title(&quot;EIXO Y&quot;)
YItem.title = tituloY
hcVendas.YAxis.Add(YItem)
End With

'Eixo X--------------------------------------------------------------------------
Dim XItem As New XAxisItem
With XItem
Dim tituloX As New Highchart.Core.Title(&quot;EIXO X&quot;)
XItem.title = tituloX
Dim categorias As Array = {&quot;1994&quot;, &quot;1995&quot;, &quot;1996&quot;, &quot;1997&quot;, &quot;1998&quot;, &quot;1999&quot;, &quot;2000&quot;, &quot;2001&quot;, &quot;2002&quot;}
XItem.categories = categorias
hcVendas.XAxis.Add(XItem)
End With

'New data collection -------------------------------------------------------------
Dim series As New Highchart.Core.SerieCollection

Dim serie1 As New Highchart.Core.Data.Chart.Serie
serie1.data = {400, 435, 446, 479, 554, 634, 687, 750, 831}
serie1.type = RenderType.line
serie1.name = &quot;name of  serie 1&quot;
'serie1.color = &quot;khaki&quot;
series.Add(serie1)

Dim serie2 As New Highchart.Core.Data.Chart.Serie
serie2.data = {500, 200, 250, 300, 450, 400, 600, 150, 200}
serie2.type = RenderType.areaspline
serie2.name = &quot;name of  serie 2&quot;
series.Add(serie2)

'bind
hcVendas.DataSource = series
hcVendas.DataBind()

End Sub
End Class

Deixe um comentário

O seu endereço de email não será publicado. Campos obrigatórios marcados com *