public static Chart CompileStatChart() { PieChart chart = new PieChart("Stat Distribution", "graphs_strdexint_distrib", true); ChartItem strItem = new ChartItem("Strength", 0); ChartItem dexItem = new ChartItem("Dexterity", 0); ChartItem intItem = new ChartItem("Intelligence", 0); foreach (Mobile mob in World.Mobiles.Values) { if (mob.RawStatTotal == mob.StatCap && mob is PlayerMobile) { strItem.Value += mob.RawStr; dexItem.Value += mob.RawDex; intItem.Value += mob.RawInt; } } chart.Items.Add(strItem); chart.Items.Add(dexItem); chart.Items.Add(intItem); return(chart); }
private void RenderBarGraph(BarGraph graph, XmlWriter html) { BarGraphRenderer barGraph = new BarGraphRenderer(Color.White) { RenderMode = graph.RenderMode, _regions = graph.Regions }; barGraph.SetTitles(graph.xTitle, null); if (graph.yTitle != null) { barGraph.VerticalLabel = graph.yTitle; } barGraph.FontColor = Color.Black; barGraph.ShowData = (graph.Interval == 1); barGraph.VerticalTickCount = graph.Ticks; string[] labels = new string[graph.Items.Count]; string[] values = new string[graph.Items.Count]; for (int i = 0; i < graph.Items.Count; ++i) { ChartItem item = graph.Items[i]; labels[i] = item.Name; values[i] = item.Value.ToString(); } barGraph._interval = graph.Interval; barGraph.CollectDataPoints(labels, values); Bitmap bmp = barGraph.Draw(); string fileName = graph.FileName + ".png"; bmp.Save(Path.Combine(m_OutputDirectory, fileName), ImageFormat.Png); html.WriteValue("<!-- "); html.WriteStartElement("a"); html.WriteAttributeString("href", "#"); html.WriteAttributeString("onclick", string.Format("javascript:window.open('{0}.html','ChildWindow','width={1},height={2},resizable=no,status=no,toolbar=no')", SafeFileName(FindNameFrom(graph)), bmp.Width + 30, bmp.Height + 80)); html.WriteValue(graph.Name); html.WriteEndElement(); html.WriteValue(" -->"); html.WriteStartElement("table"); html.WriteAttributeString("cellpadding", "0"); html.WriteAttributeString("cellspacing", "0"); html.WriteAttributeString("border", "0"); html.WriteStartElement("tr"); html.WriteStartElement("td"); html.WriteAttributeString("class", "tbl-border"); html.WriteStartElement("table"); html.WriteAttributeString("width", "100%"); html.WriteAttributeString("cellpadding", "4"); html.WriteAttributeString("cellspacing", "1"); html.WriteStartElement("tr"); html.WriteStartElement("td"); html.WriteAttributeString("colspan", "10"); html.WriteAttributeString("width", "100%"); html.WriteAttributeString("align", "center"); html.WriteAttributeString("class", "header"); html.WriteValue(graph.Name); html.WriteEndElement(); html.WriteEndElement(); html.WriteStartElement("tr"); html.WriteStartElement("td"); html.WriteAttributeString("colspan", "10"); html.WriteAttributeString("width", "100%"); html.WriteAttributeString("align", "center"); html.WriteAttributeString("class", "entry"); html.WriteStartElement("img"); html.WriteAttributeString("width", bmp.Width.ToString()); html.WriteAttributeString("height", bmp.Height.ToString()); html.WriteAttributeString("src", fileName); html.WriteEndElement(); html.WriteEndElement(); html.WriteEndElement(); html.WriteEndElement(); html.WriteEndElement(); html.WriteEndElement(); html.WriteEndElement(); bmp.Dispose(); }
private void RenderPieChart(PieChart chart, XmlWriter html) { PieChartRenderer pieChart = new PieChartRenderer(Color.White) { ShowPercents = chart.ShowPercents }; string[] labels = new string[chart.Items.Count]; string[] values = new string[chart.Items.Count]; for (int i = 0; i < chart.Items.Count; ++i) { ChartItem item = chart.Items[i]; labels[i] = item.Name; values[i] = item.Value.ToString(); } pieChart.CollectDataPoints(labels, values); Bitmap bmp = pieChart.Draw(); string fileName = chart.FileName + ".png"; bmp.Save(Path.Combine(m_OutputDirectory, fileName), ImageFormat.Png); html.WriteValue("<!-- "); html.WriteValue(chart.Name); html.WriteAttributeString("href", "#"); html.WriteAttributeString("onclick", string.Format("javascript:window.open('{0}.html','ChildWindow','width={1},height={2},resizable=no,status=no,toolbar=no')", SafeFileName(FindNameFrom(chart)), bmp.Width + 30, bmp.Height + 80)); html.WriteStartElement("a"); html.WriteEndElement(); html.WriteValue(" -->"); html.WriteStartElement("table"); html.WriteAttributeString("cellpadding", "0"); html.WriteAttributeString("cellspacing", "0"); html.WriteAttributeString("border", "0"); html.WriteStartElement("tr"); html.WriteStartElement("td"); html.WriteAttributeString("class", "tbl-border"); html.WriteStartElement("table"); html.WriteAttributeString("width", "100%"); html.WriteAttributeString("cellpadding", "4"); html.WriteAttributeString("cellspacing", "1"); html.WriteStartElement("tr"); html.WriteStartElement("td"); html.WriteAttributeString("colspan", "10"); html.WriteAttributeString("width", "100%"); html.WriteAttributeString("align", "center"); html.WriteAttributeString("class", "header"); html.WriteValue(chart.Name); html.WriteEndElement(); html.WriteEndElement(); html.WriteStartElement("tr"); html.WriteStartElement("td"); html.WriteAttributeString("colspan", "10"); html.WriteAttributeString("width", "100%"); html.WriteAttributeString("align", "center"); html.WriteAttributeString("class", "entry"); html.WriteStartElement("img"); html.WriteAttributeString("width", bmp.Width.ToString()); html.WriteAttributeString("height", bmp.Height.ToString()); html.WriteAttributeString("src", fileName); html.WriteEndElement(); html.WriteEndElement(); html.WriteEndElement(); html.WriteEndElement(); html.WriteEndElement(); html.WriteEndElement(); html.WriteEndElement(); bmp.Dispose(); }
/// <summary> /// Insert a Server.Engines.Reports.ChartItem instance into this collection at a specified index. /// </summary> /// <param name="index">Zero-based index.</param> /// <param name="value">The Server.Engines.Reports.ChartItem instance to insert.</param> public void Insert(int index, ChartItem value) { List.Insert(index, value); }
/// <summary> /// Append a Server.Engines.Reports.ChartItem entry to this collection. /// </summary> /// <param name="value">Server.Engines.Reports.ChartItem instance.</param> /// <returns>The position into which the new element was inserted.</returns> public int Add(ChartItem value) { return(List.Add(value)); }
public static Chart CompileStatChart() { PieChart chart = new PieChart( "Stat Distribution", "graphs_strdexint_distrib", true ); ChartItem strItem = new ChartItem( "Strength", 0 ); ChartItem dexItem = new ChartItem( "Dexterity", 0 ); ChartItem intItem = new ChartItem( "Intelligence", 0 ); foreach ( Mobile mob in World.Mobiles.Values ) { if ( mob.RawStatTotal == mob.StatCap && mob is PlayerMobile ) { strItem.Value += mob.RawStr; dexItem.Value += mob.RawDex; intItem.Value += mob.RawInt; } } chart.Items.Add( strItem ); chart.Items.Add( dexItem ); chart.Items.Add( intItem ); return chart; }
private void RenderBarGraph(BarGraph graph, HtmlTextWriter html) { BarGraphRenderer barGraph = new BarGraphRenderer(Color.White); barGraph.RenderMode = graph.RenderMode; barGraph._regions = graph.Regions; barGraph.SetTitles(graph.xTitle, null); if (graph.yTitle != null) { barGraph.VerticalLabel = graph.yTitle; } barGraph.FontColor = Color.Black; barGraph.ShowData = (graph.Interval == 1); barGraph.VerticalTickCount = graph.Ticks; string[] labels = new string[graph.Items.Count]; string[] values = new string[graph.Items.Count]; for (int i = 0; i < graph.Items.Count; ++i) { ChartItem item = graph.Items[i]; labels[i] = item.Name; values[i] = item.Value.ToString(); } barGraph._interval = graph.Interval; barGraph.CollectDataPoints(labels, values); Bitmap bmp = barGraph.Draw(); string fileName = graph.FileName + ".png"; bmp.Save(Path.Combine(this.m_OutputDirectory, fileName), ImageFormat.Png); html.Write("<!-- "); html.AddAttribute(HtmlAttr.Href, "#"); html.AddAttribute(HtmlAttr.Onclick, String.Format("javascript:window.open('{0}.html','ChildWindow','width={1},height={2},resizable=no,status=no,toolbar=no')", SafeFileName(this.FindNameFrom(graph)), bmp.Width + 30, bmp.Height + 80)); html.RenderBeginTag(HtmlTag.A); html.Write(graph.Name); html.RenderEndTag(); html.Write(" -->"); html.AddAttribute(HtmlAttr.Cellpadding, "0"); html.AddAttribute(HtmlAttr.Cellspacing, "0"); html.AddAttribute(HtmlAttr.Border, "0"); html.RenderBeginTag(HtmlTag.Table); html.RenderBeginTag(HtmlTag.Tr); html.AddAttribute(HtmlAttr.Class, "tbl-border"); html.RenderBeginTag(HtmlTag.Td); html.AddAttribute(HtmlAttr.Width, "100%"); html.AddAttribute(HtmlAttr.Cellpadding, "4"); html.AddAttribute(HtmlAttr.Cellspacing, "1"); html.RenderBeginTag(HtmlTag.Table); html.RenderBeginTag(HtmlTag.Tr); html.AddAttribute(HtmlAttr.Colspan, "10"); html.AddAttribute(HtmlAttr.Width, "100%"); html.AddAttribute(HtmlAttr.Align, "center"); html.AddAttribute(HtmlAttr.Class, "header"); html.RenderBeginTag(HtmlTag.Td); html.Write(graph.Name); html.RenderEndTag(); html.RenderEndTag(); html.RenderBeginTag(HtmlTag.Tr); html.AddAttribute(HtmlAttr.Colspan, "10"); html.AddAttribute(HtmlAttr.Width, "100%"); html.AddAttribute(HtmlAttr.Align, "center"); html.AddAttribute(HtmlAttr.Class, "entry"); html.RenderBeginTag(HtmlTag.Td); html.AddAttribute(HtmlAttr.Width, bmp.Width.ToString()); html.AddAttribute(HtmlAttr.Height, bmp.Height.ToString()); html.AddAttribute(HtmlAttr.Src, fileName); html.RenderBeginTag(HtmlTag.Img); html.RenderEndTag(); html.RenderEndTag(); html.RenderEndTag(); html.RenderEndTag(); html.RenderEndTag(); html.RenderEndTag(); html.RenderEndTag(); bmp.Dispose(); }
public static Chart CompileRaceChart() { PieChart chart = new PieChart("Race Distribution", "graphs_race_distrib", true); ChartItem humanItem = new ChartItem("Humans", 0); ChartItem elfItem = new ChartItem("Elves", 0); ChartItem dwarfItem = new ChartItem("Dwarves", 0); ChartItem drowItem = new ChartItem("Drow", 0); ChartItem orcItem = new ChartItem("Orcs", 0); ChartItem gnomeItem = new ChartItem("Gnomes", 0); ChartItem gobItem = new ChartItem("Goblins", 0); ChartItem frostItem = new ChartItem("Frostling", 0); foreach (Mobile mob in World.Mobiles.Values) { if (mob != null && mob is TeiravonMobile) { TeiravonMobile tav = mob as TeiravonMobile; Account acct = (Account)tav.Account; if ((acct.LastLogin + TimeSpan.FromDays(30.0)) < DateTime.Now) { continue; } if (tav.IsHuman()) { humanItem.Value++; } else if (tav.IsElf()) { elfItem.Value++; } else if (tav.IsDwarf()) { dwarfItem.Value++; } else if (tav.IsDrow()) { drowItem.Value++; } else if (tav.IsOrc()) { orcItem.Value++; } else if (tav.IsGnome()) { gnomeItem.Value++; } else if (tav.IsGoblin()) { gobItem.Value++; } else if (tav.IsFrostling()) { frostItem.Value++; } } } chart.Items.Add(humanItem); chart.Items.Add(elfItem); chart.Items.Add(dwarfItem); chart.Items.Add(drowItem); chart.Items.Add(orcItem); chart.Items.Add(gnomeItem); chart.Items.Add(gobItem); chart.Items.Add(frostItem); return(chart); }
/// <summary> /// Advances the enumerator to the next queue of the enumeration, if one is currently available. /// </summary> /// <returns>true, if the enumerator was succesfully advanced to the next queue; false, if the enumerator has reached the end of the enumeration.</returns> public bool MoveNext() { if ((_index < (_collection.Count - 1))) { _index = (_index + 1); _currentElement = _collection[_index]; return true; } _index = _collection.Count; return false; }
/// <summary> /// Reset the cursor, so it points to the beginning of the enumerator. /// </summary> public void Reset() { _index = -1; _currentElement = null; }
/// <summary> /// Removes a specified Server.Engines.Reports.ChartItem instance from this collection. /// </summary> /// <param name="value">The Server.Engines.Reports.ChartItem instance to remove.</param> public void Remove(ChartItem value) { List.Remove(value); }
/// <summary> /// Retrieve the index a specified Server.Engines.Reports.ChartItem instance is in this collection. /// </summary> /// <param name="value">Server.Engines.Reports.ChartItem instance to find.</param> /// <returns>The zero-based index of the specified Server.Engines.Reports.ChartItem instance. If the object is not found, the return value is -1.</returns> public int IndexOf(ChartItem value) { return(List.IndexOf(value)); }
/// <summary> /// Determines whether a specified Server.Engines.Reports.ChartItem instance is in this collection. /// </summary> /// <param name="value">Server.Engines.Reports.ChartItem instance to search for.</param> /// <returns>True if the Server.Engines.Reports.ChartItem instance is in the collection; otherwise false.</returns> public bool Contains(ChartItem value) { return(List.Contains(value)); }
public static Chart CompileStatChart() { /* * PieChart chart = new PieChart( "Stat Distribution", "graphs_strdexint_distrib", true ); * * ChartItem strItem = new ChartItem( "Strength", 0 ); * ChartItem dexItem = new ChartItem( "Dexterity", 0 ); * ChartItem intItem = new ChartItem( "Intelligence", 0 ); * * foreach ( Mobile mob in World.Mobiles.Values ) * { * if ( mob.RawStatTotal == mob.StatCap && mob is PlayerMobile ) * { * strItem.Value += mob.RawStr; * dexItem.Value += mob.RawDex; * intItem.Value += mob.RawInt; * } * } * * chart.Items.Add( strItem ); * chart.Items.Add( dexItem ); * chart.Items.Add( intItem ); */ PieChart chart = new PieChart("Class Distribution", "graphs_class_distrib", true); ChartItem fightItem = new ChartItem("Fighters", 0); ChartItem rogueItem = new ChartItem("Rogues", 0); ChartItem mageItem = new ChartItem("Mages", 0); ChartItem clericItem = new ChartItem("Clerics", 0); ChartItem rangerItem = new ChartItem("Rangers", 0); ChartItem druidItem = new ChartItem("Druids", 0); ChartItem barbItem = new ChartItem("Barbarians", 0); ChartItem crafterItem = new ChartItem("Crafters", 0); ChartItem advItem = new ChartItem("Advanced", 0); foreach (Mobile mob in World.Mobiles.Values) { if (mob != null && mob is TeiravonMobile) { TeiravonMobile tav = mob as TeiravonMobile; Account acct = (Account)tav.Account; if ((acct.LastLogin + TimeSpan.FromDays(90.0)) < DateTime.Now) { continue; } if (tav.IsFighter() || tav.IsCavalier() || tav.IsMonk()) { fightItem.Value++; } else if (tav.IsThief() || tav.IsAssassin() || tav.IsBard()) { rogueItem.Value++; } else if (tav.IsMage()) { mageItem.Value++; } else if (tav.IsCleric() || tav.IsDarkCleric()) { clericItem.Value++; } else if (tav.IsArcher() || tav.IsMageSlayer() || tav.IsRanger()) { rangerItem.Value++; } else if (tav.IsForester() || tav.IsShapeshifter()) { druidItem.Value++; } else if (tav.IsBerserker() || tav.IsDragoon()) { barbItem.Value++; } else if (tav.IsCrafter()) { crafterItem.Value++; } else { advItem.Value++; } } } chart.Items.Add(fightItem); chart.Items.Add(rogueItem); chart.Items.Add(mageItem); chart.Items.Add(clericItem); chart.Items.Add(rangerItem); chart.Items.Add(druidItem); chart.Items.Add(barbItem); chart.Items.Add(crafterItem); chart.Items.Add(advItem); return(chart); }
public static Chart CompileFaithChart() { PieChart chart = new PieChart("Faith Distribution", "graphs_faith_distrib", true); ChartItem AdaliaItem = new ChartItem("Adalian", 0); ChartItem TalathasItem = new ChartItem("Talathasian", 0); ChartItem KamaliniaItem = new ChartItem("Kamalinian", 0); //ChartItem NarindunItem = new ChartItem("Naridian", 0); ChartItem KinarugiItem = new ChartItem("KiNaRugian", 0); ChartItem SaerinItem = new ChartItem("Saerinian", 0); ChartItem LlothItem = new ChartItem("Llothian", 0); ChartItem GruumshItem = new ChartItem("Gruumshian", 0); ChartItem ValarItem = new ChartItem("Valarian", 0); ChartItem gobItem = new ChartItem("Goblinite", 0); //ChartItem OccItem = new ChartItem("Occidian", 0); ChartItem CultItem = new ChartItem("Cultist", 0); foreach (Mobile mob in World.Mobiles.Values) { if (mob != null && mob is TeiravonMobile) { TeiravonMobile tav = mob as TeiravonMobile; Account acct = (Account)tav.Account; if ((acct.LastLogin + TimeSpan.FromDays(90.0)) < DateTime.Now) { continue; } if (tav.Faith == TeiravonMobile.Deity.Adalia) { AdaliaItem.Value++; } else if (tav.Faith == TeiravonMobile.Deity.Talathas) { TalathasItem.Value++; } else if (tav.Faith == TeiravonMobile.Deity.Kamalini) { KamaliniaItem.Value++; } else if (tav.Faith == TeiravonMobile.Deity.Kinarugi) { KinarugiItem.Value++; } else if (tav.Faith == TeiravonMobile.Deity.Valar) { ValarItem.Value++; } else if (tav.Faith == TeiravonMobile.Deity.Saerin) { SaerinItem.Value++; } else if (tav.Faith == TeiravonMobile.Deity.Lloth) { LlothItem.Value++; } else if (tav.Faith == TeiravonMobile.Deity.Gruumsh) { GruumshItem.Value++; } else if (tav.Faith == TeiravonMobile.Deity.Jareth) { gobItem.Value++; } else if (tav.Faith == TeiravonMobile.Deity.Cultist) { CultItem.Value++; } } } chart.Items.Add(AdaliaItem); chart.Items.Add(TalathasItem); chart.Items.Add(KamaliniaItem); chart.Items.Add(KinarugiItem); chart.Items.Add(SaerinItem); chart.Items.Add(LlothItem); chart.Items.Add(GruumshItem); chart.Items.Add(ValarItem); chart.Items.Add(gobItem); chart.Items.Add(CultItem); return(chart); }
/// <summary> /// Append a Server.Engines.Reports.ChartItem entry to this collection. /// </summary> /// <param name="value">Server.Engines.Reports.ChartItem instance.</param> /// <returns>The position into which the new element was inserted.</returns> public int Add(ChartItem value) { return List.Add(value); }
private void RenderPieChart(PieChart chart, HtmlTextWriter html) { PieChartRenderer pieChart = new PieChartRenderer(Color.White); pieChart.ShowPercents = chart.ShowPercents; string[] labels = new string[chart.Items.Count]; string[] values = new string[chart.Items.Count]; for (int i = 0; i < chart.Items.Count; ++i) { ChartItem item = chart.Items[i]; labels[i] = item.Name; values[i] = item.Value.ToString(); } pieChart.CollectDataPoints(labels, values); Bitmap bmp = pieChart.Draw(); string fileName = chart.FileName + ".png"; bmp.Save(Path.Combine(this.m_OutputDirectory, fileName), ImageFormat.Png); html.Write("<!-- "); html.AddAttribute(HtmlAttr.Href, "#"); html.AddAttribute(HtmlAttr.Onclick, String.Format("javascript:window.open('{0}.html','ChildWindow','width={1},height={2},resizable=no,status=no,toolbar=no')", SafeFileName(this.FindNameFrom(chart)), bmp.Width + 30, bmp.Height + 80)); html.RenderBeginTag(HtmlTag.A); html.Write(chart.Name); html.RenderEndTag(); html.Write(" -->"); html.AddAttribute(HtmlAttr.Cellpadding, "0"); html.AddAttribute(HtmlAttr.Cellspacing, "0"); html.AddAttribute(HtmlAttr.Border, "0"); html.RenderBeginTag(HtmlTag.Table); html.RenderBeginTag(HtmlTag.Tr); html.AddAttribute(HtmlAttr.Class, "tbl-border"); html.RenderBeginTag(HtmlTag.Td); html.AddAttribute(HtmlAttr.Width, "100%"); html.AddAttribute(HtmlAttr.Cellpadding, "4"); html.AddAttribute(HtmlAttr.Cellspacing, "1"); html.RenderBeginTag(HtmlTag.Table); html.RenderBeginTag(HtmlTag.Tr); html.AddAttribute(HtmlAttr.Colspan, "10"); html.AddAttribute(HtmlAttr.Width, "100%"); html.AddAttribute(HtmlAttr.Align, "center"); html.AddAttribute(HtmlAttr.Class, "header"); html.RenderBeginTag(HtmlTag.Td); html.Write(chart.Name); html.RenderEndTag(); html.RenderEndTag(); html.RenderBeginTag(HtmlTag.Tr); html.AddAttribute(HtmlAttr.Colspan, "10"); html.AddAttribute(HtmlAttr.Width, "100%"); html.AddAttribute(HtmlAttr.Align, "center"); html.AddAttribute(HtmlAttr.Class, "entry"); html.RenderBeginTag(HtmlTag.Td); html.AddAttribute(HtmlAttr.Width, bmp.Width.ToString()); html.AddAttribute(HtmlAttr.Height, bmp.Height.ToString()); html.AddAttribute(HtmlAttr.Src, fileName); html.RenderBeginTag(HtmlTag.Img); html.RenderEndTag(); html.RenderEndTag(); html.RenderEndTag(); html.RenderEndTag(); html.RenderEndTag(); html.RenderEndTag(); html.RenderEndTag(); bmp.Dispose(); }
/// <summary> /// Determines whether a specified Server.Engines.Reports.ChartItem instance is in this collection. /// </summary> /// <param name="value">Server.Engines.Reports.ChartItem instance to search for.</param> /// <returns>True if the Server.Engines.Reports.ChartItem instance is in the collection; otherwise false.</returns> public bool Contains(ChartItem value) { return List.Contains(value); }
private static Chart CompilePCByDL() { BarGraph chart = new BarGraph("Player Count By Dueling Level", "graphs_pc_by_dl", 5, "Dueling Level", "Players", BarGraphRenderMode.Bars); int lastLevel = -1; ChartItem lastItem = null; Ladder ladder = Ladder.Instance; if (ladder != null) { ArrayList entries = ladder.ToArrayList(); for (int i = entries.Count - 1; i >= 0; --i) { LadderEntry entry = (LadderEntry)entries[i]; int level = Ladder.GetLevel(entry.Experience); if (lastItem == null || level != lastLevel) { chart.Items.Add(lastItem = new ChartItem(level.ToString(), 1)); lastLevel = level; } else { lastItem.Value++; } } } return chart; }
/// <summary> /// Retrieve the index a specified Server.Engines.Reports.ChartItem instance is in this collection. /// </summary> /// <param name="value">Server.Engines.Reports.ChartItem instance to find.</param> /// <returns>The zero-based index of the specified Server.Engines.Reports.ChartItem instance. If the object is not found, the return value is -1.</returns> public int IndexOf(ChartItem value) { return List.IndexOf(value); }