0

I have a Oxyplot Graph in my WPF application, with LinearAxis as Y, and DateTimeAxis as X. This works fine. My question was more on the Displayed Labels in DateTimeAxis. Instead of displaying Time, I would like to display Index. For example,

enter image description here

I tried following (using LabelFormatter to show index),

        var index = 1;
        var xAxis = new DateTimeAxis()
        {
            Position = AxisPosition.Bottom,
            MinorIntervalType = DateTimeIntervalType.Hours,
            IntervalType = DateTimeIntervalType.Hours,
            MajorGridlineStyle = LineStyle.Solid,
            MajorStep = 1.0/24,  
            IntervalLength = 75,
            MinorGridlineStyle = LineStyle.None,
            LabelFormatter = (x) => index++.ToString()

        };

This does display number instead of Time, but instead of beginning from 1,

  • it starts at some value x (in my case in early 40s)
  • and each time I resize the graph, the value increases (say after first resize it begins at 108).

Example enter image description here Is there a way i could achieve, even after resizing ?

Anu Viswan
  • 17,797
  • 2
  • 22
  • 51
  • Hmm, maybe it would be easier to transform the x-axis programmatically fom time to indexes and use a linear axis for it as well? – Roland Deschain Jan 08 '19 at 05:51
  • 1
    Dearest Downvoter, kindly describe why question was downvoted ? or atleast provide a solution or some hints ? – Anu Viswan Jan 08 '19 at 06:05
  • @RolandDeschain Unfortunately thats not possible in my current scenario. I have to somehow stick to DateTime Axis. – Anu Viswan Jan 08 '19 at 06:08
  • 1
    That's second down voter who hasn't either left any hint on solution or mentioned why they felt the question is unworthy. May be am dumb and not knowing the answer that is in plain sight, but it would be great if two down voters could at least mention reason. – Anu Viswan Jan 08 '19 at 13:31

0 Answers0