Open objorke opened 10 years ago
Any news on this item?
It would be nice if the first and last tick labels were always present on the Y-axis regardless of the height.
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.
I think this one is more a bug than an enhancement...
Does any one have an idea how to implement this?
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?
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>
Were you able to reproduce it?
A sort of workaround is to bind MajorStep to (calculatedMax - calculatedMin) / NUM_TICKS. Though still the upper bound tick is often missing.
This is still a significant issue. Trass3r, did you find any better solution?
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.
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.
Any update on this?
@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.
Thanks @VisualMelon. In the end I found a workaround. I change MajorStep on the fly based on the data min/max.
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