AJAX Control Toolkit Tutorial: BarChart - Part Ten

The bar chart control renders a barchart with multiple series of values. This control is compatible with any browser which supports SVG. The control has four type of bar charts namely Column, StackedColumn, Bar and StackedBar.

Let’s see its initial configuration in a page with code and its output.

  1. <ajaxToolkit:BarChart ID="BarChart1" runat="server" ChartHeight="300" ChartWidth="450" ChartType="Column" ChartTitle="United States versus European Widget Production" CategoriesAxis="2007,2008,2009,2010,2011,2012" ChartTitleColor="#0E426C" CategoryAxisLineColor="#D08AD9" ValueAxisLineColor="#D08AD9" BaseLineColor="#A156AB">  
  2.   
  3.     <Series>  
  4.   
  5.         <ajaxToolkit:BarChartSeries Name="United States" BarColor="#6C1E83" Data="110, 189, 255, 95, 107, 140" />  
  6.   
  7.         <ajaxToolkit:BarChartSeries Name="Europe" BarColor="#D08AD9" Data="49, 77, 95, 68, 70, 79" />  
  8.   
  9.     </Series>  
  10.   
  11. </ajaxToolkit:BarChart>  
Output

Output

BarChart Properties 
  • ChartHeight
    This property enables you to customize the height of the chart.

    ChartHeight="600"

    ChartHeight

  • ChartWidth
    This property enables you to customize the width of the chart.

     ChartWidth="750"

    ChartWidth

  • ChartTitle
    This property enables you to set the title of the chart.

    ChartTitle="United States versus European Widget Production"

    ChartTitle

  • CategoryAxis
    This is a required property. You need to provide a set of values for the category axis to create a bar chart.

    CategoriesAxis="2007,2008,2009,2010,2011,2012"

    CategoryAxis

  • ChartType
    This property enables you to render different types of bar charts including Column, StackedColumn, Bar, and StackedBar.

    ChartType

    Column

    Column

    Bar

    Bar
    Stacked Bar

    Stacked Bar

    Stacked Column

    Stacked Column

  • Theme
    This property enables you to control the appearance of the bar chart with a Cascading Style Sheet file.

  • ValueAxisLines
    This property enables you to set the interval size for the value axis line.

    ValueAxisLines="3"

    ValueAxisLines

  • ChartTitleColor
    This property enables you to set the font color of the chart title.

      ChartTitleColor="Green"

    ChartTitleColor

  • CategoryAxisLineColor
    This property enables you to set the color of the category axis lines.

    CategoryAxisLineColor="Green"

    CategoryAxisLineColor

  • ValueAxisLineColor
    This property enables you to set the the color of the value axis lines.

    ValueAxisLineColor="Red"

    ValueAxisLineColor

  • BaseLineColor
    This property enables you to set the color of the base lines of the chart.

    BaseLineColor="Blue"

    BaseLineColor

    BarChartSeries Properties
    1. <Series>  
    2.   
    3.     <ajaxToolkit:BarChartSeries Name="United States" BarColor="#6C1E83" Data="110, 189, 255, 95, 107, 140" />  
    4.   
    5.     <ajaxToolkit:BarChartSeries Name="Europe" BarColor="#D08AD9" Data="49, 77, 95, 68, 70, 79" />  
    6.   
    7. </Series>  
  • Name
    This property is required.

    Name="United States"

    Name

  • Data
    This property is required and provides data for a particular series.

    Data="110, 189, 255, 95, 107, 140"

    Data

  • BarColor
    This property enables you to set the color of bar for a particular series.

    BarColor="#6C1E83"

    BarColor

Up Next
    Ebook Download
    View all
    Learn
    View all