![](https://cdn.userecho.com/characters/79.png?1)
Place a moving cursor along line series
endorphing wrote at 2013-01-06 23:17:
First off, thanks for OxyPlot -- its the best charting library for WPF/Silverlight out there today!
I have a scenario where I need a small "dot" moving along a plotted line, as I move my cursor in the chart area. Basically, I need to display the co-ordinates at that dot in a label somewhere.
This example by Telerik captures this well,
http://demos.telerik.com/silverlight/#ChartView/Annotations
Is there something in OxyPlot that already does this? If not, what would be the best way to achieve this?
Thanks in advance for your help.
objo wrote at 2013-01-12 18:16:
You can write a custom 'tracker' (see example Source\Examples\WPF\WpfExamples\Examples\CustomTrackerDemo), but currently the tracker is only shown after the left mouse button has been pressed down. See also http://oxyplot.codeplex.com/workitem/9963, I think this feature is what you are looking for. Give it a vote! :)
You can also add a RectangleAnnotation (EllipseAnnotation is not yet available) to the plot, and handle the MouseMoved event of the PlotModel or the WPF/Silverlight.Plot control, but then you need to calculate and update the position of the annotation yourself.
endorphing wrote at 2013-01-14 19:49:
Thanks, I'll try the RectangleAnnotation/MouseMoved approach you described. I also gave the work item a vote.
I had another related tracker question. My scenario is as follows:
- I have two separate plots that share a common Axis, i.e., I have (X,Y,Z), and am plotting X-Y & Y-Z.
- When I track the first plot at a Y location, I need to automatically show a tracker at the corresponding Y in the second plot. This is to visualize the association between X & Z.
What's the best way to do this? MouseMoved wouldn't help here, since there is no mouse over the second plot. One option might be to have the tracker bind to a point, and show up anytime it is not null.
Appreciate any suggestions.
objo wrote at 2013-01-15 07:29:
I think writing a custom tracker would be the best solution to solve you other tracker. I don't think I will add more features into the existing tracker control (I am a bit concerned about 'feature bloat' in this library...)
![](https://cdn.userecho.com/characters/79.png?1)
Performance with multiple LinearAxis and many LineSeries
tevo wrote at 2013-01-18 22:04:
I have a plot that can only redraw at about 5 Hz and I'm looking for ideas on how to speed it up. My plot has two vertical LinearAxis, one on the lower half and one on the upper half of my plot. I plot six LineSeries on each LinearAxis. The LineSeries have 1,000 points each. I compile with optimizations enabled.
I tried turning off grid lines and making all the LineStyles = Solid. (One line always ends up being dashed anyway for some reason.) Performance hardly changed.
I tried putting six lines on the bottom axis and none on the top. Performance improved, but not by much.
I tried just having one vertical axis with six lines, and performance was similar to the previous test.
Some of the OxyPlot demos have a single line of 100k points and those are nice and quick compared to my plot. At this point is seems like the bottleneck is just having multiple lines. Does anyone have suggestions for how to get my plot to redraw faster? Thanks!
P.S. Also thanks in general to the OxyPlot devs. It's a great tool!
tevo wrote at 2013-01-21 20:22:
I did some more experiments and noticed something interesting. I think redraw rate is inversely proportional to the number of pixels "painted" by lines and markers.
This effect is clearly shown by the "LineSeries 2" examples in the Example Browser ("Performance" section). These plots have y values that alternate between zero and one, which ends up painting the line on nearly every pixel of the plot. I'm getting frame rate numbers of 4-6 Hz, which is similar to what I observed on my plot. My data set was also similar to these examples, with most of the plot pixels painted by a line.
So it seems that this behavior is known, and there's probably not an easy way to speed things up. I'd love to be proven wrong... :)
objo wrote at 2013-01-22 09:28:
The LineSeries has a property "MinimumSegmentLength" (defined in screen coordinate units) that can be used to reduce the resolution of the plotted curves. Try to increase the number if you don't mind less resolution.
I think it should be possible to reduce the number of line segments rendered also when the curve is alternating between two values, but I have not tried to implement this yet.
Also see http://oxyplot.codeplex.com/workitem/9989 if you are on WPF
tevo wrote at 2013-01-22 16:33:
Thanks for the tips! I am using WPF, so that link you provided is interesting. I tried making those changes and compiling myself. I'm not positive that I did it completely correctly, but I did see the refresh rate improve from 5 to 7 Hz. Panning performance doubled from about 5 to 10 Hz. Is there a reason that OxyPlot hasn't been updated with this change yet?
Increasing "MinimumSegmentLength" also makes a small difference, but even with extreme values my plot refresh rate improves only by 2 Hz. It's not worth it for me.
My data is not actually alternating between two values, it is just noisy. It's pretty much normally distributed. The result is the same though, because most of the plot ends up being covered by line segments. Maybe there is a way to figure out that some segments don't need to be drawn because they are completely covered by other segments.
tevo wrote at 2013-01-22 17:30:
I just found something else interesting: increasing LineSeries.StrokeThickness improves refresh rate. Small numbers like 5 improve refresh just a little, but if I use a really large number like 30, my plot is significantly faster. Any theories as to why that happens?
objo wrote at 2013-01-22 17:36:
Yes, I will look at issue 9989 soon, it has been in my backlog for a long time now.
I don't know how to reduce the number of points to render for a noisy line series, good ideas are welcome!
Can you run your application in a profiler to check if the bottleneck is in OxyPlot (while updating data or while updating the visual model) or in the WPF rendering core?
tevo wrote at 2013-01-22 19:18:
Just to be clear, because I didn't state it before: the way I've been testing refresh rate is to make a plot, then grab the corner of the window and shake my mouse. OxyPlot redraws the same plot over and over at different sizes, but nothing else about the plot is changing at all.
I profiled while doing that same test on the "LineSeries 2" examples in the Example Browser ("Performance" section). I think that the profiler is telling me that the bottleneck is WPF. Here are the top functions for inclusive samples:
100% System.Windows.Application.Run(class System.Windows.Window)
100% ExampleBrowser.App.Main()
18% OxyPlot.Wpf.Plot.OnCompositionTargetRendering(object,class System.Windows.Media.RenderingEventArgs)
18% OxyPlot.Wpf.Plot.UpdateModelAndVisuals(bool)
18% OxyPlot.Wpf.Plot.UpdateVisuals()
18% OxyPlot.Wpf.WeakEventListener`2.System.Windows.IWeakEventListener.ReceiveWeakEvent(class System.Type,object,class System.EventArgs)
18% OxyPlot.Wpf.WeakEventManagerBase`1.Handler(object,class System.EventArgs)
18% System.Windows.WeakEventManager.DeliverEvent(object,class System.EventArgs)
13% OxyPlot.PlotModel.Render(class OxyPlot.IRenderContext)
6% OxyPlot.Axis.Render(class OxyPlot.IRenderContext,class OxyPlot.PlotModel,valuetype OxyPlot.AxisLayer,int32)
6% OxyPlot.HorizontalAndVerticalAxisRenderer.Render(class OxyPlot.Axis,int32)
6% OxyPlot.PlotModel.RenderAxes(class OxyPlot.IRenderContext,valuetype OxyPlot.AxisLayer)
And here are the top functions for exclusive samples:
100% System.Windows.Application.Run(class System.Windows.Window)
4% System.Windows.UIElement.Measure(valuetype System.Windows.Size)
4% System.Windows.Controls.UIElementCollection.Clear()
1% System.Windows.Controls.UIElementCollection.Add(class System.Windows.UIElement)
1% System.Windows.DependencyObject.SetValue(class System.Windows.DependencyProperty,object)
Tom4Cat wrote at 2013-01-28 08:58:
I took the Sample LineSeries 2 - miter line joins, but moved the RefreshPlot to another thread:
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="MainWindow.xaml.cs" company="OxyPlot"> // The MIT License (MIT) // // Copyright (c) 2012 Oystein Bjorke // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // </copyright> // <summary> // Interaction logic for MainWindow.xaml // </summary> // -------------------------------------------------------------------------------------------------------------------- namespace ExampleBrowser { using System; using System.Diagnostics; using System.Threading; using System.Windows; using System.Windows.Media; /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { /// <summary> /// The frame count. /// </summary> private int frameCount; /// <summary> /// The vm. /// </summary> private MainWindowViewModel vm = new MainWindowViewModel(); /// <summary> /// The watch. /// </summary> private Stopwatch watch = new Stopwatch(); /// <summary> /// Initializes a new instance of the <see cref="MainWindow"/> class. /// </summary> public MainWindow() { this.InitializeComponent(); this.DataContext = this.vm; StartWorkerThreads(); InitSyncEvents(); CompositionTarget.Rendering += this.CompositionTargetRendering; this.watch.Start(); } /// <summary> /// Handles the Rendering event of the CompositionTarget control. /// </summary> /// <param name="sender"> /// The source of the event. /// </param> /// <param name="e"> /// The <see cref="System.EventArgs"/> instance containing the event data. /// </param> private void CompositionTargetRendering(object sender, EventArgs e) { this.frameCount++; if (this.watch.ElapsedMilliseconds > 1000 && this.frameCount > 1) { this.vm.FrameRate = this.frameCount / (this.watch.ElapsedMilliseconds * 0.001); this.frameCount = 0; this.watch.Restart(); } if (this.vm.MeasureFrameRate) { evtRefreshPlot.Set(); } } private Thread RefreshThread; private void RefreshPlot() { while (true) { WaitHandle.WaitAny(this.EvtHandleArrayRefreshPlot); if (this.EvtRefreshPlot.WaitOne(0, false)) { this.EvtRefreshPlot.Reset(); this.Plot1.RefreshPlot(true); } } } /// <summary>Gets access to attribute function</summary> private EventWaitHandle EvtRefreshPlot { get { return this.evtRefreshPlot; } } /// <summary>Gets access to attribute function</summary> private EventWaitHandle EvtRefreshPlotThreadExit { get { return this.evtRefreshPlotThreadExit; } } /// <summary>Gets access to attribute function</summary> private WaitHandle[] EvtHandleArrayRefreshPlot { get { return this.evtHandleArrayRefreshPlot; } } /// <summary> /// Initializes the worker-thread used RefreshPlot. /// </summary> /// <returns>true on success</returns> private bool StartWorkerThreads() { try { // --> create handle for thread to transmit data this.RefreshThread = new Thread(this.RefreshPlot); this.RefreshThread.Name = "Performance_Thread"; this.RefreshThread.IsBackground = true; this.RefreshThread.Priority = ThreadPriority.BelowNormal; this.RefreshThread.Start(); return true; } catch { return false; } } /// <summary>Threadsyncevent to signal to draw new measurement values</summary> private EventWaitHandle evtRefreshPlot; /// <summary>Handle to manage access to Refresh plot</summary> private WaitHandle[] evtHandleArrayRefreshPlot; /// <summary>Threadsyncevent for signal exit of RefreshPlot-Thread</summary> private EventWaitHandle evtRefreshPlotThreadExit; /// <summary> /// Initialize synchonization events /// </summary> private void InitSyncEvents() { // // Event which indicates that new values should be painted this.evtRefreshPlot = new ManualResetEvent(false); // Event which causes the worker-thread SignalDraw to quit this.evtRefreshPlotThreadExit = new ManualResetEvent(false); // --> for each thread a WaitHandle-struct is used - so a thread can wait // for different events. // WaitHandle for SignalDraw this.evtHandleArrayRefreshPlot = new WaitHandle[2]; this.evtHandleArrayRefreshPlot[0] = this.evtRefreshPlot; this.evtHandleArrayRefreshPlot[1] = this.evtRefreshPlotThreadExit; }
So I got a frame rate from about 150 Hz when I do nothing else and about 45 Hz, if I do the same tevo did (grab the corner of the window and shake my mouse).
But the updates then are not longer smooth.
Now, for my application this is not the big problem, because I have a static size of my plot. But I need many updates of my lineseries.
So to come not in conflict at updating the collection of the lineseries at refresh the plot I use thread monitor objects.
At this time I saw, the RefreshPlot is "slow" instead of the update cylce of the collections (when I use maximal update cycle based on CompositeTargetRendering.
Now I tried to build a method to only update the changed lineseries in the plot without updating all around (axes, labels, ...) but I fail (I tried to directly call the UpdateVisuals).
Maybe I overlooked the correct access to the method.
Can you give me a hint for this? Thx
![](https://cdn.userecho.com/characters/79.png?1)
Plotting data stream received by a serial port using WPF
JohnnyPP wrote at 2012-11-24 13:49:
Hello Objo,
I would like to continue the discussion: http://oxyplot.codeplex.com/discussions/401597. The idea remains the same - plotting data received by serial port but this time using WPF. My program connects successfully to the serial port and receives temperature data. The data is ready to use in private void LineReceived.
How can I plot the data point by point (sample number vs. temperature data) so that old points remain on the plot when a new point is added? How can I use MainViewModel.cs? Could you provide a code example?
MainWindow.xaml.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using OxyPlot.Wpf; using System.IO.Ports; using System.Threading; using System.Windows.Threading; namespace WpfAreaOxyPlot { /// <summary> /// Interaction logic for MainWindow.xaml /// http://oxyplot.codeplex.com/SourceControl/changeset/view/52946448ea08#Source%2fExamples%2fWPF%2fWpfExamples%2fExamples%2fAreaDemo%2fMainViewModel.cs /// </summary> public partial class MainWindow : Window { SerialPort serialPort1 = new SerialPort(); string recieved_data; public MainWindow() { InitializeComponent(); var vm = new MainViewModel(); DataContext = vm; } private void button1Connect_Click(object sender, RoutedEventArgs e) { label1Temperature.Content = "Connecting to COM3 @ 9600 baud rate"; serialPort1.PortName = "COM3"; serialPort1.BaudRate = 9600; serialPort1.DtrEnable = true; serialPort1.Open(); serialPort1.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(Recieve); if (serialPort1.IsOpen) { button1.IsEnabled = false; button2.IsEnabled = true; } label1Temperature.Content = "Connected"; } private delegate void UpdateUiTextDelegate(string text); private void Recieve(object sender, System.IO.Ports.SerialDataReceivedEventArgs e) { recieved_data = serialPort1.ReadLine(); Dispatcher.Invoke(DispatcherPriority.Send, new UpdateUiTextDelegate(LineReceived), recieved_data); } private void LineReceived(string line) { try { label1Temperature.Content = line; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } private void button2Disconnect_Click(object sender, RoutedEventArgs e) { if (serialPort1.IsOpen) { serialPort1.Close(); button1.IsEnabled = true; button2.IsEnabled = false; } } private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (serialPort1.IsOpen) { serialPort1.Close(); } } } }
MainWindow.xaml
<Window x:Class="WpfAreaOxyPlot.MainWindow" 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="AreaDemo" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Height="500" Width="1000" Closing="Window_Closing"> <Grid> <oxy:Plot x:Name="plot1" Title="Texas Instruments TMP102 Temperature Sensor" Height="461" Width="783" VerticalAlignment="Top" HorizontalAlignment="Right"> <oxy:Plot.Axes> <oxy:LinearAxis Title="Sample number" Position="Bottom" Minimum="0" Maximum="100" /> <oxy:LinearAxis Title="Temperature [°C]" Position="Left" Minimum="0" Maximum="100" FontSize="12" TicklineColor="#FF190000" TickStyle="Crossing" /> </oxy:Plot.Axes> </oxy:Plot> <Button Content="Connect to sensor" Height="23" Name="button1" Width="116" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10" Click="button1Connect_Click" IsEnabled="True"/> <Label Content="Temperature" Height="28" Name="label1Temperature" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10,130,0,0" Width="73" /> <Button Content="Disconnect" Height="23" HorizontalAlignment="Left" Margin="12,61,0,0" Name="button2" VerticalAlignment="Top" Width="114" Click="button2Disconnect_Click" IsEnabled="False"/> </Grid> </Window>
objo wrote at 2012-12-03 07:56:
Add a ScatterSeries or LineSeries and bind it to a collection of your points. Set the DataFieldX/DataFieldY to the properties you want to plot. Update the plot control when the data has changed (OxyPlot is currently not subscribing to collection change notifications).
![](https://cdn.userecho.com/characters/79.png?1)
Strange Shapes over the plotmodel
hectorcres wrote at 2012-05-28 10:53:
Hi objo !
First of all, i want to say you that im so very grateful for your work... you are helpping us a lot and all thanks is little.
Well my problem is that when im plotting a lineseries i obtain this strange shapes that interrupts the nice view of the plot.. like this http://minus.com/mPvs4xvo1/1f
When i tried to resize the plot the shapes change their appereance and I can get it disappears but it returns when i resize..
I tried to refresh the plot and the invalidate method in the plot's construct but is the same..
I would appreciate any responses.. cheers
objo wrote at 2012-05-28 12:44:
I have seen similar output when using dotted/dashed grid lines. Are you using a line style different from solid? Then a workaround is to change to solid (this is also much faster to render). I think this is a bug in WPF's dashed/dotted line rendering, we don't see similar behaviour in winforms.
You could also send the plot generating code (ctrl+alt+c) to help us reproduce the problem. Or export the plot to xaml and find the object that is causing the error!
bsguedes wrote at 2012-05-28 22:01:
I have found the same problems. It seems that this issue happens when using dotted style for grid lines (dashed and solid work fine for me)
hectorcres wrote at 2012-05-29 09:32:
Thanks a lot for your response it has resolve all my problems. i've deleted MinorGridlineStyle for both axis and this give me more capacity for analyze correctly all the data in the plot. The strange shapes have dissapear with your help. Thanks other time. Here is my old code with the MinorGridLine option.
[Example("Untitled")]
public static PlotModel Untitled() {
var plotModel1 = new PlotModel();
plotModel1.PlotAreaBackground = OxyColors.Gray;
var linearAxis1 = new LinearAxis();
linearAxis1.MajorGridlineStyle = LineStyle.Solid;
linearAxis1.MaximumPadding = 0;
linearAxis1.MinimumPadding = 0;
linearAxis1.MinorGridlineStyle = LineStyle.Dot;
linearAxis1.Position = AxisPosition.Bottom;
linearAxis1.Title = "TimeStep (20 sec)";
plotModel1.Axes.Add(linearAxis1);
var linearAxis2 = new LinearAxis();
linearAxis2.MajorGridlineStyle = LineStyle.Solid;
linearAxis2.MaximumPadding = 0;
linearAxis2.MinimumPadding = 0;
linearAxis2.MinorGridlineStyle = LineStyle.Dot;
plotModel1.Axes.Add(linearAxis2);
return plotModel1;
}
doingnz wrote at 2012-09-05 19:17:
Thank you for the very prompt help! It is now fixed.
In my application the rendering problem is only experienced if MinorGridLineStyle. is set to
LineStyle.Dot
I quickly tried the other line styles and they appear to work fine!
This should be reported to WPF group at Microsoft.
Or
LineStyle.DashDotDot
![](https://cdn.userecho.com/characters/79.png?1)
LineAnnotation, top axis and other plot interaction
PythagDev wrote at 2012-09-05 16:48:
Short version: Vertical LineAnnotation doesn't go all the way across the plot.
Long version: I'm using multiple PlotModels in a vertical stackpanel (WPF) to show a number of signals. The top PlotModel has a top and bottom horizontal axis. The remaining PlotModels only have a bottom axis. The top axis is time. The bottom axes on all the graphs are a time index value that the data is referenced to, but is meaningless to the user. Occasionally there are breaks in the time. I wanted to show that by a vertical line where there was a time break. I used a LineAnnotation to do that and it mostly works. However, on the top plot the line starts at the top of the top axis and goes a little ways down into the plot area of the graph then stops, but ONLY if there is another PlotModel on the stackpanel that uses a vertical CategoryAxis (used for discrete signals). If there are only analog signals (using a vertical LinearAxis), the line goes all the way down the plot like the rest of the graphs. I've stepped through the LineAnnotation:Render code and it seems to form the points and clip correctly. I'd appreciate any help in determining why this is doing this!
Thanks.
PythagDev wrote at 2012-09-05 16:59:
Actually, if there are only PlotModels that use LinearAxis for their vertical axis, the top PlotModel LineAnnotation still stops a little short of the bottom horizontal axis, but it gets a lot closer.
objo wrote at 2012-09-05 19:25:
Are you creating the plots by XAML, or do you bind PlotModels to the Model property? Are you using DataTemplates? Could it be related to http://oxyplot.codeplex.com/workitem/10000?
Can you send an image how it looks? Or generated code (Ctrl+Alt+C) to reproduce the error?
PythagDev wrote at 2012-09-05 21:17:
Thanks for the quick response. I do this programmatically, not in XAML and don't use data templates. I bind the plot model to the model properties:
foreach (PlotModel lPlotModel in graphData.PlotModels)
{
OxyPlot.Wpf.Plot lPlot = new Plot();
lPlot.Model = lPlotModel;
if (lPlotIndex == 0) {
// add extra space on first graph for top time axis
lPlot.Height = graphData.PlotHeights[lPlotIndex] + 30;
}
else {
lPlot.Height = graphData.PlotHeights[lPlotIndex];
}
lPlot.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
lPlot.Margin = new Thickness(0, 0, 2, 0);
// snipped out putting filter on axes to limit data range shown
// MainGraphDisplay is the stackpanel
MainGraphDisplay.Children.Add(lPlot);
lPlotIndex++;
}
The code to create the line annotation looks like:
foreach (int lTimeBreak in lTimeBreaks) { LineAnnotation lVertBar = new LineAnnotation(); lVertBar.LineStyle = LineStyle.Solid; lVertBar.Color = OxyColor.FromRGB(255, 0, 0); lVertBar.Type = LineAnnotationType.Vertical; lVertBar.X = lTimeBreak; lVertBar.Layer = AnnotationLayer.AboveSeries; lVertBar.ClipByXAxis = false; foreach (PlotModel lPlotModel in PlotModels) { lPlotModel.Annotations.Add(lVertBar); } } I'd love to attach a screenshot but haven't figured out how to.
objo wrote at 2012-09-05 23:12:
try creating a new instance of the LineAnnotation for each PlotModel.
PythagDev wrote at 2012-09-06 03:43:
Good tip. I should have thought of that!
Rob
From: objo [email removed]
Sent: Wednesday, September 05, 2012 4:13 PM
To: rcoker@pythagdev.com
Subject: Re: LineAnnotation, top axis and other plot interaction [oxyplot:394496]
From: objo
try creating a new instance of the LineAnnotation for each PlotModel.
PythagDev wrote at 2012-09-06 03:50:
That did fix the problem. It makes sense because the discrete signal plots were much shorter, so when the endpoints were determined it was a short line - the short line was being reused in the top graph since it was after all the same object.
Thanks a ton!
![](https://cdn.userecho.com/characters/79.png?1)
HeatMapSeries Update Bug
<code> var currentDataHash = this.Data.GetHashCode(); // Hashes the this.Data // reference, and NOT the // contents of this.Data var currentColorAxisHash = this.ColorAxis.GetElementHashCode(); if (this.image == null || currentDataHash != this.dataHash || currentColorAxisHash != this.colorAxisHash) { this.UpdateImage(); this.dataHash = currentDataHash; this.colorAxisHash = currentColorAxisHash; } The currentDataHash is a hash of the this.Data reference, not of the contents of this.Data itself. So if the contents of this.Data are updated and the changes don't result in a change to this.ColorAxis.GetElementHashCode(), then the image will not be updated.
I am happy to help fix this, but want to be sure that my interpretation of this is correct before proceeding. So, question for OxyPlot developers:
- Do you agree this is a bug?
- If so, suggested approach for fixing (I can think of a few)?
- If not, do you agree that the HeadMapSeries documentation could at least be updated to reflect this information?
objo wrote at 2014-04-25 11:36:
Data
reference. I also think the actual update of the image should be done during the update of the model (some refactoring may be needed to do this), not during rendering. But we must ensure the update of the image is not called when it is not
needed, since it is an expensive operation. Could we add a HeatMapSeries.Invalidate
method to invalidate the image? Let us know if you have other ideas!
Documentation is high priority, but it may still take some time before it is complete and up to date. Please contribute :-)
HeatMapSeries
and the PlotModel
.![](https://cdn.userecho.com/characters/108.png?1)
Candle overlap each candle
Axises
DateTimeAxis timeSPanAxis1 = new DateTimeAxis() {
Position = AxisPosition.Bottom,
MinorIntervalType = DateTimeIntervalType.Minutes,
MajorGridlineStyle = LineStyle.Dot,
MinorGridlineStyle = LineStyle.Dot,
MajorGridlineColor = OxyColor.FromRgb(44, 44, 44),
TicklineColor = OxyColor.FromRgb(82, 82, 82),
};
PlotModel.Axes.Add(timeSPanAxis1);
LinearAxis linearAxis1 = new LinearAxis()
{
Position = AxisPosition.Right,
MajorGridlineStyle = LineStyle.Dot,
MinorGridlineStyle = LineStyle.Dot,
MajorGridlineColor = OxyColor.FromRgb(44, 44, 44),
TicklineColor = OxyColor.FromRgb(82, 82, 82)
};
PlotModel.Axes.Add(linearAxis1);
and candle stick series CandleStickSeries candle = new CandleStickSeries() { Color = OxyColors.Black, IncreasingColor = OxyColor.FromRgb(0,197,49), DecreasingColor = OxyColor.FromRgb(255,95,95), DataFieldX = "Time", DataFieldHigh = "H", DataFieldLow = "L", DataFieldClose = "C", DataFieldOpen = "O", TrackerFormatString = "Date: {2}\nOpen: {5:0.00000}\nHigh: {3:0.00000}\nLow: {4:0.00000}\nClose: {6:0.00000}", };
Why is this happening? How to fix it?![](https://cdn.userecho.com/characters/79.png?1)
[Solved] UserControl: XamlParseException
Nikzeno wrote at 2014-06-18 12:51:
I'm a newbie to OxyPlot and WPF. I was able to run this example and adding some more fun stuff in a stand-alone application.
But when I try to make a User Control Library I keep getting a XamlParseException: impossible to load OxyPlot.Wpf, PublicKeyToken=75e952ba404cdbb0
In the main program I simply have an empty window with my control. The xaml in VS renders fine!
I'm using VS 2013 Update 2, Win 7, .net 4 or 4.5 behaves the same.
Oxyplot is 2014.1.318.1
It's probably a stupid trivial error, but I need somebody to point me to the right direction!
Thanks!
<UserControl x:Class="WpfControlLibrary1.UserControl1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:oxy="http://oxyplot.codeplex.com"
xmlns:local="clr-namespace:WpfControlLibrary1"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.DataContext>
<local:MainViewModel/>
</UserControl.DataContext>
<Grid>
<oxy:PlotView Title="{Binding Title}">
<oxy:PlotView.Series>
<oxy:LineSeries ItemsSource="{Binding Points}"/>
</oxy:PlotView.Series>
</oxy:PlotView>
</Grid>
</UserControl>
namespace WpfControlLibrary1
{
/// <summary>
/// Interaction logic for UserControl1.xaml
/// </summary>
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
}
}
public class MainViewModel
{
public MainViewModel()
{
this.Title = "Example 2";
this.Points = new List<DataPoint>
{
new DataPoint(0, 4),
new DataPoint(10, 13),
new DataPoint(20, 15),
new DataPoint(30, 16),
new DataPoint(40, 12),
new DataPoint(50, 12)
};
}
public string Title { get; private set; }
public IList<DataPoint> Points { get; private set; }
}
}
Nikzeno wrote at 2014-07-02 11:15:
For some reason VS was not copying OxyPlot.wpf.dll in the necessary path... I had to do it manually.
Oddly enough this happened also on another PC with Windows 8.1...
objo wrote at 2014-07-02 12:43:
Nikzeno wrote at 2014-07-02 14:18:
![](https://cdn.userecho.com/characters/79.png?1)
VS 2012 SimpleDemo: Plot won't render in WPF XAML Designer at Design Time
CMC wrote at 2013-02-03 19:23:
Second, WPF is not my strong suit.
Third, here's the issue:
I tried to replicate the SimpleDemo in a new VS2012 WPF app project and when adding the line to the XAML:
<oxy:Plot Model="{Binding Model}" />
The XAML designer errors and if I close / reopen the XAML the designer crashes with the error below. The project compiles and when I run it it works fine. Your example works in the designer fine. I created another project within your source set of projects and the XAML designer crashes in that project too, then I noticed that in your SimpleDemo's csproj file the references to OxyPlot and OxyPlot.WPF are project level references, not just the DLLs.
<ProjectReference Include="..\..\..\OxyPlot.Wpf\OxyPlot.Wpf.csproj">
<Project>{698CCD8E-ADCC-4565-8517-5EDD36F07155}</Project>
<Name>OxyPlot.Wpf</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\OxyPlot\OxyPlot.csproj">
<Project>{87F519B8-5A2F-48C6-AD53-C5F13A82EA6B}</Project>
<Name>OxyPlot</Name>
</ProjectReference>
When I copied the contents of the SimpleDemo.csproj to the project I created within your source projects solution, then the designer did not crash.EDIT: I am using the standard .NET 4.5 libraries, as is your example project. I see OxyPlot uses the .NET Portable Subset, if that makes any difference.
I'm thinking I'm not doing something right as others have not mentioned this. Comments from anyone with clues to my error are welcome. Here's the error. Not finding System.Core is a false flag, I think, and that the error is associated with the line I bolded, I'm pretty sure...
Microsoft.Expression.DesignHost.Isolation.Remoting.RemoteException
Could not load file or assembly 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The system cannot find the file specified.
at OxyPlot.PlotModel.Update(Boolean updateData)
at OxyPlot.Wpf.Plot.UpdateModel(Boolean updateData) in c:\Source Code\3rdParty\OyxPlot\oxyplot_f91998730020\Source\OxyPlot.Wpf\Plot.cs:line 1485
at OxyPlot.Wpf.Plot.UpdateModelAndVisuals(Boolean updateData) in c:\Source Code\3rdParty\OyxPlot\oxyplot_f91998730020\Source\OxyPlot.Wpf\Plot.cs:line 1498
at OxyPlot.Wpf.Plot.ArrangeOverride(Size arrangeBounds) in c:\Source Code\3rdParty\OyxPlot\oxyplot_f91998730020\Source\OxyPlot.Wpf\Plot.cs:line 681
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.UIElement.UpdateLayout()
at System.Windows.Interop.HwndSource.SetLayoutSize()
at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
at System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
at Microsoft.Expression.DesignHost.Isolation.Remoting.RemoteUIElement.<>c__DisplayClass12.<Microsoft.Expression.DesignHost.Isolation.Remoting.IRemoteUIElement.CreateContent>b__11()
at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.<>c__DisplayClass16`1.<MarshalIn>b__15()
at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.Call.InvokeWorker()
at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.Call.Invoke(Boolean waitingInExternalCall)
at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.InvokeCall(Call call)
at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.ProcessQueue(CallQueue queue)
at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.ProcessInboundAsyncQueue(Int32 identity)
at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.ProcessMessage(Int32 msg, IntPtr wParam, Boolean elevatedQuery, Boolean& handled)
at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.OnWindowMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at Microsoft.Expression.DesignHost.Isolation.Remoting.MessageOnlyHwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at Microsoft.Expression.DesignHost.Isolation.IsolationProcess.RunApplication()
at Microsoft.Expression.DesignHost.Isolation.IsolationProcess.<>c__DisplayClass2.<Main>b__0()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
CMC wrote at 2013-02-03 21:39:
... oxyplot_f91998730020\Source\OxyPlot.Wpf\bin\Debug\NET40\
it works fine. If I go back to my VS2012 SimpleDemo project and re-target the VS2012 project to .Net 4.0, and reference the same 4.0 OxyPlot and OxyPlot.WPF libraries the Xaml Designer still crashes. The problem may be with my VS 2012 Pro (?).
objo wrote at 2013-02-03 21:58:
I also tested using the WPF designer, drag-dropping a OxyPlot.Wpf.Plot control from the Toolbox works in my VS2012 with .NET 4.5.
Let us know if you find out more!
CMC wrote at 2013-02-03 22:53:
Thank you for your very fast response. Unfortunately that did not resolve my issue. I reset my VS 2012 settings, added the OxyPlot.WPF library to my toolbox (I had not tried using the toolbox way) and created a new WPF Application in VS 2012 and dragged the Plot object onto the XAML window in the designer and receive the same error. I will investigate and if I can determine the cause I will post here.
EDIT: I'm thinking that somewhere there's a reference to System.Core version 2.0.5.0 (used maybe for Silverlight?) because the OxyPlot library itself is "multi-targeted" that my VS 2012 will not resolve, while VS 2010 will. (thinking out loud).
Update: I discovered that the Silverlight 5.x System.Core.dll has the same PublicKeyToken=7cec85d7bea7798e so it is a Silverlight System.Core that my VS 2012 does not resolve, so I used gacutil to register that library in the GAC and rebooted but still get the error.
I also tried building a Silverlight app in VS 2012 using OxyPlot.Silverlight and it works OK.
j0tape wrote at 2013-02-07 17:45:
I have the same trouble.
I tried with all versions between 1.12 to 1.28. In all of them I have the mistake in design time.
for instance in binary distribution of 1.28 version.
FileNotFoundException: Could not load file or assembly 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies.
StackTrace
at OxyPlot.PlotModel.Update(Boolean updateData)
at OxyPlot.Wpf.Plot.UpdateModel(Boolean updateData) in c:\TeamCity\buildAgent\work\f48330714bade418\Source\OxyPlot.Wpf\Plot.cs:line 1485
at OxyPlot.Wpf.Plot.UpdateModelAndVisuals(Boolean updateData) in c:\TeamCity\buildAgent\work\f48330714bade418\Source\OxyPlot.Wpf\Plot.cs:line 1498
at OxyPlot.Wpf.Plot.ArrangeOverride(Size arrangeBounds) in c:\TeamCity\buildAgent\work\f48330714bade418\Source\OxyPlot.Wpf\Plot.cs:line 681
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.UIElement.UpdateLayout()
at OxyPlot.Wpf.Plot.OnApplyTemplate() in c:\TeamCity\buildAgent\work\f48330714bade418\Source\OxyPlot.Wpf\Plot.cs:line 533
at System.Windows.FrameworkElement.ApplyTemplate()
at Microsoft.Expression.WpfPlatform.WpfViewNodeManager.EnsureElementInDictionary(Object root, ViewNode knownAncestor)
My workaround was to go back to the version 1.10. I have: VS2012 PRO.
objo wrote at 2013-02-07 22:33:
I see that the examples included in the OxyPlot solution are ok, it only happens when referencing the assemblies from other solutions.
I tried recreating the OxyPlot core and WPF projects without finding any significant differences, and the references should be correct.
The OxyPlot core library is using TargetFrameworkProfile "Profile2" (.NET 4.0 and higher, SL 4 and higher).
Does anyone else know what is going on here?
CMC wrote at 2013-02-08 02:26:
objo wrote at 2013-02-10 22:52:
I recreated the OxyPlot.Wpf solution file, created new projects OxyPlot (PCL), OxyPlot.Wpf (.NET 4.5) and a OxyPlot.Wpf_NET40 (.NET 4.0).
The OxyPlot.Wpf.csproj was missing a line:
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
I merged this into the existing projects. If this doesn't help I may need to go the long way and recreate all the solutions.
I also corrected ProjectGuid mismatches in the .sln and .csproj files, I think these should be correct now.
tibel wrote at 2013-02-16 08:22:
It seems that OxyPlot.Wpf is referencing the mscorlib two times. The wrong mscorlib is Version=2.0.5.0.
OxyPlot:
// mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
// System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
// System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
// System.Xml, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
// System.Net, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
OxyPlot.Wpf:
// PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// OxyPlot, Version=2013.1.32.1, Culture=neutral, PublicKeyToken=638079a8f0bd61e9
// System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
// System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Sample45Pcl:
// mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
// System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
Sample45Wpf:
// PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
UPDATE: Found a hint that this might be an C# compiler bug:PCL in VS2012 incorrectly resolves mscrolib version in netmodule references
Also this issue (with two mscorlib references) applies to OxyPlot.Silverlight. You have to check all assemblies with ILSpy.
Maybe recreating all projects and references helps, else you would have to remove the invalid reference from the compiled assembly using something like ildasm or Mono.Cecil and resign the assembly afterwards.
objo wrote at 2013-02-16 12:04:
dotPeek gives me the following information for OxyPlot.Wpf.dll
// References: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// References: mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes
Does the Retargetable=Yes mean something? I tried adding
<Reference Include="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<SpecificVersion>True</SpecificVersion>
</Reference>
to the OxyPlot.Wpf.csproj, but this made no difference. Can a FusionName
in the
Reference be used, or is this only to optimize loading?
What about the
ToolsVersion
attribute and the OldToolsVersion
element in the .csproj file, should these be set differently?
I am not too concerned if there is a bug in the VS designer as long as the WPF and Silverlight applications seems to work correctly.
If there is a problem with the C# compiler, I prefer to revert back to the old solution where OxyPlot.dll was targetted for each platform. It should still be possible to keep an OxyPlot.Core NuGet package.
tibel wrote at 2013-02-16 18:48:
Please vote to get it fixed!!!
Hopefully we also get a workaround for the meantime.
objo wrote at 2013-02-16 22:13:
I found that the use of
CultureInfo
/IFormatProvider
causes problems. Maybe the
Culture
properties should be changed to string?tibel wrote at 2013-02-17 06:44:
He suggested Fody to remove the duplicate mscorlib reference.
Simon Cropp (author of Fody) is also aware of this issue and will create a plugin for Fody (see tweet).
So lets wait a few hours/days before removing all
CultureInfo
properties from OxyPlot core. Maybe this is not the only cause of the bug?objo wrote at 2013-02-17 07:49:
davkean wrote at 2013-02-18 05:32:
Ignore the duplicate mscorlib above - this is a red herring and normal in this case. The other issue, called out on the Portable Library Tools site on VS Gallery, is something completely different. I wrote a little more around this here: https://github.com/Fody/Fody/issues/43.
It appears that above is a WPF Designer bug around handling portable libraries (that is assuming that OxyPlot itself isn't calling LoadFile, which I downloaded the source and it appears it doesn't). I've raise the issue internally, and trying to get a repro.
For those that are hitting this - can you confirm what version of Visual Studio you are running? VS Update 1? VS Update 2? Can you try VS Update 2 if don't have it installed? We did fix one designer bug around portable, but I'm not sure if affected WPF or not.
CMC wrote at 2013-02-18 16:51:
Version 11.0.51106.01 Update 1
Microsoft .NET Framework Version 4.5.50709
On Win 7 x64
... I check for Windows Updates and no DL for Update 2 is offered.
tibel wrote at 2013-02-18 17:19:
I have tested now with VS2012 Update 2 CTP 3 and still get the same error.
Uploaded the sample to my skydrive.
Technicolour wrote at 2013-02-22 01:00:
I get the following with VS2010
Could not load file or assembly 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
I back installed to 2013.1.6.1 which builds fine.
tibel wrote at 2013-02-26 07:24:
I think the bug in Visual Studio Designer will not be fixed in a short time.
Davkean told me that it will not be part of VS 2012 Update 2 (probably).
In the meantime best will be to change Core Library from PCL to platform projects.
objo wrote at 2013-03-05 23:13:
I added http://oxyplot.codeplex.com/workitem/10036, I hope I got the description of the problem right.
Personally, I never use the WPF designer, so this is not a high priority issue to me. Will consider reverting if the number of votes gets high!
dsplaisted wrote at 2013-03-06 04:59:
To work around this, I don't think you need to revert back to a platform-specific version of OxyPlot.dll for each platform you support. Rather, you can keep the PCL version, and in addition have a version that is compiled for .NET 4. You would put the .NET 4 version of OxyPlot.dll in the lib\NET40 and lib\NET45 folders of the OxyPlot.Wpf package. The .NET 4 version of OxyPlot.dll should have the exact same identity (name, version, and strong name) as the PCL version.
The effect of this would be that you would still use the PCL OxyPlot core in most cases. Only if you referenced the OxyPlot.Wpf package would you get the one compiled for .NET 4. This would likely fix the issue with the designer. Since both versions of OxyPlot.dll would have the same identity (and APIs), a portable library compiled against the portable version will work if the .NET 4 version is the one that's actually included in the app.
Thanks,
Daniel Plaisted
Microsoft
objo wrote at 2013-03-13 21:18:
I don't like mixing different versions of the core library(even if it will work), so I suggest to add an alternative solution for WPF based on .NET 4 which also includes the pdf and openxml libraries. Let me know if this is not a good solution.
I have submitted the solution
OxyPlot.WPF_NET40x.sln
, which contains the core library compiled for .NET 4 and the pdf, openxml and wpf libraries depending on this version. The output of the solution is pushed to the NuGet package
OxyPlot.Wpf_NoPCL. I hope this is a satisfactory workaround for those who want to use the VS designer in a WPF 4.0 or 4.5 project. And when the VS designer bug is eventually fixed, this
solution should be deleted.scramble wrote at 2013-03-14 11:46:
thebigkahune wrote at 2013-05-29 15:48:
objo wrote at 2013-06-28 11:30:
https://www.microsoft.com/en-us/download/details.aspx?id=39305"
gui wrote at 2013-07-29 01:57:
Microsoft.Expression.DesignHost.Isolation.Remoting.RemoteExceptionMy Visual studio configuration :
Could not load file or assembly 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The system cannot find the file specified.
at OxyPlot.PlotModel.Update(Boolean updateData)
at OxyPlot.Wpf.Plot.UpdateModel(Boolean updateData) in c:\TeamCity\buildAgent\work\f48330714bade418\Source\OxyPlot.Wpf\Plot.cs:line 1493
at OxyPlot.Wpf.Plot.UpdateModelAndVisuals(Boolean updateData) in c:\TeamCity\buildAgent\work\f48330714bade418\Source\OxyPlot.Wpf\Plot.cs:line 1506
at OxyPlot.Wpf.Plot.ArrangeOverride(Size arrangeBounds) in c:\TeamCity\buildAgent\work\f48330714bade418\Source\OxyPlot.Wpf\Plot.cs:line 689
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.UIElement.UpdateLayout()
at System.Windows.Interop.HwndSource.SetLayoutSize()
at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
at System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
at Microsoft.Expression.DesignHost.Isolation.Remoting.RemoteUIElement.<>c__DisplayClass12.<Microsoft.Expression.DesignHost.Isolation.Remoting.IRemoteUIElement.CreateContent>b__11()
at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.<>c__DisplayClass16`1.<MarshalIn>b__15()
at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.Call.InvokeWorker()
at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.Call.Invoke(Boolean waitingInExternalCall)
at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.InvokeCall(Call call)
at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.ProcessQueue(CallQueue queue)
at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.ProcessInboundAsyncQueue(Int32 identity)
at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.ProcessMessage(Int32 msg, IntPtr wParam, Boolean elevatedQuery, Boolean& handled)
at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.OnWindowMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at Microsoft.Expression.DesignHost.Isolation.Remoting.MessageOnlyHwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at Microsoft.Expression.DesignHost.Isolation.IsolationProcess.RunApplication()
at Microsoft.Expression.DesignHost.Isolation.IsolationProcess.<>c__DisplayClass2.<Main>b__0()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Microsoft Visual Studio Ultimate 2012The package I got from nuget:
Version 11.0.60610.01 Update 3
Microsoft .NET Framework
Version 4.5.50709
<package id="OxyPlot.Core" version="2013.1.52.1" targetFramework="net45" />I use .NET 4.5 for my WPF application.
<package id="OxyPlot.Wpf" version="2013.1.52.1" targetFramework="net45" />
About workaround, im currently using the no Pcl package to resolve my issue. OxyPlot.Wpf_NoPCL
But the noPCL is not as updated as the one with Pcl, so I guess this solution is temporary.
gui wrote at 2013-08-01 01:06:
objo wrote at 2013-08-07 13:18:
I created a new WPF/.NET 4.5 project and added the OxyPlot.WPF 2013.1.52 nuget package.
I am using
Microsoft Visual Studio Premium 2012
Version 11.0.60610.01 Update 3
Microsoft .NET Framework
Version 4.5.50709
on a clean machine with a fresh installation of Visual Studio.
tevo wrote at 2013-08-27 21:19:
I'm having this issue with the NET45 WPF DLLs from OxyPlot-2013.1.67.1.zip. I have all the latest updates for Windows 7, .NET 4.5, and VS 2012. Any suggestions?
objo wrote at 2013-08-28 00:06:
Do you have the latest update (3) of Visual Studio?
tevo wrote at 2013-08-28 15:19:
JaLePi wrote at 2013-11-19 21:24:
I've just repaired Visual Studio installation, that also repaired .Net Framework 4.5 installation as well.
joaofigueira65 wrote at 2013-11-23 17:30:
akmm94 wrote at 2014-06-16 18:25:
![](https://cdn.userecho.com/characters/79.png?1)
FileNotFoundException in XAML designer (Visual Studio 2012/2013)
evan_w wrote at 2014-01-14 16:14:
System.IO.FileNotFoundException: Could not load file or assembly 'System.Core, Version=2.0.5.0 [...]
in the XAML designer. I've confirmed this issues exists on my system in both
Visual Studio 2012 and Visual Studio 2013, using projects configured for both .NET 4.0 and .NET 4.5.
![Image](http://i.imgur.com/NtXnCnj.png)
Here is my implementation of OxyPlot in XAML:
<oxy:Plot x:Name="Plot"></oxy:Plot>
I've seen other posts reporting similar issues with OxyPlot, with the common recommendation being to repair Visual Studio. Unfortunately, repairing Visual Studio or the .NET Framework has not resolved the issue for me.
Interesting (although perhaps not indicative of a problem): I'm observing details in the stack trace that indicate a file system structure that does not exist on my system:
at OxyPlot.Wpf.Plot.UpdateModel(Boolean updateData) in c:\TeamCity\buildAgent\work\f48330714bade418\Source\OxyPlot.Wpf\Plot.cs:line 1362
. Perhaps this might be related?
The OxyPlot component does work properly at runtime, as shown with this example:
![Image](http://i.imgur.com/qzxl9VR.png)
Here's the full exception from the XAML designer:
System.IO.FileNotFoundException
Could not load file or assembly 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. The system cannot find the file specified.
at OxyPlot.PlotModel.Update(Boolean updateData)
at OxyPlot.Wpf.Plot.UpdateModel(Boolean updateData) in c:\TeamCity\buildAgent\work\f48330714bade418\Source\OxyPlot.Wpf\Plot.cs:line 1362
at OxyPlot.Wpf.Plot.UpdateModelAndVisuals(Boolean updateData) in c:\TeamCity\buildAgent\work\f48330714bade418\Source\OxyPlot.Wpf\Plot.cs:line 1375
at OxyPlot.Wpf.Plot.ArrangeOverride(Size arrangeBounds) in c:\TeamCity\buildAgent\work\f48330714bade418\Source\OxyPlot.Wpf\Plot.cs:line 671
at System.Windows.FrameworkElement.ArrangeCore(Rect finalRect)
at System.Windows.UIElement.Arrange(Rect finalRect)
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.UIElement.UpdateLayout()
at System.Windows.Interop.HwndSource.SetLayoutSize()
at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
at System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
at Microsoft.Expression.DesignHost.Isolation.Remoting.RemoteUIElement.<>c__DisplayClass10.<Microsoft.Expression.DesignHost.Isolation.Remoting.IRemoteUIElement.CreateContent>b__f()
at Microsoft.Expression.DesignHost.Isolation.Remoting.ThreadMarshaler.<>c__DisplayClass2a`1.<MarshalIn>b__29()
at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.Call.InvokeWorker()
at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.Call.Invoke(Boolean waitingInExternalCall)
at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.InvokeCall(Call call)
at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.ProcessQueue(CallQueue queue)
at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.ProcessInboundAsyncQueue(Int32 identity)
at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.ProcessMessage(Int32 msg, IntPtr wParam, IntPtr lParam, Boolean elevatedQuery, Boolean& handled)
at Microsoft.Expression.DesignHost.Isolation.Remoting.STAMarshaler.OnWindowMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at Microsoft.Expression.DesignHost.Isolation.Remoting.MessageOnlyHwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at Microsoft.Expression.DesignHost.Isolation.DesignerProcess.RunApplication()
at Microsoft.Expression.DesignHost.Isolation.DesignerProcess.<>c__DisplayClass2.<Main>b__0()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Thanks for any help, and please let me know if I can provide additional information.evan_w wrote at 2014-01-14 16:26:
evan_w wrote at 2014-01-14 17:47:
Prerequisite: In my project, I'm observing a
System.IO.FileNotFoundException
as stated earlier.
- Remove all OxyPlot references from the project
- Add only the
OxyPlot.Wpf
reference to the project by referencing the compiled DLL - Download the OxyPlot source code, then in the existing solution, add and "Existing Project"
oxyplot/Source/OxyPlot/OxyPlot.csproj
- In the project with the
FileNotFound
exception, add a new reference, and select Solution → Projects, then select the OxyPlot project from the list.
System.IO.FileNotFoundException: Could not load file or assembly 'System.Core, Version=2.0.5.0 [...]
error is no longer displayed.Obviously this isn't an ideal solution as it requires a reference to the OxyPlot source code to be included with my solution. However, I'm hoping this may be meaningful to others when considering this issue.
objo wrote at 2014-01-14 20:01:
I can reproduce the XAML designer error in VS 2012 Upgrade 4, but not in VS 2013. Could it be that Profile136 is not properly supported in the VS 2012 designer?
Eduarte78 wrote at 2014-01-17 18:57:
I've tried both adding this into an existing project, and as a separate project in my solution. In both cases I get the error raised at the XAML line: <oxy:Plot Model="{Binding ViewModel.MainPlotModel}"/>.
My VS info is:
Microsoft Visual Studio Ultimate 2013
Version 12.0.21005.1 REL
Microsoft .NET Framework
Version 4.5.50938
Installed Version: Ultimate
Here are the exception details:
System.Windows.Markup.XamlParseException occurred
HResult=-2146233087
Message=Could not load file or assembly 'OxyPlot.Wpf, PublicKeyToken=75e952ba404cdbb0' or one of its dependencies. The system cannot find the file specified.
Source=PresentationFramework
LineNumber=11
LinePosition=10
StackTrace:
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at MemoryPlotControl.MemoryPlotView.InitializeComponent() in s:\SWDEV\Timelines\Timelines_v3.0_Fourier_sandbox\Source\MemoryPlotControl\MemoryPlotView.xaml:line 1
at MemoryPlotControl.MemoryPlotView..ctor(TopViewModel topVM) in s:\SWDEV\Timelines\Timelines_v3.0_Fourier_sandbox\Source\MemoryPlotControl\MemoryPlotView.xaml.cs:line 28
InnerException: System.IO.FileNotFoundException
HResult=-2147024894
Message=Could not load file or assembly 'OxyPlot.Wpf, PublicKeyToken=75e952ba404cdbb0' or one of its dependencies. The system cannot find the file specified.
Source=mscorlib
FileName=OxyPlot.Wpf, PublicKeyToken=75e952ba404cdbb0
FusionLog==== Pre-bind state information ===
LOG: DisplayName = OxyPlot.Wpf, PublicKeyToken=75e952ba404cdbb0
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: OxyPlot.Wpf, PublicKeyToken=75e952ba404cdbb0 | Domain ID: 1
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///S:/SWDEV/Timelines/Timelines_v3.0_Fourier_sandbox/Source/TimeLinesShell/bin/x86/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
Eduarte78 wrote at 2014-01-17 19:16:
- VS2013
- directly referenced the nuget OxyPlot.Wpf 2014.1.1.1
- added the Source/OxyPlot/OxyPlot.csproj
objo wrote at 2014-01-27 19:37:
Can you reproduce the error in any of the included examples?
Loulou_75016 wrote at 2014-03-03 10:21:
I have exactly the same problem with VS2012 Update 4 (Win 8.1 64Bit French). Problem in designer, but you can compile and runs your app.
Same error FileNotFoundException: Could not load file or assembly 'System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. Le fichier spécifié est introuvable. (-> This specified file can not be found)
StackTrace (seems to be a bit different at the end)
at OxyPlot.PlotModel.Update(Boolean updateData)
at OxyPlot.Wpf.Plot.UpdateModel(Boolean updateData)
at OxyPlot.Wpf.Plot.InvalidatePlot(Boolean updateData)
at OxyPlot.Wpf.Plot.PlotLoaded(Object sender, RoutedEventArgs e)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)
at MS.Internal.LoadedOrUnloadedOperation.DoWork()
at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
InnerException: none
objo wrote at 2014-03-03 10:44:
In VS 2013 Update 1 there are no errors in the WPF designer view.
Also see a similar thread: https://oxyplot.codeplex.com/discussions/471989
(search for "Visual Studio", "designer", "pcl" in the discussions and issues)
Loulou_75016 wrote at 2014-03-03 11:37:
tibel wrote at 2014-03-03 12:59:
Stay with Update 3 or use VS2013.
badbadboy wrote at 2014-03-05 14:05:
I had VS2013 update 1, but that was not enough.
oloopy wrote at 2014-04-01 19:19:
gslysz wrote at 2014-04-15 18:36:
Customer support service by UserEcho