Created
September 23, 2016 03:17
-
-
Save GuyCarver/d5db17c371ed24f3e8c073dc021b7853 to your computer and use it in GitHub Desktop.
F# version of plotting.cs example for Continuous app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Plotting Example | |
// | |
// Demonstrates the use of OxyPlot to plot functions. | |
// | |
open System | |
open System.Linq | |
open OxyPlot | |
open OxyPlot.Series | |
open OxyPlot.Xamarin.iOS | |
// | |
// Define some fun functions to plot | |
// | |
let SinWave = Math.Sin | |
let SquareWave x = float(Math.Sign(Math.Sin x)) | |
// | |
// Create a plot model that holds many series | |
// | |
let plot = PlotModel() | |
plot.Title <- "Hello Plotting" | |
// | |
// A little function to make adding plots easier | |
// | |
let AddFunction (f : double -> float ) name = | |
plot.Series.Add FunctionSeries(f,-10.0,10.0,100,name) | |
plot.Series.Last().Background <- OxyColor.FromRgb (255uy, 250uy, 230uy) | |
// | |
// Add functions to the plot | |
// | |
AddFunction SinWave "sin" | |
AddFunction SquareWave "square" | |
// | |
// Display the plot | |
// | |
let Main = new PlotView() | |
Main.Model <- plot | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment