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
}
This topic provides sample data and data models for use with the XamDataChart™ control and its Category Series or Radial Series types.
This topic contains the following sections:
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
}
In Visual Basic:
Imports System
Imports System.Collections.Generic
Imports System.Collections.ObjectModel
Imports System.ComponentModel
Imports System.Linq
Namespace Infragistics.Models
' TODO add sample data model
' TODO add sample data source
End Namespace
In C#:
public class CategoryDataPoint
{
public CategoryDataPoint() { }
public int Index { get; set; }
public string Category { get; set; }
public double Value { get; set; }
public double High { get; set; }
public double Low { get; set; }
}
In Visual Basic:
Public Class CategoryDataPoint
Public Sub New()
End Sub
Public Property Index As Int
Public Property Category As String
Public Property Value As Double
Public Property High As Double
Public Property Low As Double
End Class
In C#:
public class CategoryDataSource : List<CategoryDataPoint>
{
public CategoryDataSource()
{
this.Add(new CategoryDataPoint { Category = "A", Value = 85, Low = 80, High = 95 });
this.Add(new CategoryDataPoint { Category = "B", Value = 50, Low = 45, High = 65 });
this.Add(new CategoryDataPoint { Category = "C", Value = 75, Low = 70, High = 90 });
this.Add(new CategoryDataPoint { Category = "D", Value = 100, Low = 75, High = 95 });
this.Add(new CategoryDataPoint { Category = "E", Value = 80, Low = 65, High = 80 });
this.Add(new CategoryDataPoint { Category = "F", Value = 40, Low = 35, High = 55 });
this.Add(new CategoryDataPoint { Category = "G", Value = 80, Low = 35, High = 50 });
this.Add(new CategoryDataPoint { Category = "H", Value = 75, Low = 70, High = 90 });
this.Add(new CategoryDataPoint { Category = "I", Value = 80, Low = 65, High = 80 });
this.Add(new CategoryDataPoint { Category = "J", Value = 85, Low = 80, High = 90 });
this.Add(new CategoryDataPoint { Category = "K", Value = 50, Low = 45, High = 60 });
this.Add(new CategoryDataPoint { Category = "L", Value = 85, Low = 80, High = 90 });
this.Add(new CategoryDataPoint { Category = "M", Value = 50, Low = 45, High = 60 });
this.Add(new CategoryDataPoint { Category = "N", Value = 75, Low = 70, High = 90 });
this.Add(new CategoryDataPoint { Category = "O", Value = 100, Low = 75, High = 95 });
this.Add(new CategoryDataPoint { Category = "P", Value = 80, Low = 65, High = 80 });
this.Add(new CategoryDataPoint { Category = "Q", Value = 40, Low = 35, High = 50 });
this.Add(new CategoryDataPoint { Category = "R", Value = 80, Low = 35, High = 50 });
this.Add(new CategoryDataPoint { Category = "S", Value = 75, Low = 70, High = 90 });
this.Add(new CategoryDataPoint { Category = "T", Value = 80, Low = 65, High = 80 });
this.Add(new CategoryDataPoint { Category = "U", Value = 85, Low = 80, High = 90 });
this.Add(new CategoryDataPoint { Category = "W", Value = 50, Low = 45, High = 60 });
this.Add(new CategoryDataPoint { Category = "V", Value = 85, Low = 80, High = 90 });
this.Add(new CategoryDataPoint { Category = "X", Value = 50, Low = 45, High = 60 });
this.Add(new CategoryDataPoint { Category = "Y", Value = 75, Low = 70, High = 90 });
this.Add(new CategoryDataPoint { Category = "Z", Value = 100, Low = 75, High = 95 });
int i = 0;
foreach (CategoryDataPoint dataPoint in this)
{
dataPoint.Index = i++;
}
}
}
In Visual Basic:
Public Class CategoryDataSource Inherits List(Of CategoryDataPoint)
Public Sub New()
Me.Add(New CategoryDataPoint() With { .Category = "A", .Value = 85, .Low = 80, .High = 95 })
Me.Add(New CategoryDataPoint() With { .Category = "B", .Value = 50, .Low = 45, .High = 65 })
Me.Add(New CategoryDataPoint() With { .Category = "C", .Value = 75, .Low = 70, .High = 90 })
Me.Add(New CategoryDataPoint() With { .Category = "D", .Value = 100, .Low = 75, .High = 95 })
Me.Add(New CategoryDataPoint() With { .Category = "E", .Value = 80, .Low = 65, .High = 80 })
Me.Add(New CategoryDataPoint() With { .Category = "F", .Value = 40, .Low = 35, .High = 55 })
Me.Add(New CategoryDataPoint() With { .Category = "G", .Value = 80, .Low = 35, .High = 50 })
Me.Add(New CategoryDataPoint() With { .Category = "H", .Value = 75, .Low = 70, .High = 90 })
Me.Add(New CategoryDataPoint() With { .Category = "I", .Value = 80, .Low = 65, .High = 80 })
Me.Add(New CategoryDataPoint() With { .Category = "J", .Value = 85, .Low = 80, .High = 90 })
Me.Add(New CategoryDataPoint() With { .Category = "K", .Value = 50, .Low = 45, .High = 60 })
Me.Add(New CategoryDataPoint() With { .Category = "L", .Value = 85, .Low = 80, .High = 90 })
Me.Add(New CategoryDataPoint() With { .Category = "M", .Value = 50, .Low = 45, .High = 60 })
Me.Add(New CategoryDataPoint() With { .Category = "N", .Value = 75, .Low = 70, .High = 90 })
Me.Add(New CategoryDataPoint() With { .Category = "O", .Value = 100, .Low = 75, .High = 95 })
Me.Add(New CategoryDataPoint() With { .Category = "P", .Value = 80, .Low = 65, .High = 80 })
Me.Add(New CategoryDataPoint() With { .Category = "Q", .Value = 40, .Low = 35, .High = 50 })
Me.Add(New CategoryDataPoint() With { .Category = "R", .Value = 80, .Low = 35, .High = 50 })
Me.Add(New CategoryDataPoint() With { .Category = "S", .Value = 75, .Low = 70, .High = 90 })
Me.Add(New CategoryDataPoint() With { .Category = "T", .Value = 80, .Low = 65, .High = 80 })
Me.Add(New CategoryDataPoint() With { .Category = "U", .Value = 85, .Low = 80, .High = 90 })
Me.Add(New CategoryDataPoint() With { .Category = "W", .Value = 50, .Low = 45, .High = 60 })
Me.Add(New CategoryDataPoint() With { .Category = "V", .Value = 85, .Low = 80, .High = 90 })
Me.Add(New CategoryDataPoint() With { .Category = "X", .Value = 50, .Low = 45, .High = 60 })
Me.Add(New CategoryDataPoint() With { .Category = "Y", .Value = 75, .Low = 70, .High = 90 })
Me.Add(New CategoryDataPoint() With { .Category = "Z", .Value = 100, .Low = 75, .High = 95 })
Dim i As Integer = 0
For Each dataPoint As CategoryDataPoint In Me
dataPoint.Index = System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1)
Next
End Sub
End Class