What data visualization control is used to present results in LINQPad?

What data visualization control is used to present results in LINQPad ? Or is there an alternative for displaying hierarchical data in .NET?

+4
source share
2 answers

LINQPad uses the WebBrowser element to display a dynamically generated HTML page. You can even view its source code by right-clicking on the results window. So this is basically an Internet Explorer shell. Regarding HTML generation, it uses a custom XhtmlFormatter to visit the graph of objects and emits XHTML based on XDocument.

+4
source

LINQPad can also call all the old Dundas configuration controls that come with Windows Forms. Just dump any Bitmap object, and LINQPad dutifully displays it in HTML. Try the following: make sure you have System.Drawing , System.Windows.Forms and System.Windows.Forms.DataVisualization , in your F4 links, paste and press F5 . It also works with higher-level SHO diagrams that have been adapted for IronPython , but work fine with C #.

 // Almost the smallest meaningful example of Charting void Main() { // Chart must have a chart area, but it not externally referenced later var chartArea1 = new ChartArea(); var chart1 = new Chart(); chart1.ChartAreas.Add(chartArea1); var series1 = new Series(); // The following goes beyond the minimal, but just a little. You can delete these two lines. // Fun to set the series ChartType; default is column chart series1.ChartType = SeriesChartType.Pie; series1.CustomProperties = "LabelsRadialLineSize=1, PieDrawingStyle=Concave, LabelStyle=outside"; var r = new Random(Guid.NewGuid().GetHashCode()); var ys = Enumerable.Range(0, 5).Select (e => r.NextDouble()).Dump("Doubles"); var xs = Enumerable.Range(0, 5).Select (e => GetRandomString(3).ToUpper()).Dump("Strings"); series1.Points.DataBindXY(xs.ToArray(), ys.ToArray()); chart1.Series.Add(series1); var b = new Bitmap(width: chart1.Width, height: chart1.Height); chart1.DrawToBitmap(b, chart1.Bounds); b.Dump(); var frm = new Form(); // Seems 300 x 300 is the default chart-area size and chart size, so set the form to hold it frm.ClientSize = new Size(width: 300, height: 300); frm.Controls.Add(chart1); Application.Run(frm); } static IEnumerable<string> CharRange(Char c, int length) { return (from e in Enumerable.Range(Convert.ToInt32(c), length) select Char.ConvertFromUtf32(e)); } static string GetRandomString(int length) { var sb = new StringBuilder(); do sb.Append(Path.GetRandomFileName().Replace(".", "").Substring(0, length < 11 ? length : 11)); while ((length -= 11) > 0); return sb.ToString(); } 
+3
source

All Articles