用于绘制图形的 Linqpad 扩展

use*_*909 2 linqpad

我尝试使用“Util.RawHtml()”和“Dump()”在 Linqpad 中绘制一些图形,但它不适用于来自 amcharts.com 的这个示例。我创建了一个包含所有 HTML 源代码的字符串变量,但结果不起作用。

string html = "";
using (System.Net.WebClient client = new System.Net.WebClient ())
{
    html = client.DownloadString(@"http://pastebin.com/raw/pmMMwXhm");
}

Util.RawHtml(html).Dump();
Run Code Online (Sandbox Code Playgroud)

mbx*_*mbx 5

LinqPad 5 的更高版本现在支持开箱即用的图表Util.Chart。您可以在Samples选项卡(旁边My Queries)中看到示例

  • LINQPad Tutorial&Reference
    • Scratchpad Features
      • Charting with Chart

以下脚本是Chart() - 双刻度示例:

// Each y-series can have a different series type, and can be assigned to the secondary y-axis scale on the right.

var customers = new[]
{
    new { Name = "John", TotalOrders = 1000, PendingOrders = 50, CanceledOrders = 20 },
    new { Name = "Mary", TotalOrders = 1300, PendingOrders = 70, CanceledOrders = 25 },
    new { Name = "Sara", TotalOrders = 1400, PendingOrders = 60, CanceledOrders = 17 },
};

customers.Chart (c => c.Name)
    .AddYSeries (c => c.TotalOrders,    Util.SeriesType.Spline, "Total")
    .AddYSeries (c => c.PendingOrders,  Util.SeriesType.Column, "Pending",   useSecondaryYAxis:true)
    .AddYSeries (c => c.CanceledOrders, Util.SeriesType.Column, "Cancelled", useSecondaryYAxis:true)
    .Dump();
Run Code Online (Sandbox Code Playgroud)