Skip to content

Commit

Permalink
[ContourSeries] Add example
Browse files Browse the repository at this point in the history
  • Loading branch information
seijikun committed Mar 14, 2017
1 parent eb3f28a commit 14de4f1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Binary file modified models/series/ContourSeries.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 22 additions & 1 deletion models/series/ContourSeries.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,25 @@ Example

.. sourcecode:: csharp

var model = new PlotModel { Title = "ContourSeries" };
var model = new PlotModel { Title = "ContourSeries" };

double x0 = -3.1;
double x1 = 3.1;
double y0 = -3;
double y1 = 3;

//generate values
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, 100);
var yy = ArrayBuilder.CreateVector(y0, y1, 100);
var peaksData = ArrayBuilder.Evaluate(peaks, xx, yy);

var cs = new ContourSeries
{
Color = OxyColors.Black,
LabelBackground = OxyColors.White,
ColumnCoordinates = yy,
RowCoordinates = xx,
Data = peaksData
};
model.Series.Add(cs);

0 comments on commit 14de4f1

Please sign in to comment.