
Strange error
Gala wrote at 2014-06-06 16:17:
Im working with real time data and sometimes get strange error:
System.NullReferenceException: in OxyPlot.Annotations.Annotation.Transform(DataPoint p) в c:\TeamCity\buildAgent\work\3b9fcf1ba397d0ed\Source\OxyPlot\Annotations\Annotation.cs: 115
I'm using arrow anotations and check everything before adding it to the plot view.
objo wrote at 2014-06-06 20:51:
Are you adding the arrow annotation to a plot without axes/series? What platform are you on? Can you add some code that reproduces the error?
Gala wrote at 2014-06-06 21:21:
var arrow = new ArrowAnnotation();
arrow .Text = info;
arrow .StartPoint = new DataPoint(DateTimeAxis.ToDouble(currentTime), value- value/ 100000);
arrow .EndPoint = new DataPoint(DateTimeAxis.ToDouble(currentTime),value);
PlotModel.Annotations.Add(tradeToDisplay);
Thanks)objo wrote at 2014-06-06 21:51:
PlotModel.SyncRoot
when changing the model?Gala wrote at 2014-06-09 17:28:

Change labels of LinearAxis
Nirraven wrote at 2013-10-02 11:58:
I'd like to display DateTime/double values in a non-DateTime x-axis manner.
The x-axis' labels are still to be DateTimes, but with a regular distance instead of being converted to doubles.
Maybe it's more clear with this (Excel chart) pic showing the upper chart as DateTime x-axis, the lower chart as I'd like to have it displayed:
http://s8.postimg.org/fm7gx3c39/Date_Text_Axis.png
Can I achieve this with oxyplot without altering any code?
Thanks in advance!
Nirraven
objo wrote at 2013-10-02 12:25:
CategoryAxis
be used?Nirraven wrote at 2013-10-02 13:58:
Thanks a lot and keep up the great work!

Bar Histogram Charts
jpnavarini wrote at 2012-03-20 21:34:
I would like to create a bar chart, in order to estimate a Histogram. I don't need to plot the fitted histogram, only the bars, as shown on the following figure from WikiPedia: http://en.wikipedia.org/wiki/File:Black_cherry_tree_histogram.svg
I would like to have bar a chart in a linear vs. linear axes configuration. Then I would have in the bottom axis the values and in the left axis the frequency of occurence of the values in the interval defined by the bar basis.
Is is posible to do this kind of plot with OxyPlot? How it can be done?
objo wrote at 2012-03-30 13:32:
The BarSeries requires a CategoryAxis.
Try the RectangleBarSeries which should support linear axes, but this means you have to set the minimum and maximum X/Y of each rectangle (bar).

[Suggestion] OnTrackedItemChanged in PlotModel
ishlasko wrote at 2013-08-22 18:27:
That way, anyone subclassing the PlotModel could override that, and set properties that could be bound to in other parts of the GUI.
Added this myself locally, but I think others might find it useful if it was in the official build.
(By the way... Big fan of OxyPlot... Been using it professionally for a couple years now... Great library!)
objo wrote at 2013-08-22 21:04:
TrackerChanged
event on the PlotModel. It also works on windows forms where the tracker is not yet implemented... :)ishlasko wrote at 2013-08-23 14:52:
ishlasko wrote at 2013-09-05 23:15:
objo wrote at 2013-09-06 06:47:

Save and read plot
sharethl wrote at 2012-08-19 02:40:
Hi
Could any one tell me what is the best way to save plot? including annotations and series.
One way I saw an example is :
create Property class for each annotation, then serialize a collection of property classes.
when read the saved file, base on property classes to create plot with annotations.
objo wrote at 2012-08-21 13:04:
It should be possible to serialize the PlotModel, but I am not sure if I would recommend it... The data structure may change... I think the client application should be responsible for this, using its own model. I'm interested in hearing other opinions on this!
sharethl wrote at 2012-08-21 16:06:
I did test to serialize PlotModel,
Some properties could not be serialized, like Plot, OxyThichness(need add serialized attribute.)
So will user property class to make a copy of annotation and save them. easier.
Thanks
objo wrote at 2012-08-23 15:53:
I added http://oxyplot.codeplex.com/workitem/9986, it should not be difficult to fix this!

