forked from oxyplot/oxyplot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
60 lines (52 loc) · 2.08 KB
/
Copy pathProgram.cs
File metadata and controls
60 lines (52 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Program.cs" company="OxyPlot">
// Copyright (c) 2014 OxyPlot contributors
// </copyright>
// <summary>
// The demo program.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace GtkSharpDemo
{
using System;
using Gtk;
using OxyPlot;
using OxyPlot.Series;
/// <summary>
/// The demo program.
/// </summary>
public static class Program
{
/// <summary>
/// Defines the entry point of the application.
/// </summary>
private static void Main()
{
Application.Init();
var window = new Window("GtkSharpDemo");
var plotModel = new PlotModel
{
Title = "Trigonometric functions",
Subtitle = "Example using the FunctionSeries",
PlotType = PlotType.Cartesian,
Background = OxyColors.White
};
plotModel.Series.Add(new FunctionSeries(Math.Sin, -10, 10, 0.1, "sin(x)") { Color = OxyColors.Black });
plotModel.Series.Add(new FunctionSeries(Math.Cos, -10, 10, 0.1, "cos(x)") { Color = OxyColors.Green });
plotModel.Series.Add(new FunctionSeries(t => 5 * Math.Cos(t), t => 5 * Math.Sin(t), 0, 2 * Math.PI, 0.1, "cos(t),sin(t)") { Color = OxyColors.Yellow });
var plotView = new OxyPlot.GtkSharp.PlotView { Model = plotModel };
plotView.SetSizeRequest(400, 400);
plotView.Visible = true;
window.SetSizeRequest(600, 600);
window.Add(plotView);
window.Focus = plotView;
window.Show();
window.DeleteEvent += (s, a) =>
{
Application.Quit();
a.RetVal = true;
};
Application.Run();
}
}
}