-
Notifications
You must be signed in to change notification settings - Fork 144
Expand file tree
/
Copy pathContourSeriesExamples.cs
More file actions
37 lines (32 loc) · 1.18 KB
/
ContourSeriesExamples.cs
File metadata and controls
37 lines (32 loc) · 1.18 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
namespace ExampleGenerator
{
using System;
using OxyPlot;
using OxyPlot.Series;
public class ContourSeriesExamples
{
[Export("Series/ContourSeries")]
public static PlotModel ContourSeries()
{
var model = new PlotModel { Title = "ContourSeries" };
double x0 = -3;
double x1 = 3;
double y0 = -3.1;
double y1 = 3.1;
Func<double, double, double> peaks = (x, y) => 3 * (1 - x) * (1 - x) * Math.Exp(-(x * x) - (y + 1) * (y + 1)) - 10 * (x / 5 - x * x * x - y * y * y * y * y) * Math.Exp(-x * x - y * y) - 1.0 / 3 * Math.Exp(-(x + 1) * (x + 1) - y * y);
var xx = ArrayBuilder.CreateVector(x0, x1, 120);
var yy = ArrayBuilder.CreateVector(y0, y1, 90);
var peaksData = ArrayBuilder.Evaluate(peaks, xx, yy);
var cs = new ContourSeries
{
Color = OxyColors.Black,
LabelBackground = OxyColors.White,
ColumnCoordinates = xx,
RowCoordinates = yy,
Data = peaksData
};
model.Series.Add(cs);
return model;
}
}
}