protected void Page_Load(object sender, EventArgs e)
    {
        // Cpecify ScaleTypes
        WebChartControl1.Series[0].ArgumentScaleType = ScaleType.Qualitative;
        WebChartControl1.Series[0].ValueScaleType    = ScaleType.DateTime;
        WebChartControl1.Series[1].ArgumentScaleType = ScaleType.Qualitative;
        WebChartControl1.Series[1].ValueScaleType    = ScaleType.DateTime;
        (WebChartControl1.Series[1].Label as RangeBarSeriesLabel).Position = RangeBarLabelPosition.Inside;

        // Bound series to data
        WebChartControl1.DataSource = GanttData.CreateData();
        WebChartControl1.Series[0].ArgumentDataMember = "GanntTask";
        WebChartControl1.Series[0].ValueDataMembers.AddRange(new string[] { "GanntStart", "GanntEnd" });

        // Create argument descriptions for the summary function.
        SummaryFunctionArgumentDescription argument1Description =
            new SummaryFunctionArgumentDescription("GanntStart", ScaleType.DateTime);
        SummaryFunctionArgumentDescription argument2Description =
            new SummaryFunctionArgumentDescription("GanntEnd", ScaleType.DateTime);
        SummaryFunctionArgumentDescription argument3Description =
            new SummaryFunctionArgumentDescription("GanttPercentageComplete", ScaleType.Numerical);

        // Register the summary function in a chart.
        WebChartControl1.RegisterSummaryFunction("CalcPercentageComplete", "CalcPercentageComplete", 2,
                                                 new SummaryFunctionArgumentDescription[] { argument1Description, argument2Description, argument3Description },
                                                 CalcPercentageComplete);

        WebChartControl1.Series[1].ArgumentDataMember = "GanntTask";
        WebChartControl1.Series[1].SummaryFunction    = "CalcPercentageComplete([GanntStart], [GanntEnd], [GanttPercentageComplete])";

        // Don't forget this !:)
        WebChartControl1.DataBind();
    }
        public Form1()
        {
            InitializeComponent();

            // Create argument descriptions for the summary function.
            SummaryFunctionArgumentDescription argument1Description =
                new SummaryFunctionArgumentDescription("Price", ScaleType.Numerical);
            SummaryFunctionArgumentDescription argument2Description =
                new SummaryFunctionArgumentDescription("Count", ScaleType.Numerical);

            // Register the summary function in a chart.
            chartControl1.RegisterSummaryFunction("PRODUCT", "PRODUCT", 1,
                                                  new SummaryFunctionArgumentDescription[] { argument1Description, argument2Description },
                                                  CalcProductValue);


            // Provide a datasource for the chart.
            chartControl1.DataSource = nwindDataSet.Products;
        }