public PivotA(FFXIVLogDataSet.AnaylzedRow[] rows) { foreach (FFXIVLogDataSet.AnaylzedRow row in rows) { DataRow newrow = ds.Anaylzed.NewRow(); newrow.ItemArray = row.ItemArray; ds.Anaylzed.AddAnaylzedRow((FFXIVLogDataSet.AnaylzedRow)newrow); } Tree = new TreeElementA(); Tree.ds = ds; RowLabels = new List <string>(); Filters = new List <string>(); Expressions = new List <string>(); RowLabels.Add("From"); RowLabels.Add("ActionName"); RowLabels.Add("To"); //Expressions.Add("Sum(Numeric)"); //Expressions.Add("Count(Numeric)"); //Expressions.Add("Avg(Numeric)"); //Expressions.Add("Max(Numeric)"); //Expressions.Add("Min(Numeric)"); //Expressions.Add("Min(TotalSeconds)"); //Expressions.Add("Max(TotalSeconds)"); //めちゃくちゃやねw Tree.RowLabels = RowLabels; Tree.Expressions = Expressions; }
public PivotA(FFXIVLogDataSet.AnaylzedRow[] rows) { foreach (FFXIVLogDataSet.AnaylzedRow row in rows) { DataRow newrow = ds.Anaylzed.NewRow(); newrow.ItemArray = row.ItemArray; ds.Anaylzed.AddAnaylzedRow((FFXIVLogDataSet.AnaylzedRow) newrow); } Tree = new TreeElementA(); Tree.ds = ds; RowLabels = new List<string>(); Filters = new List<string>(); Expressions = new List<string>(); RowLabels.Add("From"); RowLabels.Add("ActionName"); RowLabels.Add("To"); //Expressions.Add("Sum(Numeric)"); //Expressions.Add("Count(Numeric)"); //Expressions.Add("Avg(Numeric)"); //Expressions.Add("Max(Numeric)"); //Expressions.Add("Min(Numeric)"); //Expressions.Add("Min(TotalSeconds)"); //Expressions.Add("Max(TotalSeconds)"); //めちゃくちゃやねw Tree.RowLabels = RowLabels; Tree.Expressions = Expressions; }
public TreeElementA AddChild(string text, string label) { TreeElementA child = new TreeElementA(this, text, label); child.Expressions = this.Expressions; child.RowLabels = this.RowLabels; ChildElements.Add(child); return(child); }
/// <summary> /// フィルタ作成 /// </summary> /// <param name="element"></param> /// <returns></returns> public string GetFilter(TreeElementA element) { List<string> filters = new List<string>(); TreeElementA parent = element; while (parent.Parent != null) { if (ds.Anaylzed.Columns[parent.Label].DataType == typeof(string)) { filters.Add(String.Format("{0} = '{1}'", RowLabels[parent.Depth - 1], parent.Text.Replace("'","''"))); } else { filters.Add(String.Format("{0} = {1}", RowLabels[parent.Depth - 1], parent.Text)); } parent = parent.Parent; } filters.AddRange(Filters.ToArray()); return String.Join(" and ", filters.ToArray()); }
/// <summary> /// フィルタ作成 /// </summary> /// <param name="element"></param> /// <returns></returns> public string GetFilter(TreeElementA element) { List <string> filters = new List <string>(); TreeElementA parent = element; while (parent.Parent != null) { if (ds.Anaylzed.Columns[parent.Label].DataType == typeof(string)) { filters.Add(String.Format("{0} = '{1}'", RowLabels[parent.Depth - 1], parent.Text.Replace("'", "''"))); } else { filters.Add(String.Format("{0} = {1}", RowLabels[parent.Depth - 1], parent.Text)); } parent = parent.Parent; } filters.AddRange(Filters.ToArray()); return(String.Join(" and ", filters.ToArray())); }
private TreeElementA(TreeElementA parent, string text, string label) { this.Text = text; this.Label = label; //高速化 string filter = GetFilter(); foreach (FFXIVLogDataSet.AnaylzedRow row in parent.ds.Anaylzed.Select(filter)) { FFXIVLogDataSet.AnaylzedRow _row = ds.Anaylzed.NewAnaylzedRow(); _row.ItemArray = row.ItemArray; ds.Anaylzed.AddAnaylzedRow(_row); } Parent = parent; DataTable = parent.DataTable; CurrentRow = DataTable.NewRow(); DataTable.Rows.Add(CurrentRow); CurrentRow["ParentID"] = parent.CurrentRow["ID"]; }
/// <summary> /// ツリーを更新する /// </summary> /// <param name="element"></param> /// <param name="label"></param> public void UpdateTree(TreeElementA element, string childElementLabel) { List <string> items = new List <string>(); string filter = GetFilter(element); foreach (FFXIVLogDataSet.AnaylzedRow row in ds.Anaylzed.Select(filter)) { string val = row[childElementLabel].ToString(); if (val != "" && !items.Contains(val)) { TreeElementA child = element.AddChild(val, childElementLabel); items.Add(val); } } foreach (TreeElementA child in element.ChildElements) { if (child.Depth < RowLabels.Count) { UpdateTree(child, RowLabels[child.Depth]); } } }
public TreeElementA AddChild(string text, string label) { TreeElementA child = new TreeElementA(this, text, label); child.Expressions = this.Expressions; child.RowLabels = this.RowLabels; ChildElements.Add(child); return child; }
private DataGridViewRow CreateNewRow(TreeElementA element) { DataGridViewRow row = new DataGridViewRow(); row.CreateCells(dataGridView1,new object[] { 0, false, element, element.report.TotalDamage,element.report.Hit,element.report.Count, element.report.HitRate,element.report.Average,element.report.Dps,element.report.TotalCure ,element.report.DotValue,element.report.CritHit,element.report.CritHitRate}); return row; }
/// <summary> /// ツリーを読み込む /// </summary> /// <param name="tree"></param> public void LoadTree(TreeElementA tree) { this.Tree = tree; foreach (TreeElementA element in Tree.ChildElements) { string text = element.Text; int depth = element.Depth; int a = dataGridView1.Rows.Add(CreateNewRow(element));//order open 行ラベル DataGridViewPlusMinusCell pmc = (DataGridViewPlusMinusCell)dataGridView1.Rows[a].Cells[2]; pmc.IsPlus = true; } UpdateDataGridView(); }
/// <summary> /// 表示順 /// </summary> /// <param name="tree"></param> private void SortNames(TreeElementA tree) { List<string> res = new List<string>(); List<string> me = new List<string>(); List<string> pet_me = new List<string>(); List<string> pt = new List<string>(); List<string> pet_pt = new List<string>(); List<string> other = new List<string>(); List<string> unknown = new List<string>(); List<string> npc = new List<string>(); foreach (TreeElementA a in tree.ChildElements) { FFXIVLogDataSet.ActorRow arow = actionReport.ds.Actor.FindByName(a.Text); if (arow == null) { unknown.Add(a.Text); } else if (arow.IsMe) { me.Add(a.Text); } else if (arow.IsMyPet) { pet_me.Add(a.Text); } else if (arow.IsPTMember) { pt.Add(a.Text); } else if (arow.IsPTPet) { pet_pt.Add(a.Text); } else if (arow.IsNPC) { npc.Add(a.Text); } else { other.Add(a.Text); } } res.AddRange(me); res.AddRange(pet_me); res.AddRange(pt); res.AddRange(pet_pt); res.AddRange(npc); res.AddRange(other); res.AddRange(unknown); tree.SortByName(res.ToArray()); }
public void Calc(TreeElementA element) { element.Calc(); }
/// <summary> /// ツリーを更新する /// </summary> /// <param name="element"></param> /// <param name="label"></param> public void UpdateTree(TreeElementA element, string childElementLabel) { List<string> items = new List<string>(); string filter = GetFilter(element); foreach (FFXIVLogDataSet.AnaylzedRow row in ds.Anaylzed.Select(filter)) { string val = row[childElementLabel].ToString(); if (val !="" && !items.Contains(val)) { TreeElementA child = element.AddChild(val, childElementLabel); items.Add(val); } } foreach (TreeElementA child in element.ChildElements) { if (child.Depth < RowLabels.Count) { UpdateTree(child,RowLabels[child.Depth]); } } }