Skip Navigation Links   |  Contact  

Make payments with PayPal - it's fast, free and secure!
WebChartLogo

Sample of using DataLabels


This sample shows:
This is how the chart looks like, just copy/paste the code into notepad and save it as .aspx:
Sample

C# Code

<%@ Page Language="C#" %>
<%@ Register TagPrefix="web" Assembly="WebChart" Namespace="WebChart" %>
<script runat=server>
 
public void Page_Load(object o, EventArgs e) {
    ColumnChart chart = new ColumnChart();
    chart.Data.Add(new ChartPoint("January", 123));
    chart.Data.Add(new ChartPoint("February", 12));
    chart.Data.Add(new ChartPoint("March", 33));
    chart.Data.Add(new ChartPoint("April", 54));
 
    chart.DataLabels.Visible=true;
    chart.MaxColumnWidth = 40;
    chartcontrol.Charts.Add(chart);

    chart.Fill.Color=System.Drawing.Color.Red;
 
    chartcontrol.RedrawChart();
}
</script>
<html>
<head />
<body>
<web:chartcontrol
    BorderStyle="Outset"
    ChartTitle-Text="My Simple Chart"
    ChartPadding=30
    YCustomEnd=200
    HasChartLegend=false
    id=chartcontrol
    runat=server>
</web:chartcontrol>
</body>
</html>

Carlos Aguilar Mares © 2008