Chart Labels

Winnovative control offers the possibility to customize the labels that are displayed on the X Axis and also the labels displayed in the legend. By default, the first string column in the data source is the column that will be the source of the X Axis Labels. This can be changed. Also, the labels can be loaded from an array. Same for the legend labels, Winnovative can load them from an array.

100 100 200 200 110 170 300 140 290 100 60 100 300 160 120 200 120 190

Source code

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            WebChart1.DataSource = Winnovative.DataSources.GetTestData2();
            WebChart1.LegendBox.Visible = true;
 
            // load X Axis labels from an array
            WebChart1.Labels.XAxisLabelsFromArray(new string[] { "Label 1", "Label 2", "Label 3", "Label 4", "Label 5", "Label 6" });
            
            /* // alternative method
            WebChart1.Labels.XAxisLabels.Clear();
            WebChart1.Labels.XAxisLabels.Add(new Winnovative.LabelItem("Label 1"));
            WebChart1.Labels.XAxisLabels.Add(new Winnovative.LabelItem("Label 2"));
            WebChart1.Labels.XAxisLabels.Add(new Winnovative.LabelItem("Label 3"));
            WebChart1.Labels.XAxisLabels.Add(new Winnovative.LabelItem("Label 4"));
            WebChart1.Labels.XAxisLabels.Add(new Winnovative.LabelItem("Label 5"));
            WebChart1.Labels.XAxisLabels.Add(new Winnovative.LabelItem("Label 6"));
            */
             
            // load legend labels from an array
            WebChart1.Labels.LegendLabelsFromArray(new string[] { "Legend label 1", "Legend label 2", "Legend label 3" });
 
            /* // alternative method
            WebChart1.Labels.LegendLabels.Clear();
            WebChart1.Labels.LegendLabels.Add(new Winnovative.LabelItem("Legend label 1"));
            WebChart1.Labels.LegendLabels.Add(new Winnovative.LabelItem("Legend label 2"));
            WebChart1.Labels.LegendLabels.Add(new Winnovative.LabelItem("Legend label 3"));
            */
 
            // change the default X Axis Labels database column
            //WebChart1.Labels.XAxisLabelsColumn = 1;
        }
    }