MouseDown issue with smooth curve
endorphing wrote at 2013-01-25 18:51:
I noticed that in the MouseDown example, if I enable curve smoothing, I can add new points but get an exception when trying to move a points around. I think the problem is with the e.HitTestResult.Index not being returned correctly (comments below). Is there an alternate way to get the index of the nearest point?
// Add a line series var s1 = new LineSeries("LineSeries1") { Color = OxyColors.SkyBlue, MarkerType = MarkerType.Circle, MarkerSize = 6, MarkerStroke = OxyColors.White, MarkerFill = OxyColors.SkyBlue, MarkerStrokeThickness = 1.5, Smooth = true //enable smoothing }; s1.Points.Add(new DataPoint(0, 10)); s1.Points.Add(new DataPoint(10, 40)); s1.Points.Add(new DataPoint(40, 20)); s1.Points.Add(new DataPoint(60, 30)); model.Series.Add(s1); int indexOfPointToMove = -1; // Subscribe to the mouse down event on the line series s1.MouseDown += (s, e) => { // only handle the left mouse button (right button can still be used to pan) if (e.ChangedButton == OxyMouseButton.Left) { int indexOfNearestPoint = (int)Math.Round(e.HitTestResult.Index); //indexOfNearestPoint: 297, Exception: Index was out of range. Must be non-negative and less than the size of the collection. var nearestPoint = s1.Transform(s1.Points[indexOfNearestPoint]);
objo wrote at 2013-02-10 23:31:
I think the CanonicalSplineHelper must be extended to get the index in the original point collection. Or do you have other good ideas?

Invalid Special Characters in Unit description
jpnavarini wrote at 2012-04-19 19:20:
I have some measurements in my database which are angles, measured in degrees. The unit is º, just as temperatures in degrees Celsius (ºC). However, it is not possible to represent the º character in the legend. When I add the unit as º, it is replaced by a question mark in the legend.
Is it possible to make OxyPlot understand and represent º?
Thanks!
objo wrote at 2012-04-19 21:56:
Are you using the right degree symbol (Alt+0176)? UTF-8? Is the symbol included in the font you are using? Are you using WPF, SL or WinForms?
I'll change the ExampleLibrary/AxisExamples/TitleWithUnit example to demonstrate "°C" as the unit - it works fine here.

Panning error in Log axis with Absolute Min/Max
ryoujr wrote at 2013-06-17 20:11:
I found one issue when it applies Log axis with Absolute Min/Max values, Panning should be blocked with those absolute values, but when I tried the panning, the chart showed wrong range of values and graph was disappeared.
I think I found the cause of this as below, but I'm not sure how I can apply this modification on you main source tree, so, after reviewing this I would appreciate it if you could apply this change on your main release.
in "LogarithmicAxis.cs"
public override void Pan(ScreenPoint ppt, ScreenPoint cpt)
{
...
if (newMaximum > this.AbsoluteMaximum)
{
newMaximum = this.AbsoluteMaximum;
//Original Code
// newMinimum = newMaximum * this.ActualMaximum / this.ActualMinimum;
// New Fix
newMinimum = newMaximum / this.ActualMaximum / this.ActualMinimum;
}
}
Regards, Ian Ryou.
objo wrote at 2013-06-18 12:22:
I think the correct code should be
newMinimum = newMaximum * this.ActualMinimum / this.ActualMaximum;
I am submitting the updated source code now. I have also included an example model that can be tested in the example browser.
For future bug fixes:
- create a fork
- create an example/unit test that I can use to verify that the fix is working
- submit a pull request
ryoujr wrote at 2013-06-18 18:30:

