Wpf: remove #if from Plot.TouchEvent
↧
Source code checked in, #7f21e125659c
↧
Source code checked in, #919e694db41b
Wpf: add ToPoint and ToRect extension method overloads without 'alias' argument
↧
↧
New Post: Can't programmatically binding to OxyPlot properties
I want to create a databinding programmatically for the LineSeries.Color property. The LineSeries.Color property must be a dependency property because you can bind to it in XAML. However, if I want to create a binding dynamically in code-behind, I need the static property LineSeries.ColorProperty. For example, the WPF TextBox.Text has an analogous TextBox.TextProperty. But Intellisense shows no LineSeries.ColorProperty.
↧
New Post: WPF LineSeries not refreshing
I am trying to use OxyPlot for real-time data plotting, but so far I've wasted a couple of hours without result. When I create a plot in XAML and add a LineSeries with ItemsSource binding, nothing happens when the binding source is updated (PropertyChanged eventhandlers and stuff are set-up correctly). Even calling RefreshPlot(true), which even seems to be unavailable in newer releases (240 has it, 261 does not), does not help.
The only time I actually see my data plotted is when I go zooming around the plot, the data is then updated at every zoom action (middle mouse drag).
To rule out compatibility errors, I created a small testing project.
MainWindow.xaml:
I hope someone can help me, the problem is absolutely driving me mad, partly because I have seen this working in a fellow student's project.
The only time I actually see my data plotted is when I go zooming around the plot, the data is then updated at every zoom action (middle mouse drag).
To rule out compatibility errors, I created a small testing project.
MainWindow.xaml:
<Window x:Class="OxyPlotTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:oxy="http://oxyplot.codeplex.com"
Title="MainWindow" Height="350" Width="525"
MouseDown="Window_MouseDown">
<Grid>
<oxy:Plot Name="Plot" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<oxy:Plot.Axes>
<oxy:LinearAxis Position="Bottom" Minimum="0" Maximum="10"/>
<oxy:LinearAxis Position="Left" Minimum="-50" Maximum="50"/>
</oxy:Plot.Axes>
<oxy:Plot.Series>
<oxy:LineSeries ItemsSource="{Binding PlotData}"/>
</oxy:Plot.Series>
</oxy:Plot>
</Grid>
</Window>
MainWindow.xaml.cspublic partial class MainWindow : Window, INotifyPropertyChanged
{
public MainWindow()
{
InitializeComponent();
this.DataContext = this;
PlotData = new ObservableCollection<DataPoint>();
}
private ObservableCollection<DataPoint> _plotData = new ObservableCollection<DataPoint>();
public ObservableCollection<DataPoint> PlotData
{
get { return _plotData; }
set { _plotData = value; OnPropertyChanged("PlotData"); }
}
int x = 0;
private void Window_MouseDown(object sender, MouseButtonEventArgs e)
{
//create random datapoint on mouseclick
Random r = new Random();
int y = r.Next(-50, 50);
PlotData.Add(new DataPoint(x,y));
x++;
}
#region binding stuff
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string name)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(name));
}
}
#endregion
}
The above code (with version 261) also does not work, a graph is only drawn when zooming. Not automatically.I hope someone can help me, the problem is absolutely driving me mad, partly because I have seen this working in a fellow student's project.
↧
New Post: WPF LineSeries not refreshing
-
OxyPlot is handling most mouse button events by default. Set a breakpoint in the event handler you created and you will see it is not being called. Try to press "shift+ctrl" and the left mouse button. This combination is not handled by OxyPlot and your event handler should be called. I think you have at least two alternatives to solve this:
- Use the
PreviewMouseDownevent instead. - Unbind the left mouse button down gesture in the plot controller. This can be done by
Plot.ActualController.Unbind(PlotCommands.SnapTrack);orPlot.ActualController.Unbind(OxyMouseButton.Left);(new extension method I just added)
- Use the
- OxyPlot is not observing collection changes, so you need to call
Plot.InvalidatePlot()after you have added the point to the collection.
↧
↧
New Post: Can't programmatically binding to OxyPlot properties
See
OxyPlot.Wpf.Series.ColorProperty. It is public and the type is System.Windows.Media.Color↧
New Post: OxyPlot in Xamarin Studio
Thanks for the detailed explanation! I was not aware that this was a problem. I will add this to the build notes.
Note: On Mac you only need Xamarin Studio, no need to install any extra components :-)
I hope we can get the Xamarin components up and running soon.
Note: On Mac you only need Xamarin Studio, no need to install any extra components :-)
I hope we can get the Xamarin components up and running soon.
↧
Source code checked in, #ab4b6dcad939
Fix unbind bug in PlotController (discussions/540115)
↧
New Post: One legend item for each group of LineSeries instances?
Hi I have a single plot with multiple LineSeries, and I want to programmatically add a single legend item for a group of LineSeries instances (e.g. five green lines called "first", seven blue lines called "second"...etc). Is there a straightforward way to do this? Thanks!!
↧
↧
Source code checked in, #49ca2ebf18f9
StyleCop cleanup, add StyleCop tasks to Windows projects
↧
New Post: One legend item for each group of LineSeries instances?
did you try setting the
Title for only the first green LineSeries and the first blue LineSeries?↧
Source code checked in, #cedd606e7ac7
Improve comments
↧
Source code checked in, #147c22f4c90b
Annotation: XAxis and YAxis should be readonly. Use XAxisKey and YAxisKey instead
↧
↧
Source code checked in, #1b5129dd58af
Change signature of UIPlotElement.HitTest method
↧
New Post: WPF LineSeries not refreshing
Thanks for your response!
The event-handler definitely was being called, when you click at the edge of the window, it will fire. Also, this is specific to my test set-up, in the actual project the binding source is updated by a DispatcherTimer.
I see copying the list, then adding the new datapoint to it and finally reassigning it to the binding source does update the graph like it should and so does Plot.InvalidatePlot(). However, it does not work in my original project with the DispatcherTimer, do you think the timer itself has something to do with the inability to update the plot (being on a another thread or something like that)?
The event-handler definitely was being called, when you click at the edge of the window, it will fire. Also, this is specific to my test set-up, in the actual project the binding source is updated by a DispatcherTimer.
I see copying the list, then adding the new datapoint to it and finally reassigning it to the binding source does update the graph like it should and so does Plot.InvalidatePlot(). However, it does not work in my original project with the DispatcherTimer, do you think the timer itself has something to do with the inability to update the plot (being on a another thread or something like that)?
↧
New Post: One legend item for each group of LineSeries instances?
objo wrote:
did you try setting theThat's a swell idea - not sure why I didn't try that, just assumed it would be hard. Your framework is just too easy to use. ;) Works perfectly, thanks objo!Titlefor only the first green LineSeries and the first blue LineSeries?
↧
New Post: WPF LineSeries not refreshing
Okay, I got this working in one specific way, the DispatcherTimer seems not to be the culprit. When I have this:
private List<DataPoint> _yPoints;
public List<DataPoint> YPoints
{
get { return _yPoints; }
set
{
_yPoints = value;
RaisePropertyChanged("YPoints"); //OnPropertyChanged wrapper
}
}
I need to reassign YPoints completely with a new list, after adding a point as follows:YPoints.Add(new DataPoint(x, y);
YPoints = new List<DataPoint>(YPoints);
If I don't perform the copy, no update, if I manually call RaisePropertyChanged("YPoints"), no update, if I call InvalidatePlot(true) on the plot, no update. Am I making sense here? Can you explain why it only works when I copy the data to a completely new list? It seems a rather inefficient way to handle data...↧
↧
New Post: Question about accessing the plot in MVVM
Why you set up the plot in XAML when using MVVM?
↧
New Post: WPF series visibility updates
What version of OxyPlot you are using on what platform (net 3.5, 4 or 4.5)?
↧
New Post: make "virtual internal" to "virtual internal protected" to PreTransform and PostInverseTransform Axis baseclass
Hi Objo,
Good day. One question/request...
is there a reason not having PreTransform and PostInverseTransform declared as protected since it is marked as virtual for overriddes.
I have derived a custom axis class that requires PreTransform and PostInverseTransorm to be overridden (a norm std distribution z-index axis). I had it in OxyPlot assembly previously which is fine when they were internal only. I found that it creates alot of work when i merge with your code from time to time.
So decided to move the custom axis class out of the assembly, but hit into limitation of these method not being protected.
if possible, please mark those protected so it doesnt defeat the purpose of having the derived class overrides them.
thanks again for the cool library.
Good day. One question/request...
is there a reason not having PreTransform and PostInverseTransform declared as protected since it is marked as virtual for overriddes.
I have derived a custom axis class that requires PreTransform and PostInverseTransorm to be overridden (a norm std distribution z-index axis). I had it in OxyPlot assembly previously which is fine when they were internal only. I found that it creates alot of work when i merge with your code from time to time.
So decided to move the custom axis class out of the assembly, but hit into limitation of these method not being protected.
if possible, please mark those protected so it doesnt defeat the purpose of having the derived class overrides them.
thanks again for the cool library.
↧