Skip to content

Minimum number of labels on an axis #24

Open

Description

@objorke

Imported from http://oxyplot.codeplex.com/workitem/9975

objo 2012-08-09 00:17
There should never be less than two labels on the axes.

See discussion
http://oxyplot.codeplex.com/discussions/390008

Activity

  1. tomkuijsten commented on Dec 3, 2014

    @tomkuijsten

    Any news on this item?

  2. Orcomp commented on Dec 3, 2014

    @Orcomp

    It would be nice if the first and last tick labels were always present on the Y-axis regardless of the height.

  3. objorke commented on Dec 3, 2014

    @objorke
    MemberAuthor

    I think the labels should always show 'nice' numbers. The scaling may be changed to make sure at least two labels are visible.

    Showing minimum/maximum values (#19) is another possible enhancement, but I think that one should be optional and not affected by this issue.

  4. objorke commented on Dec 3, 2014

    @objorke
    MemberAuthor

    I think this one is more a bug than an enhancement...

  5. Trass3r commented on Jan 26, 2016

    @Trass3r

    Does any one have an idea how to implement this?

  6. objorke commented on Jan 26, 2016

    @objorke
    MemberAuthor

    First I think we need a couple of examples that reproduces the bug!
    Your screen shots in #749 look good, can you provide example code? I guess the height of the plot view is important - can this be reproduced in the example browser with the default window size?

  7. Trass3r commented on Jan 28, 2016

    @Trass3r

    Yes depends on the plot height. Visible in the BindingObservableCollection example when clicking on load points with:

     .../MainWindow.xaml                                | 24 ++++++++++++++++++++--
     1 file changed, 22 insertions(+), 2 deletions(-)
    
    diff --git a/Source/Examples/WPF/WpfExamples/Examples/BindingObservableCollectionDemo/MainWindow.xaml b/Source/Examples/WPF/WpfExamples/Examples/BindingObservableCollectionDemo/MainWindow.xaml
    index 5cef092..10b96b7 100644
    --- a/Source/Examples/WPF/WpfExamples/Examples/BindingObservableCollectionDemo/MainWindow.xaml
    +++ b/Source/Examples/WPF/WpfExamples/Examples/BindingObservableCollectionDemo/MainWindow.xaml
    @@ -1,11 +1,12 @@
     <Window x:Class="BindingObservableCollectionDemo.Window" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:oxy="clr-namespace:OxyPlot.Wpf;assembly=OxyPlot.Wpf"
             Title="BindingDemo" Width="640"
    -        Height="480">
    +        Height="380">
       <Grid>
         <Grid.RowDefinitions>
           <RowDefinition Height="Auto" />
           <RowDefinition Height="*" />
    +      <RowDefinition Height="*" />
         </Grid.RowDefinitions>
         <Button Command="{Binding LoadCommand}" Content="Load next points" />
         <oxy:Plot Title="Binding ItemsSource" Grid.Row="1"
    @@ -27,5 +28,24 @@
                             Color="Green" />
           </oxy:Plot.Series>
         </oxy:Plot>
    -  </Grid>
    +        <oxy:Plot Title="Binding ItemsSource" Grid.Row="2"
    +                Subtitle="{Binding Subtitle}">
    +            <oxy:Plot.Series>
    +                <oxy:LineSeries Title="Value" DataFieldX="Time"
    +                        DataFieldY="Value"
    +                        ItemsSource="{Binding Measurements}"
    +                        StrokeThickness="2" Color="Blue" />
    +                <oxy:LineSeries Title="Maximum" DataFieldX="Time"
    +                        DataFieldY="Maximum"
    +                        ItemsSource="{Binding Measurements}"
    +                        LineStyle="Dash" StrokeThickness="2"
    +                        Color="Red" />
    +                <oxy:LineSeries Title="Minimum" DataFieldX="Time"
    +                        DataFieldY="Minimum"
    +                        ItemsSource="{Binding Measurements}"
    +                        LineStyle="Dot" StrokeThickness="2"
    +                        Color="Green" />
    +            </oxy:Plot.Series>
    +        </oxy:Plot>
    +    </Grid>
     </Window>
    
  8. Trass3r commented on Jan 10, 2017

    @Trass3r

    Were you able to reproduce it?

  9. Trass3r commented on Jan 30, 2017

    @Trass3r

    A sort of workaround is to bind MajorStep to (calculatedMax - calculatedMin) / NUM_TICKS.
    Though still the upper bound tick is often missing.

  10. mpInterO commented on Apr 18, 2018

    @mpInterO

    This is still a significant issue. Trass3r, did you find any better solution?

  11. dwInterO commented on Apr 19, 2018

    @dwInterO

    A workaround would be to use the public property IntervalLength of Axis class. It defaults to 60.0. If you have one (or more) short dimension for the plot area, then the corresponding axis could lower the IntervalLength and get more major steps. So, you could halve it to 30.0 and get twice as many major steps. Mathematically, this is not going to guarantee you that you will get more than one label on the axis. But in certain situations this might be sufficient.

  12. kraptor23 commented on Jul 17, 2018

    @kraptor23

    Any updates on this - it's really important to get at least two labels - even forcing it to show the min / max values would be really helpful.

  13. coffinshaker commented on Nov 18, 2020

    @coffinshaker

    Any update on this?

  14. VisualMelon commented on Nov 18, 2020

    @VisualMelon
    Contributor

    @coffinshaker No progress.

    I've just thrown together a PR: any feedback would be welcome. It will need to be reviewed by the another maintainer before it can go any further. I've drafted this sort of thing many times in the past and never been happy with it, so there is probably a big issue with the design I'm missing.

  15. coffinshaker commented on Dec 2, 2020

    @coffinshaker

    Thanks @VisualMelon. In the end I found a workaround. I change MajorStep on the fly based on the data min/max.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions