Exemplo n.º 1
0
			private Image GetBarGraph()
			{
				RandomUtil ru = new RandomUtil();
				BarGraph bg = new BarGraph(this.Size);

				bg.Color = Color.White;
				bg.ColorGradient = Color.Orange;

				Legend legend = new Legend(this.Width, 70);

				legend.Text = String.Empty;
				bg.Text = _displayString + " Total: " + _totalComponents.ToString();

				ICollection keys = _componentInfoTable.Keys;
				IEnumerator ie = keys.GetEnumerator();

				while (ie.MoveNext())
				{
					Type key = (Type)ie.Current;
					ComponentInfo ci = (ComponentInfo)_componentInfoTable[key];
					BarSlice bs = new BarSlice(ci.Count, ci.Color);

					bg.BarSliceCollection.Add(bs);

					LegendEntry le = new LegendEntry(ci.Color, ci.Type.Name.ToString().Trim());

					legend.LegendEntryCollection.Add(le);
				}

				return GraphRenderer.DrawGraphAndLegend(bg, legend, this.Size);
			}
Exemplo n.º 2
0
			private void UpdateTable(Type type)
			{
				if (_componentInfoTable[type] == null)
				{
					ComponentInfo ci = new ComponentInfo();
					RandomUtil ru = new RandomUtil();

					ci.Type = type;
					ci.Color = ru.GetColor();
					ci.Count = 1;
					_componentInfoTable.Add(type, ci);
					_totalComponents++;
				}
				else
				{
					ComponentInfo ci = (ComponentInfo)_componentInfoTable[type];
					_componentInfoTable.Remove(type);
					ci.Count++;
					_componentInfoTable.Add(type, ci);
				}
			}