Example #1
1
        /// <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();
        }
Example #2
0
		public Gtk.Widget GetPlotView() {

			var plotView = new OxyPlot.GtkSharp.PlotView { Model = plotModel, Visible = true };

			plotView.SetSizeRequest(500, 400);

			return plotView;
		}
Example #3
0
        public Gtk.Widget GetPlotView()
        {
            var plotView = new OxyPlot.GtkSharp.PlotView {
                Model = plotModel, Visible = true
            };

            plotView.SetSizeRequest(500, 400);

            return(plotView);
        }
Example #4
0
		public Gtk.Widget GetPlotView() {

//			plotModel.Series.Add(new FunctionSeries(Math.Sin, -10, 10, 0.1, "sin(x)"));
//			plotModel.Series.Add(new FunctionSeries(Math.Cos, -10, 10, 0.1, "cos(x)"));
//			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)"));

			var plotView = new OxyPlot.GtkSharp.PlotView { Model = plotModel, Visible = true };

			plotView.SetSizeRequest(500, 400);

			return plotView;
		}
Example #5
0
        public Gtk.Widget GetPlotView()
        {
//			plotModel.Series.Add(new FunctionSeries(Math.Sin, -10, 10, 0.1, "sin(x)"));
//			plotModel.Series.Add(new FunctionSeries(Math.Cos, -10, 10, 0.1, "cos(x)"));
//			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)"));

            var plotView = new OxyPlot.GtkSharp.PlotView {
                Model = plotModel, Visible = true
            };

            plotView.SetSizeRequest(500, 400);

            return(plotView);
        }
        /// <summary>
        /// Defines the entry point of the application.
        /// </summary>
        private static void Main()
        {
            Application.Init();

            var window    = new Window("helloworld");
            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();
        }
Example #7
0
        /// <summary>
        /// Defines the entry point of the application.
        /// </summary>
        private static void Main()
        {
            Application.Init();

            using (var window = new Window("GtkSharp Demo"))
            {
                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)"));
                plotModel.Series.Add(new FunctionSeries(Math.Cos, -10, 10, 0.1, "cos(x)"));
                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)"));

                using (var plotView = new OxyPlot.GtkSharp.PlotView {
                    Model = plotModel, Visible = true
                })
                {
                    window.SetSizeRequest(800, 600);
                    window.Add(plotView);
                    plotView.GrabFocus();
                    window.Show();
                    window.DeleteEvent += (s, a) =>
                    {
                        Application.Quit();
                        a.RetVal = true;
                    };

                    Application.Run();
                }
            }
        }
Example #8
0
        private void InitializeComponent()
        {
            this.plotView1 = new OxyPlot.GtkSharp.PlotView();
            this.plotView1.SetSizeRequest(625, 554);

            this.treeView1 = new TreeView();
            this.treeView1.SetSizeRequest(314, 554);
            this.treeView1.Visible = true;

            var    treeModel = new TreeStore(typeof(string), typeof(string));
            var    iter      = new TreeIter();
            string last      = null;

            foreach (var ex in this.Examples)
            {
                if (last == null || last != ex.Category)
                {
                    iter = treeModel.AppendValues(ex.Category);
                    last = ex.Category;
                }

                treeModel.AppendValues(iter, ex.Title);
            }

            this.treeView1.Model = treeModel;
            var exampleNameColumn = new TreeViewColumn {
                Title = "Example"
            };
            var exampleNameCell = new CellRendererText();

            exampleNameColumn.PackStart(exampleNameCell, true);
            this.treeView1.AppendColumn(exampleNameColumn);
            exampleNameColumn.AddAttribute(exampleNameCell, "text", 0);

            this.treeView1.Selection.Changed += (s, e) =>
            {
                TreeIter  selectedNode;
                TreeModel selectedModel;
                if (treeView1.Selection.GetSelected(out selectedModel, out selectedNode))
                {
                    string val1 = (string)selectedModel.GetValue(selectedNode, 0);
                    string val2 = (string)selectedModel.GetValue(selectedNode, 1);

                    var info = this.Examples.FirstOrDefault(ex => ex.Title == val1);
                    if (info != null)
                    {
                        this.SelectedExample = info;
                    }
                }
            };

            this.hbox1 = new HBox(false, 6);
            this.hbox1.SetSizeRequest(943, 554);

            this.hbox1.PackStart(this.treeView1, false, false, 6);
            this.hbox1.PackStart(this.plotView1, false, false, 6);

            this.Add(this.hbox1);

            //this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            //this.AutoScaleMode = Gtk.AutoScaleMode.Font;
            //this.ClientSize = new System.Drawing.Size(943, 554);
            this.Title        = "OxyPlot.GtkSharp Example Browser";
            this.DeleteEvent += (s, a) =>
            {
                Application.Quit();
                a.RetVal = true;
            };
        }
