Collection

Winnovative control can display data from a collection.

25500 32000 26000 36000 31000 28000

Source code

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            WebChart1.DataSource = Winnovative.DataSources.GetTestCollection();
 
            WebChart1.Titles.Top.Visible = true;
            WebChart1.Titles.Top.Text = "Salary chart";
 
        }
    }
 
    /// <summary>
    /// This method returns a sample collection with test data
    /// The collection has the elements with the following fields:
    /// - Name (string)
    /// - Salary (number)
    /// </summary>
    public static List<Employee> GetTestCollection()
    {
        List<Employee> col = new List<Employee>(); 
        col.Add(new Employee("John", 25500)); 
        col.Add(new Employee("Terry", 32000));
        col.Add(new Employee("Anna", 26000));
        col.Add(new Employee("Tom", 36000));
        col.Add(new Employee("Jane", 31000));
        col.Add(new Employee("Smith", 28000));
 
        return col;
    }
 
 
public class Employee
{
    private string name;
    private double salary;
 
    public string Name
    {
        get { return name; }
        set { name = value; }
    }
 
    public double Salary
    {
        get { return salary; }
        set { salary = value; }
    }
 
    public Employee(string name, double salary)
    {
        this.name = name;
        this.salary = salary;
    }
}