public void AddHistogram(string path) { int barX = 100; int barY = 30; int textX = barX - 60; int textY = barY + 12; int maxWidth = 200; int barHeight = 12; int verticalGap = 4; BucketSet bucketSet = m_logData.m_bucketSets[path]; if (bucketSet is TimeBucketSet) { for (int i = 0; i < bucketSet.m_buckets.Count; i++) { TimeBucket bucket = bucketSet.m_buckets[i] as TimeBucket; m_page.content += "context.fillStyle = \"rgb(255,0,0)\";\n"; m_page.content += string.Format("context.fillRect({0}, {1}, {2}, {3});\n", barX, barY, (bucket.m_timePercent / 100.0f) * maxWidth, barHeight); m_page.content += "context.fillStyle = \"rgb(0,0,0)\";\n"; m_page.content += string.Format("context.fillText(\"{0}\", {1}, {2});\n", bucket.RangeDescription, textX, textY); barY += barHeight + verticalGap; textY += barHeight + verticalGap; } } }
void AddBucketListTabPage(string name, BucketSet bucketSet) { TabPage tabPage = new TabPage(name); tabPage.Name = name; tabPage.Controls.Add(new BucketListView(bucketSet)); bucketsTabControl.TabPages.Add(tabPage); }
private void CreateHeaders(BucketSet bucketSet, int colHeaderWidth) { m_columnProperties = new List <PropertyInfo>(); foreach (var pi in EnumColumns(bucketSet)) { var descAttr = GetFirstAttribute(pi, typeof(DescriptionAttribute), true); string desc = descAttr != null ? ((DescriptionAttribute)descAttr).Description : pi.Name; Columns.Add(LogControl.CreateColumnHeader(desc, colHeaderWidth)); m_columnProperties.Add(pi); } }
private int CountHeaders(BucketSet bucketSet) { int numHeaders = 0; foreach (var pi in EnumColumns(bucketSet)) { ++numHeaders; } return(numHeaders); }
public void AddBucketsTable(string path) { BucketSet bucketSet = m_logData.m_bucketSets[path]; if (bucketSet is TimeBucketSet) { m_page.content += "|| Range || % of time || cumulative % ||\n"; for (int i = 0; i < bucketSet.m_buckets.Count; i++) { TimeBucket bucket = bucketSet.m_buckets[i] as TimeBucket; m_page.content += string.Format("| {0} | {1:n2}% | {2:n2}% |\n", bucket.RangeDescription, bucket.m_timePercent, bucket.m_timePercentCumulative); } } }
private IEnumerable <PropertyInfo> EnumColumns(BucketSet bset) { if (bset.m_buckets.Count > 0) { Type bucketType = bset.m_buckets[0].GetType(); // Assuming that all buckets have the same type.. foreach (PropertyInfo prop in bucketType.GetProperties()) { // Ensure it's browseable var ba = GetFirstAttribute(prop, typeof(BrowsableAttribute), true); bool isBrowseable = (ba != null) ? ((BrowsableAttribute)ba).Browsable : true; if (isBrowseable) { yield return(prop); } } } }
public BucketListView(BucketSet bucketSet) { InitializeComponent(); View = View.Details; Dock = DockStyle.Fill; GridLines = true; FullRowSelect = true; VirtualMode = true; VirtualListSize = bucketSet.m_buckets.Count; RetrieveVirtualItem += new RetrieveVirtualItemEventHandler(bucketsListView_RetrieveVirtualItem); CacheVirtualItems += new CacheVirtualItemsEventHandler(bucketsListView_CacheVirtualItems); StatoscopeForm.SetDoubleBuffered(this); int numColHeaders = CountHeaders(bucketSet); int colHeaderWidth = Math.Max(50, (Width) / numColHeaders); Columns.Add(LogControl.CreateColumnHeader("Bucket", colHeaderWidth)); CreateHeaders(bucketSet, colHeaderWidth); m_bucketSet = bucketSet; m_lviCache = new List <ListViewItem>(bucketSet.m_buckets.Count); UpdateLviCache(); }