|
using System.Collections;
using System.Collections.Generic;
namespace ActiveMVC
{
public class SimplePieChartData : IEnumerable<double>
{
private readonly List<double> _items;
public SimplePieChartData()
{
_items = new List<double>();
Total = 0;
}
public void Remove(double value)
{
_items.Remove(value);
Total -= value;
}
public void Clear()
{
Total = 0;
_items.Clear();
}
public void Add(double value)
{
_items.Add(value);
Total += value;
}
internal void Add(double value, bool isActive)
{
if (isActive) ActiveItemIndex = Count;
Add(value);
}
public double this[int index]
{
get { return _items[index]; }
}
IEnumerator<double> IEnumerable<double>.GetEnumerator()
{
return _items.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return _items.GetEnumerator();
}
public double Total { get; private set; }
public int Count { get { return _items.Count; } }
public int ActiveItemIndex { get; private set; }
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.