Axes

Under construction.

Adding axes in XAML
<oxy:Plot Title="Linear axes">
    <oxy:Plot.Axes>
        <oxy:LinearAxis Position="Bottom" Minimum="-20" Maximum="80" />
        <oxy:LinearAxis Position="Left" Minimum="-10" Maximum="10" />
     </oxy:Plot.Axes>
</oxy:Plot>

Adding axes to a PlotModel
var model=new PlotModel();
model.Axes.Add(new LinearAxis(AxisPosition.Bottom,-20,80));
model.Axes.Add(new LinearAxis(AxisPosition.Left,-10,10));

If no axes are defined, linear axes will be added to the bottom and left.

Common Axis properties
Position - the position of the axis (bottom, left, right, top)
Title
Minimum
Maximum
etc.

LinearAxis
A numerical axis that uses a linear scale.
under construction

LogarithmicAxis
A numerical axis that uses a logarithmic scale.
under construction

DateTimeAxis
This will show date/time values on the axis.

If you are adding DataPoints to a series, the DateTime values should be converted to numeric values by the DateTimeAxis.ToDouble method.
mySeries.Points.Add(new DataPoint(DateTimeAxis.ToDouble(myDateTime),myValue))

If you are binding DataFieldX or DataFieldY to a DateTime, OxyPlot will handle the conversion.

You can control the axis intervals by IntervalType, MinorIntervalType and the formatting of the axis labels by the StringFormat property.
The following codes are accepted by StringFormat

yyyy year "2011"
yy year "11"
MM month "01"
MMM month "Jan"
MMMM month "January"
w week number "4"
ww week number "04"
dd day "26"
hh hour "04"
HH hour "16"
mm minute "37"
ss seconds "23"
yyyy-MM-dd "2011-01-26"
MM/dd/yyyy "01/26/2011"

TimeSpanAxis
This will show time span values on the axis.

If you are adding DataPoints to a series, the TimeSpan values should be converted to numeric values by the TimeSpanAxis.ToDouble method.
mySeries.Points.Add(new DataPoint(TimeSpanAxis.ToDouble(myTimeSpan),myValue))

If you are binding DataFieldX or DataFieldY to a DateTime, OxyPlot will handle the conversion.

You can control the axis labels by the StringFormat property.

CategoryAxis
under construction

Last edited Aug 15, 2011 at 7:04 AM by objo, version 4

Comments

No comments yet.