Example #9
0
        private void InitializeComponent()
        {
            this.plotView = new OxyPlot.GtkSharp.PlotView();
            this.plotView.SetSizeRequest(300, 300);

            this.treeView         = new TreeView();
            this.treeView.Visible = true;

            var    treeModel = new TreeStore(typeof(string), typeof(string));
            var    iter      = new TreeIter();
            string last      = null;

            foreach (var ex in this.Examples)
            {
                if (last == null || last != ex.Category)
                {
                    iter = treeModel.AppendValues(ex.Category);
                    last = ex.Category;
                }

                treeModel.AppendValues(iter, ex.Title, ex.Category);
            }

            this.treeView.Model = treeModel;
            var exampleNameColumn = new TreeViewColumn {
                Title = "Example"
            };
            var exampleNameCell = new CellRendererText();

            exampleNameColumn.PackStart(exampleNameCell, true);
            this.treeView.AppendColumn(exampleNameColumn);
            exampleNameColumn.AddAttribute(exampleNameCell, "text", 0);

            this.treeView.Selection.Changed += (s, e) =>
            {
                if (treeView.Selection.GetSelected(out var selectedModel, out var selectedNode))
                {
                    string val1 = (string)selectedModel.GetValue(selectedNode, 0);
                    string val2 = (string)selectedModel.GetValue(selectedNode, 1);

                    this.SelectedExample = this.Examples.FirstOrDefault(ex => ex.Category == val2 && ex.Title == val1);
                }
            };

            var scrollwin = new ScrolledWindow();

            scrollwin.Add(this.treeView);
            scrollwin.SetSizeRequest(250, 300);

            var txtSearch = new Entry();

            treeView.SearchEntry = txtSearch;
            var treeVbox = new VBox(false, 0);

            treeVbox.BorderWidth = 6;
            treeVbox.PackStart(txtSearch, false, true, 0);
            treeVbox.PackStart(scrollwin, true, true, 0);

            this.paned = new HPaned();
            this.paned.Pack1(treeVbox, false, false);
            this.paned.Pack2(this.plotView, true, false);
            this.paned.Position = 300;

            this.Add(this.paned);

            //this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            //this.AutoScaleMode = Gtk.AutoScaleMode.Font;
            //this.ClientSize = new System.Drawing.Size(943, 554);
            this.Title        = "OxyPlot.GtkSharp Example Browser";
            this.DeleteEvent += (s, a) =>
            {
                Application.Quit();
                a.RetVal = true;
            };
        }
    }
