Single Series Chart, adding data manually.

In your ASPX page you simply need to add a FChart control. It just acts as a place holder for the chart.
Here you’ll also define the width and height of your chart.

<%@ Register Assembly="Libero.FusionCharts" Namespace="Libero.FusionCharts.Control" TagPrefix="fcl" %> 

 <fcl:FChart runat="server" ID="chtTopSalles" Width="530" Height="300" />

 

In your code behind you will define:
  • The type of chart you want (see supported charts).
  • All appearence properties, as backgroung color, titles, and so on.
  • And the main part, the data.

 

// Create a chart of the type you want
Column3DChart oChart = new Column3DChart();

// Set properties
oChart.Background.BgColor = "ffffff";
oChart.ChartTitles.Caption = "Top seller";
oChart.ChartTitles.SubCaption = "November";

// Set a template
oChart.Template = new Libero.FusionCharts.Template.OfficeTemplate();

// Set data for a Single Series chart
foreach (Sales s in GetSales())
{
    oChart.Set.Add(new SSSetElement { Name = s.SalesmanName, Value = s.TotalSold, ShowName = true });
}

// Add trend lines
oChart.TrendLines.Add(new TrendLineElement 
    { StartValue = 500, EndValue = 510, Color = "00FF00", DisplayValue = "Very good" }
);
oChart.TrendLines.Add(new TrendLineElement 
    { StartValue = 200, EndValue = 210, Color = "FF0000", DisplayValue = "Very bad" }
);
 
// Link the WebControl and the Chart
chtTopSalles.ShowChart(oChart);


Last edited Nov 25, 2010 at 2:00 PM by robertobarbedo, version 6

Comments

elcuba Aug 8, 2012 at 7:09 AM 
how I can remove the decimal values?
something like 150.00 => 150

thanks!