NuGet status for OxyPlot.Metro package?
cureos wrote at 2014-04-15 22:58:
many many thanks for developing and sharing this terrific library!
I have planned to use it in my Windows Store application. However, I note that whereas the OxyPlot.Core library on NuGet is currently at version 2014.1.277.1 (from April 10), the OxyPlot.Metro library is still at version 2014.1.1.1 from January 7. Why is this? And what is the current status of the Metro library on CodePlex?
It seems like the latest Core library is not fully compatible with the latest Metro library; I get a "Method Not Found" exception when trying to plot a line series (unfortunately I do not have all the data for the crash right now, but I can bring it forward if you want me to).
Best regards,
Anders @ Cureos
objo wrote at 2014-04-16 07:44:
cureos wrote at 2014-04-16 22:46:
I will upgrade to the latest version as soon as possible and give it some serious testing :-)
Best regards,
Anders @ Cureos
objo wrote at 2014-04-16 23:20:
Let us know if it is working or not!
cureos wrote at 2014-04-17 07:12:
- My Windows Store app is targeted at Windows 8(.0), and it could successfully use version 2014.1.1.1. When I update OxyPlot.Metro to the latest version, the NuGet manager does not complain. But when I build the project, I get a warning that the OxyPlot.Metro
package was built with an incompatible version, and I also get a compilation error in the auto-generated file related to my XAML view, claiming that "the namespace OxyPlot could not be found". Ideally, this incompatibility should have spotted already
by NuGet Manager, right?
- After retargeting my Windows Store app to Windows 8.1, building succeeds, except that the method "Plot.RefreshPlot()" is no longer available. In principle, I guess this is a good sign (I assume the plot is meant to update automatically in the
general case)? However, all I see is a white sheet covering the entire plot area. No axes, no curves, no nothing. I tried to replace the "RefreshPlot()" call with "InvalidatePlot()", but to no avail.
Best regards,
Anders
objo wrote at 2014-04-25 11:44:
- Is it possible to build for Windows 8.0 in VS 2013? The "target platform version" selector seems to be disabled.
- RefreshPlot has been removed, use
InvalidatePlot
. The plot is not updating automatically, you need to use the invalidate method.
cureos wrote at 2014-04-25 11:56:
- The project was originally created with VS 2012, and I have not yet performed the upgrade for this project. I am not sure, but I believe that MS intends to support Windows 8.0 for a while longer, even though they encourage users to upgrade. Would it be
possible to "downgrade" OxyPlot.Metro to Windows 8.0, or is it relying on new functionality in 8.1?
- OK, good to know.
Best regards,
Anders
objo wrote at 2014-04-25 22:07:
- No, it is not relying on any 8.1 functionality. The build machine only has VS 2013 installed and I am worried that it will be difficult to build for 8.0 there. If anyone really needs support for 8.0, please add a request in the issue tracker.

Copy chart to clipboard
jacobc1000 wrote at 2012-11-24 13:59:
Hi,
Thanks for a great project. It really works!
I am currently using it for a project that generates various barchart- and scatter charts. I'm using WPF and MVVM where the PlotModel is generated in the viewmodel each time the user changes criteria. The chart itself is hosted in <oxy:ploy> control.
I need to be able to copy the visual representation (i.e. the <oxy:plot> control) to the clipboard. Preferably as a vector image to insert into MS Office applications. I know that generating WMF/EMF files from WPF is challenging at best so a simple bitmap could also do.
What is the best way of accomplishing this? Thanks.
objo wrote at 2012-11-26 06:05:
Try Ctrl-C, the Plot control is bound to ApplicationCommands.Copy.
The Plot control also has SaveBitmap, ToBitmap, ToXaml, methods.
Or use PngExporter, SvgExporter, PdfExporter etc.
Tephyrnex wrote at 2013-03-18 15:33:
Customer support service by UserEcho