Example #10
0
        private void InitializeComponent()
        {
            this.plotView1 = new OxyPlot.GtkSharp.PlotView();
            this.plotView1.SetSizeRequest(625, 554);

            this.treeView1 = new TreeView();
            this.treeView1.SetSizeRequest(314, 554);
            this.treeView1.Visible = true;

            var treeModel = new TreeStore(typeof(string), typeof(string));
            var iter = new TreeIter();
            string last = null;
            foreach (var ex in this.Examples)
            {
                if (last == null || last != ex.Category)
                {
                    iter = treeModel.AppendValues(ex.Category);
                    last = ex.Category;
                }

                treeModel.AppendValues(iter, ex.Title);
            }

            this.treeView1.Model = treeModel;
            var exampleNameColumn = new TreeViewColumn { Title = "Example" };
            var exampleNameCell = new CellRendererText();
            exampleNameColumn.PackStart(exampleNameCell, true);
            this.treeView1.AppendColumn(exampleNameColumn);
            exampleNameColumn.AddAttribute(exampleNameCell, "text", 0);

            this.treeView1.Selection.Changed += (s, e) =>
            {
                TreeIter selectedNode;
                TreeModel selectedModel;
                if (treeView1.Selection.GetSelected(out selectedModel, out selectedNode))
                {
                    string val1 = (string)selectedModel.GetValue(selectedNode, 0);
                    string val2 = (string)selectedModel.GetValue(selectedNode, 1);

                    var info = this.Examples.FirstOrDefault(ex => ex.Title == val1);
                    if (info != null)
                    {
                        this.SelectedExample = info;
                    }
                }
            };

            this.hbox1 = new HBox(false, 6);
            this.hbox1.SetSizeRequest(943, 554);

            this.hbox1.PackStart(this.treeView1, false, false, 6);
            this.hbox1.PackStart(this.plotView1, false, false, 6);

            this.Add(this.hbox1);

            //this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            //this.AutoScaleMode = Gtk.AutoScaleMode.Font;
            //this.ClientSize = new System.Drawing.Size(943, 554);
            this.Title = "OxyPlot.GtkSharp Example Browser";
            this.DeleteEvent += (s, a) =>
            {
                Application.Quit();
                a.RetVal = true;
            };
        }
Example #11
0
        private void InitializeComponent()
        {
            this.plotView = new OxyPlot.GtkSharp.PlotView();
            this.plotView.SetSizeRequest(300, 300);

            this.treeView = new TreeView();
            this.treeView.Visible = true;

            var treeModel = new TreeStore(typeof(string), typeof(string));
            var iter = new TreeIter();
            string last = null;
            foreach (var ex in this.Examples)
            {
                if (last == null || last != ex.Category)
                {
                    iter = treeModel.AppendValues(ex.Category);
                    last = ex.Category;
                }

                treeModel.AppendValues(iter, ex.Title, ex.Category);
            }

            this.treeView.Model = treeModel;
            var exampleNameColumn = new TreeViewColumn { Title = "Example" };
            var exampleNameCell = new CellRendererText();
            exampleNameColumn.PackStart(exampleNameCell, true);
            this.treeView.AppendColumn(exampleNameColumn);
            exampleNameColumn.AddAttribute(exampleNameCell, "text", 0);

            this.treeView.Selection.Changed += (s, e) =>
            {
                TreeIter selectedNode;
                TreeModel selectedModel;
                if (treeView.Selection.GetSelected(out selectedModel, out selectedNode))
                {
                    string val1 = (string)selectedModel.GetValue(selectedNode, 0);
                    string val2 = (string)selectedModel.GetValue(selectedNode, 1);

                    this.SelectedExample = this.Examples.FirstOrDefault(ex => ex.Category == val2 && ex.Title == val1);
                }
            };

            var scrollwin = new ScrolledWindow ();
            scrollwin.Add (this.treeView);
            scrollwin.SetSizeRequest(250, 300);

            var txtSearch = new Entry ();
            treeView.SearchEntry = txtSearch;
            var treeVbox = new VBox (false, 0);
            treeVbox.BorderWidth = 6;
            treeVbox.PackStart (txtSearch, false, true, 0);
            treeVbox.PackStart (scrollwin, true, true, 0);

            this.paned = new HPaned ();
            this.paned.Pack1 (treeVbox, false, false);
            this.paned.Pack2 (this.plotView, true, false);
            this.paned.Position = 300;

            this.Add(this.paned);

            //this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            //this.AutoScaleMode = Gtk.AutoScaleMode.Font;
            //this.ClientSize = new System.Drawing.Size(943, 554);
            this.Title = "OxyPlot.GtkSharp Example Browser";
            this.DeleteEvent += (s, a) =>
            {
                Application.Quit();
                a.RetVal = true;
            };
        }