Version

Sample Bubble Data

Purpose

This topic provides sample data and data models for use with the XamDataChart™ control and its Scatter Bubble Series type.

In this topic

This topic contains the following sections:

Required Namespaces

In C#:

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;

namespace Infragistics.Models
{
  // TODO add data model
  // TODO add data source
}

Data Model

In C#:

public class BubbleDataPoint
{
    public string Label { get; set; }
    public double Radius { get; set; }
    public double X { get; set; }
    public double Y { get; set; }
}

Data Source

In C#:

public class BubbleDataSource : List<BubbleDataPoint>
{
    public static Random Rand = new Random();
    public BubbleDataSource()
    {
        int value = 50;
        for (int i = 0; i < 100; i++)
        {
            double change = Rand.NextDouble();
            if (change > .5)
            {
                value += (int)(change * 20);
            }
            else
            {
                value -= (int)(change * 20);
            }
            value %= 100;
            this.Add(new BubbleDataPoint
            {
                Label = "Item " + i.ToString(),
                Radius = Rand.Next(10, 50),
                X = Rand.Next(i, i + 5),
                Y = Rand.Next(value - 50, value + 50)
            });
        }
    }
}