See https://github.com/NathanBaulch/asciichart-sharp for a maintained fork.
C# port of asciichart (https://github.com/kroitor/asciichart)
var series = new double[100];
for (var i = 0; i < series.Length; i++)
{
series[i] = 15 * Math.Sin(i * ((Math.PI * 4) / series.Length));
}
Console.OutputEncoding = Encoding.UTF8;
Console.WriteLine(AsciiChart.Plot(series));
14.97 ┤ ╭───╮ ╭───╮
13.97 ┤ ╭─╯ ╰─╮ ╭─╯ ╰─╮
12.97 ┤ ╭╯ ╰╮ ╭╯ ╰╮
11.98 ┤ ╭╯ ╰╮ ╭╯ ╰╮
10.98 ┤ │ │ │ │
9.98 ┤ ╭╯ ╰╮ ╭╯ ╰╮
8.98 ┤ ╭╯ ╰╮ ╭╯ ╰╮
7.98 ┤ │ │ │ │
6.99 ┤ ╭╯ ╰╮ ╭╯ ╰╮
5.99 ┤ ╭╯ ╰╮ ╭╯ ╰╮
4.99 ┤ │ │ │ │
3.99 ┤ ╭╯ ╰╮ ╭╯ ╰╮
2.99 ┤ │ │ │ │
2.00 ┤╭╯ ╰╮ ╭╯ ╰╮
1.00 ┤│ │ │ │
0.00 ┼╯ ╰╮ ╭╯ ╰╮
-1.00 ┤ │ │ │
-2.00 ┤ ╰╮ ╭╯ ╰╮ ╭
-2.99 ┤ │ │ │ │
-3.99 ┤ ╰╮ ╭╯ ╰╮ ╭╯
-4.99 ┤ │ │ │ │
-5.99 ┤ ╰╮ ╭╯ ╰╮ ╭╯
-6.99 ┤ ╰╮ ╭╯ ╰╮ ╭╯
-7.98 ┤ │ │ │ │
-8.98 ┤ ╰╮ ╭╯ ╰╮ ╭╯
-9.98 ┤ ╰╮ ╭╯ ╰╮ ╭╯
-10.98 ┤ │ │ │ │
-11.98 ┤ ╰╮ ╭╯ ╰╮ ╭╯
-12.97 ┤ ╰╮ ╭╯ ╰╮ ╭╯
-13.97 ┤ ╰─╮ ╭─╯ ╰─╮ ╭─╯
-14.97 ┤ ╰───╯ ╰───╯
// same series as above
Console.WriteLine(AsciiChart.Plot(series, new Options
{
AxisLabelLeftMargin = 3,
AxisLabelRightMargin = 0,
Height = 4,
Fill = '·',
AxisLabelFormat = "0,000.000",
}));
0,014.970┤······╭───────────╮·····································╭───────────╮·······························
0,007.485┤··╭───╯···········╰───╮·····························╭───╯···········╰───╮···························
0,000.000┼──╯···················╰────╮···················╭────╯···················╰────╮···················╭─·
-0,007.485┤···························╰───╮···········╭───╯·····························╰───╮···········╭───╯··
-0,014.970┤·······························╰───────────╯·····································╰───────────╯······
Automatically sizes to fit the largest visible label.
var series2 = new double[100];
for (var i = 0; i < series.Length; i++)
{
series2[i] = (200000 * Math.Cos(i * ((Math.PI * 8) / series.Length))) + 1000000;
}
Console.WriteLine(AsciiChart.Plot(series2, new Options{Height = 10}));
1200000.00 ┼─╮ ╭──╮ ╭──╮ ╭──╮ ╭
1160157.71 ┤ ╰─╮ ╭─╯ ╰─╮ ╭─╯ ╰─╮ ╭─╯ ╰─╮ ╭─╯
1120315.41 ┤ ╰╮ ╭╯ ╰╮ ╭╯ ╰╮ ╭╯ ╰╮ ╭╯
1080473.12 ┤ ╰╮ ╭╯ ╰╮ ╭╯ ╰╮ ╭╯ ╰╮ ╭╯
1040630.82 ┤ │ │ │ │ │ │ │ │
1000788.53 ┤ ╰╮ ╭╯ ╰╮ ╭╯ ╰╮ ╭╯ ╰╮ ╭╯
960946.24 ┤ ╰╮ ╭╯ ╰╮ ╭╯ ╰╮ ╭╯ ╰╮ ╭╯
921103.94 ┤ ╰╮ ╭╯ ╰╮ ╭╯ ╰╮ ╭╯ ╰╮ ╭╯
881261.65 ┤ ╰╮ ╭╯ ╰╮ ╭╯ ╰╮ ╭╯ ╰╮ ╭╯
841419.35 ┤ ╰╮ ╭╯ ╰╮ ╭╯ ╰╮ ╭╯ ╰╮ ╭╯
801577.06 ┤ ╰───╯ ╰───╯ ╰───╯ ╰───╯