本文整理汇总了C#中OxyPlot.PlotModel类的典型用法代码示例。如果您正苦于以下问题:C# PlotModel类的具体用法?C# PlotModel怎么用?C# PlotModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PlotModel类属于OxyPlot命名空间,在下文中一共展示了PlotModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Example1
// [Example("DateTime Minimum bug")]
public static PlotModel Example1()
{
var tmp = new PlotModel("Test");
tmp.Axes.Add(new LinearAxis(AxisPosition.Left) { MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Dot, TickStyle = TickStyle.Outside });
DateTime dt = new DateTime(2010, 1, 1);
tmp.Axes.Add(new DateTimeAxis(dt, dt.AddDays(1), AxisPosition.Bottom, null, null, DateTimeIntervalType.Hours)
{
MajorGridlineStyle = LineStyle.Solid,
Angle = 90,
StringFormat = "HH:mm",
MajorStep = 1.0 / 24 / 2, // 1/24 = 1 hour, 1/24/2 = 30 minutes
IsZoomEnabled = true,
MaximumPadding = 0,
MinimumPadding = 0,
TickStyle = TickStyle.None
});
var ls = new LineSeries("Line1") { DataFieldX = "X", DataFieldY = "Y" };
List<Item> ii = new List<Item>();
for (int i = 0; i < 24; i++)
ii.Add(new Item { X = dt.AddHours(i), Y = i * i });
ls.ItemsSource = ii;
tmp.Series.Add(ls);
return tmp;
}
示例2: Main
/// <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();
}
示例3: MainWindow
public MainWindow()
{
this.InitializeComponent();
// Create some data
this.Items = new Collection<Item>
{
new Item {Label = "Apples", Value1 = 37, Value2 = 12, Value3 = 19},
new Item {Label = "Pears", Value1 = 7, Value2 = 21, Value3 = 9},
new Item {Label = "Bananas", Value1 = 23, Value2 = 2, Value3 = 29}
};
// Create the plot model
var tmp = new PlotModel("Column series") { LegendPlacement = LegendPlacement.Outside, LegendPosition = LegendPosition.RightTop, LegendOrientation = LegendOrientation.Vertical };
// Add the axes, note that MinimumPadding and AbsoluteMinimum should be set on the value axis.
tmp.Axes.Add(new CategoryAxis { ItemsSource = this.Items, LabelField = "Label" });
tmp.Axes.Add(new LinearAxis(AxisPosition.Left) { MinimumPadding = 0, AbsoluteMinimum = 0 });
// Add the series, note that the the BarSeries are using the same ItemsSource as the CategoryAxis.
tmp.Series.Add(new ColumnSeries { Title = "2009", ItemsSource = this.Items, ValueField = "Value1" });
tmp.Series.Add(new ColumnSeries { Title = "2010", ItemsSource = this.Items, ValueField = "Value2" });
tmp.Series.Add(new ColumnSeries { Title = "2011", ItemsSource = this.Items, ValueField = "Value3" });
this.Model1 = tmp;
this.DataContext = this;
}
示例4: PolarGraphWindow
public PolarGraphWindow()
{
InitializeComponent();
GraphModel = new PlotModel();
chartCanvas.InvalidatePlot();
//GraphModel.PlotType = PlotType.Cartesian;
GraphModel.PlotMargins = new OxyThickness(60, 20, 4, 40);
GraphModel.Axes.Add(new LinearAxis
{
MajorGridlineStyle = LineStyle.Solid,
MinorGridlineStyle = LineStyle.Solid,
Position = AxisPosition.Left,
MinorTickSize = 0,
//Minimum = -5,
//Maximum = 5,
//Unit = "rad",
Title = "θ"
});
GraphModel.Axes.Add(new LinearAxis
{
MajorGridlineStyle = LineStyle.Solid,
MinorGridlineStyle = LineStyle.Solid,
Position = AxisPosition.Bottom,
MinorTickSize = 0,
//Minimum = -12,
//Maximum = 12,
Title = "ρ"
});
txtOperation.ItemsSource = Funcs;
}
示例5: AddActiveSeries
private void AddActiveSeries(PlotModel model)
{
foreach (var series in seriesManager.GetActive())
{
model.Series.Add(series);
}
}
示例6: RangeColorAxis
private static PlotModel RangeColorAxis(AxisPosition position)
{
int n = 1000;
var model = new PlotModel
{
Title = string.Format("ScatterSeries and RangeColorAxis (n={0})", n),
Background = OxyColors.LightGray
};
model.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom });
model.Axes.Add(new LinearAxis { Position = AxisPosition.Left });
var rca = new RangeColorAxis { Position = position, Maximum = 2, Minimum = -2 };
rca.AddRange(0, 0.5, OxyColors.Blue);
rca.AddRange(-0.2, -0.1, OxyColors.Red);
model.Axes.Add(rca);
var s1 = new ScatterSeries { MarkerType = MarkerType.Square, MarkerSize = 6, };
var random = new Random(13);
for (int i = 0; i < n; i++)
{
double x = (random.NextDouble() * 2.2) - 1.1;
s1.Points.Add(new ScatterPoint(x, random.NextDouble()) { Value = x });
}
model.Series.Add(s1);
return model;
}
示例7: DontShowMinorTicks
public static PlotModel DontShowMinorTicks()
{
var model = new PlotModel { Title = "MinorTickSize = 0" };
model.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom, MinorTickSize = 0, MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Solid });
model.Axes.Add(new LinearAxis { Position = AxisPosition.Left, MinorTickSize = 0, MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Solid });
return model;
}
示例8: BarSeries
public static PlotModel BarSeries()
{
var model = new PlotModel
{
Title = "BarSeries",
LegendPlacement = LegendPlacement.Outside,
LegendPosition = LegendPosition.BottomCenter,
LegendOrientation = LegendOrientation.Horizontal,
LegendBorderThickness = 0
};
var s1 = new BarSeries { Title = "Series 1", StrokeColor = OxyColors.Black, StrokeThickness = 1 };
s1.Items.Add(new BarItem { Value = 25 });
s1.Items.Add(new BarItem { Value = 137 });
s1.Items.Add(new BarItem { Value = 18 });
s1.Items.Add(new BarItem { Value = 40 });
var s2 = new BarSeries { Title = "Series 2", StrokeColor = OxyColors.Black, StrokeThickness = 1 };
s2.Items.Add(new BarItem { Value = 12 });
s2.Items.Add(new BarItem { Value = 14 });
s2.Items.Add(new BarItem { Value = 120 });
s2.Items.Add(new BarItem { Value = 26 });
var categoryAxis = new CategoryAxis { Position = AxisPosition.Left };
categoryAxis.Labels.Add("Category A");
categoryAxis.Labels.Add("Category B");
categoryAxis.Labels.Add("Category C");
categoryAxis.Labels.Add("Category D");
var valueAxis = new LinearAxis { Position = AxisPosition.Bottom, MinimumPadding = 0, MaximumPadding = 0.06, AbsoluteMinimum = 0 };
model.Series.Add(s1);
model.Series.Add(s2);
model.Axes.Add(categoryAxis);
model.Axes.Add(valueAxis);
return model;
}
示例9: Window1
public Window1()
{
InitializeComponent();
DataContext = this;
Model = new PlotModel("Test 1");
Model.Series.Add(new FunctionSeries(Math.Cos, 0, 10, 0.01));
}
示例10: Graph1
public static PlotModel Graph1()
{
var pm = new PlotModel { Title = "Q1 2003 Calls by Region", PlotAreaBorderThickness = new OxyThickness(0) };
var categoryAxis = new CategoryAxis
{
AxislineStyle = LineStyle.Solid,
TickStyle = TickStyle.None
};
categoryAxis.Labels.AddRange(new[] { "North", "East", "South", "West" });
pm.Axes.Add(categoryAxis);
pm.Axes.Add(
new LinearAxis
{
Position = AxisPosition.Left,
Minimum = 0,
Maximum = 6000,
MajorStep = 1000,
MinorStep = 1000,
AxislineStyle = LineStyle.Solid,
TickStyle = TickStyle.Outside,
StringFormat = "#,0"
});
var series = new ColumnSeries { FillColor = OxyColors.Black };
series.Items.Add(new ColumnItem { Value = 3000 });
series.Items.Add(new ColumnItem { Value = 4500 });
series.Items.Add(new ColumnItem { Value = 2100 });
series.Items.Add(new ColumnItem { Value = 4800 });
pm.Series.Add(series);
return pm;
}
示例11: TitleAndSubtitle
public static PlotModel TitleAndSubtitle()
{
var model = new PlotModel { Title = "Title", Subtitle = "Subtitle" };
model.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom });
model.Axes.Add(new LinearAxis { Position = AxisPosition.Left });
return model;
}
示例12: SetUpModel
public void SetUpModel(PlotModel PlotModel, int fanObjectId, string Title = "", string SubTitle = "")
{
PlotModel.Title = Title + fanObjectId;
PlotModel.SubtitleColor = OxyColors.LightGreen;
PlotModel.Subtitle = SubTitle;
PlotModel.LegendTitle = "Легенда";
PlotModel.LegendOrientation = LegendOrientation.Horizontal;
PlotModel.LegendPlacement = LegendPlacement.Outside;
PlotModel.LegendPosition = LegendPosition.TopRight;
PlotModel.LegendBackground = OxyColor.FromAColor(200, OxyColors.White);
PlotModel.LegendBorder = OxyColors.Black;
PlotModel.MouseDown += (s, e) =>
{
try
{
if (e.IsControlDown)
{
DataPoint date = (DataPoint)e.HitTestResult.Item;
IoC.Resolve<MainVm>().CurrentView =
IoC.Resolve<OnPlotClickVm>(new ConstructorArgument("fanObjectId", fanObjectId),
new ConstructorArgument("date",
DateTimeAxis.ToDateTime(date.X)),
new ConstructorArgument("prevView",
IoC.Resolve<MainVm>().CurrentView));
}
}
catch (Exception)
{
return;
}
};
}
示例13: MainWindow
public MainWindow()
{
this.InitializeComponent();
// http://www.nationsonline.org/oneworld/world_population.htm
// http://en.wikipedia.org/wiki/Continent
var plotModel = new PlotModel { Title = "World population by continent" };
var pieSeries = new PieSeries();
pieSeries.Slices.Add(new PieSlice("Africa", 1030) { IsExploded = true });
pieSeries.Slices.Add(new PieSlice("Americas", 929) { IsExploded = true });
pieSeries.Slices.Add(new PieSlice("Asia", 4157));
pieSeries.Slices.Add(new PieSlice("Europe", 739) { IsExploded = true });
pieSeries.Slices.Add(new PieSlice("Oceania", 35) { IsExploded = true });
pieSeries.InnerDiameter = 0.2;
pieSeries.ExplodedDistance = 0;
pieSeries.Stroke = OxyColors.Black;
pieSeries.StrokeThickness = 1.0;
pieSeries.AngleSpan = 360;
pieSeries.StartAngle = 0;
plotModel.Series.Add(pieSeries);
this.PieModel = plotModel;
this.DataContext = this;
}
示例14: TimeSpanaxisPlotModel
public static PlotModel TimeSpanaxisPlotModel()
{
var start = new TimeSpan(0, 0, 0, 0);
var end = new TimeSpan(0, 24, 0, 0);
double increment = 3600;
// Create a random data collection
var r = new Random(7);
var data = new Collection<TimeValue>();
var current = start;
while (current <= end)
{
data.Add(new TimeValue { Time = current, Value = r.NextDouble() });
current = current.Add(new TimeSpan(0, 0, (int)increment));
}
var plotModel1 = new PlotModel { Title = "TimeSpan axis" };
var timeSpanAxis1 = new TimeSpanAxis { Position = AxisPosition.Bottom, StringFormat = "h:mm" };
plotModel1.Axes.Add(timeSpanAxis1);
var linearAxis1 = new LinearAxis { Position = AxisPosition.Left };
plotModel1.Axes.Add(linearAxis1);
var lineSeries1 = new LineSeries
{
Color = OxyColor.FromArgb(255, 78, 154, 6),
MarkerFill = OxyColor.FromArgb(255, 78, 154, 6),
MarkerStroke = OxyColors.ForestGreen,
MarkerType = MarkerType.Plus,
StrokeThickness = 1,
DataFieldX = "Time",
DataFieldY = "Value",
ItemsSource = data
};
plotModel1.Series.Add(lineSeries1);
return plotModel1;
}
示例15: LinearAxis
public static PlotModel LinearAxis()
{
var model = new PlotModel { Title = "LinearAxis" };
model.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom, Minimum = -1, Maximum = 1 });
model.Axes.Add(new LinearAxis { Position = AxisPosition.Left, Minimum = -10, Maximum = 10 });
return model;
}