⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chart.cs

📁 三层架构的.net源码三层架构的.net源码
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;

namespace MyStarterKit.TimeTracker.Chart
{
	/// <summary>
	/// Chart 的摘要说明。
	/// 图表抽象类
	/// </summary>
	abstract public class Chart
	{
		private const int _colorLimit = 12;

		private Color[] _color = 
			{ 
				Color.Chocolate,
				Color.YellowGreen,
				Color.Olive,
				Color.DarkKhaki,
				Color.Sienna,
				Color.PaleGoldenrod,
				Color.Peru,
				Color.Tan,
				Color.Khaki,
				Color.DarkGoldenrod,
				Color.Maroon,
				Color.OliveDrab
			};

		// Represent collection of all data points for the chart
		private ChartItemsCollection _dataPoints = new ChartItemsCollection();  

		// The implementation of this method is provided by derived classes
		public abstract Bitmap Draw();	

		public ChartItemsCollection DataPoints
		{
			get{ return _dataPoints; }
			set{ _dataPoints = value; }
		}

		public void SetColor(int index, Color NewColor)
		{
			if (index < _colorLimit) 
			{
				_color[index] = NewColor;
			}
			else
			{
				throw new Exception("Color Limit is " + _colorLimit);
			}
		}

		public Color GetColor(int index)
		{
			if (index < _colorLimit) 
			{
				return _color[index];
			}
			else
			{
				throw new Exception("Color Limit is " + _colorLimit);
			}
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -