Skip to content

Missing ticks and tick labels on DateTimeAxis #52

Open
@scheidtdav

Description

@scheidtdav

Hey everybody!

I'm having a weird issue with ticks and tick labels on a DateTimeAxis.
With most of the data everything is working fine, but with some data neither ticks nor labels are rendered although its the same code. No errors whatsoever.

I'm using the 1.0.0 release NuGet package on Xamarin.Forms 2.3.3.180.

If it helps anything here is a data set that does not render correctly:
[0] {42747,5478548611 4,54493808746338} OxyPlot.DataPoint
[1] {42747,5471228299 5,50381946563721} OxyPlot.DataPoint
[2] {42747,5465667824 4,02142429351807} OxyPlot.DataPoint
[3] {42747,5457809317 6,08734893798828} OxyPlot.DataPoint
[4] {42747,531548235 4,56216859817505} OxyPlot.DataPoint
[5] {42747,5309475984 4,28897380828857} OxyPlot.DataPoint
[6] {42747,5303068866 3,35946083068848} OxyPlot.DataPoint
[7] {42747,5296827257 4,86148357391357} OxyPlot.DataPoint
[8] {42747,5289272859 2,85382986068726} OxyPlot.DataPoint

My plot model looks like this:

plotModel = new PlotModel ();
      plotModel.Axes.Add (new DateTimeAxis {
        Position = AxisPosition.Bottom,
        Unit = "Datum",
        IntervalType = DateTimeIntervalType.Days,
        MinimumMajorStep = 1,
        AbsoluteMinimum = dataPoints.Min (m => m.X) - 1,
        Maximum = dataPoints.Max (m => m.X),
        Minimum = dataPoints.OrderByDescending (o => o.X).Take (7).Last ().X,
        AbsoluteMaximum = dataPoints.Max (m => m.X) + 1,
        StringFormat = "dd.MM."
      });
      plotModel.Axes.Add (new LinearAxis {
        Position = AxisPosition.Left,
        AbsoluteMinimum = 0,
        Minimum = 1,
        Maximum = 9,
        AbsoluteMaximum = 10,
        IsPanEnabled = false,
        IsZoomEnabled = false
      });
      plotModel.Series.Add (new LineSeries {
        ItemsSource = dataPoints,
        Color = Color.FromHex (Constants.Color.Accent).ToOxyColor (),
        MarkerType = MarkerType.Cross,
        MarkerFill = Color.FromHex (Constants.Color.Primary).ToOxyColor (),
        MarkerStroke = Color.FromHex (Constants.Color.Primary).ToOxyColor (),
        MarkerStrokeThickness = 1,
      });

Any ideas? Thanks in advance :-)

Cheers

David

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions