This is the discussion forum for OxyPlot.
For bugs and new features, use the issue tracker located at GitHub.
Also try the chat room!
0
Ülevaatamisel

Loading JPEG to OxyImage

Dvojnik 10 aastat tagasi uuendaja Oystein Bjorke 10 aastat tagasi 1
Hello,
I have trouble loading JPEG images to OxyImage. I am using C# and WPF, OxyPlot version 2014.1.546.0 from NuGet. PNG and BMP images work great, but not JPEGs. I tried loading them using stream and bytearray

OxyImage image; 
FileStream stream = new FileStream(filepath, FileMode.Open);
image = new OxyImage(stream);

OxyImage image1;
byte[] imageArray = File.ReadAllBytes(filepath);
image1 = new OxyImage(imageArray);
Both without success (crashes on line with new OxyImage). I get this error message:

System.NotImplementedException was unhandled by user code HResult=-2147467263
Message=The method or operation is not implemented.
Source=OxyPlot
StackTrace:
at OxyPlot.OxyImage.GetDecoder(ImageFormat format) in c:\projects\oxyplot\Source\OxyPlot\Imaging\OxyImage.cs:line 164
at OxyPlot.OxyImage.UpdateImageInfo() in c:\projects\oxyplot\Source\OxyPlot\Imaging\OxyImage.cs:line 260
at OxyPlot.OxyImage..ctor(Byte[] bytes) in c:\projects\oxyplot\Source\OxyPlot\Imaging\OxyImage.cs:line 48
at TemsaViewer01.PageXYGraph.LoadImages(Experiments exp) in d:\Cloud\VisualStudio\TemsaViewer01\TemsaViewer01\PageXYGraph.xaml.cs:line 101
at TemsaViewer01.PageXYGraph..ctor(Experiments exp) in d:\Cloud\VisualStudio\TemsaViewer01\TemsaViewer01\PageXYGraph.xaml.cs:line 53
at TemsaViewer01.MainWindow..ctor() in d:\Cloud\VisualStudio\TemsaViewer01\TemsaViewer01\MainWindow.xaml.cs:line 34
InnerException:
Can you give me some advice pleasse?

Oxplot not compatible with Caliburn.Micro + MEF

Oystein Bjorke 10 aastat tagasi 0
This discussion was imported from CodePlex

sharethl wrote at 2013-03-03 02:46:

Don't know should post on CM or here.

It is oxyplot-94236a582857 on XP.
CM with customized bootstrapper cannot execute GetInstance() with OxyPlot.dll in its folder.
If OxyPlot.dll is removed, it works fine, also, no problem on Win7.

Here is the executes, not virus. You can remove OxyPlot.dll and see it works fine.
Environment: XP.
https://www.box.com/s/pk71tu3zj0r2j109j6xe

This is ex message

GetInstance
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)
 protected override object GetInstance(Type serviceType, string key) {
            try {
                string contract = string.IsNullOrEmpty(key) ? AttributedModelServices.GetContractName(serviceType) : key;
                var exports = container.GetExportedValues<object>(contract);

                if (exports.Count() > 0)
                    return exports.First();

                throw new Exception(string.Format("Could not locate any instances of contract {0}.", contract));
            }
            catch (Exception ex) {
                using (StreamWriter writer = new StreamWriter("log.txt")) {
                    writer.WriteLine("GetInstance");
                    writer.WriteLine(ex.Message);
                }
                return null;
            }
        }

tibel wrote at 2013-03-03 17:54:

Maybe this article will help you:
Using Portable Class Libraries - Update .NET Framework

As I don't get the exception on my machine.

sharethl wrote at 2013-03-03 22:48:

Wow, that really help, need to update .net 4.0.
Thanks Tibel

Having ColumnSeries and a LineSeries within the same plot (CategoryAxis problem)

Oystein Bjorke 10 aastat tagasi uuendaja Chris 8 aastat tagasi 1
This discussion was imported from CodePlex

mezeizsolt wrote at 2013-03-21 14:17:

Hi!
First of all I want to thank you for this great project, it saved me a lot of work already, its features are great!

I have run into a problem recently and I need some help: I have to show a ColumnSeries and a LineSeries on the same plot. The x-axis has to be time, and with the LineSeries out of the picture it works fine:
public class PlotData
{
        public DateTime TimeOnX { get; set; }
        public double DataOnY { get; set; }
        public string LabelOnX { get { return this.TimeOnX.ToString("yyyy.mm.dd"); } }
}
var plot = new PlotModel();
plot.Axes.Add(new CategoryAxis { ItemsSource = PlotDataItems, LabelField = "LabelOnX" });
plot.Axes.Add(new LinearAxis(AxisPosition.Left) { MinimumPadding = 0, AbsoluteMinimum = 0 });
plot.Series.Add(new ColumnSeries { ItemsSource = PlotDataItems, ValueField = "DataOnY" });
After adding LineSeries (plot.Series.Add(new LineSeries { ItemsSource = PlotDataItems, DataFieldX = "TimeOnX", DataFieldY = "DataOnY" });) I get a perfecly vertical line (every value is assigned to the "category of nothing").
Then I figured out I have to set the ItemsSource of the CategoryAxis a collection of DateTime instead of PlotData:
plot.Axes.Add(new CategoryAxis { ItemsSource = PlotDataItems.Select(x => x.TimeOnX), Labels = PlotDataItems.Select(x => x.LabelOnX).ToList() });
As it turns out, LabelField property cannot be null, however I want to use the DateTime object itself, not its properties. (I am not quite sure how it supposed to work exactly, I could not find any details.)

Sorry, if I have overlooked something important.

Thank You,
Zsolt

RefreshPlot Removed

Oystein Bjorke 10 aastat tagasi 0
This discussion was imported from CodePlex

kevkon3 wrote at 2014-04-28 22:36:

After upgrading to the latest oxyplot, we noticed that RefreshPlot() was no longer available, causing our code to not compile. We found it tough to figure out how to fix the problem, but I finally tracked down the commit (https://oxyplot.codeplex.com/SourceControl/changeset/ef8b7699b5b3) where the changed occurred and noticed that we should now use InvalidPlot() instead.

Did we miss something in the changelog or documentation that points this out?

Either way, it would have been nice to mark the function as Obsolete and point us to the InvalidatePlot() method.

I am mainly posting this so that users who google the problem might get pointed to this discussion.

objo wrote at 2014-04-29 09:06:

Yes, I agree we should have marked this as obsolete and waited a few weeks or months before removing it. We should try to do this for future breaking changes. It is also important to describe breaking changes in the changelog. Note that I want this library to continue to evolve and expect there will be more major refactorizations and breaking code changes.

Cross hair for tracking curves.

Oystein Bjorke 10 aastat tagasi 0
This discussion was imported from CodePlex

amity2001 wrote at 2012-07-18 09:12:

Hello World,

Having feature of Tracking curves with cross hair graphs is very common case.

Although the OxyPlot has feature of showing tooltip with point information while dragging mouse on the series, it is limited to single series only.

If user want to see values from different series at some point of X axis, then it is not possible with OxyPlot.

The requirement is,

The graph can have more than one series.

When user overs mouse on the graph, cross hair should appear and there should be option of showing values of every series at that point.

Kindly look at FLOT example

Please help to have this feature in WPF.

Thanks in advance.


objo wrote at 2012-08-08 23:42:

Showing the values after the series titles in the legend box is a nice feature! I will add it to the issue tracker - maybe there is an easy way to implement this. It should be generalized to support both horizontal and vertical tracker lines...

PS. I think a behaviour as in the FLOT example should be possible using a vertical line annotation and change the series titles on mouse events in the plot area...

Tracker vs. Annotation

Oystein Bjorke 10 aastat tagasi 0
This discussion was imported from CodePlex

TrickyT wrote at 2014-04-02 11:15:

I just tried out OxyPlot yesterday so I don't have that much experience yet.

In the "Getting Started"-example (http://www.oxyplot.org/doc/HelloWpf.html) a Function Series is introduced, and a Tracker is shown in the resulting plot when pressing the left mouse button.
Instead of a Function Series, I would like to draw some polygons with a Tracker attached. I tried to add a Polygon Annotation showing nice polygons in the plot, but no Tracker is shown when pressing the left mouse button. Do I have to implement the polygons using Series or is there another way of getting the Tracker together with annotations? Do I miss something?

objo wrote at 2014-04-02 12:14:

Annotations are (currently) not target for the tracker. The tracker only does hit testing on the series. I would suggest to create a custom PolygonSeries that implements the hit test method. The AreaSeries is another alternative, but not as clean.

Using a scrollbar ?!

Oystein Bjorke 10 aastat tagasi 0
This discussion was imported from CodePlex

_Noctis_ wrote at 2013-11-01 10:11:

Completely unrelated maybe, but I've seen that you can use a scrollbar on different charting tools, and then just drag it right/left (or up/down).

Now, in OxyPlot, I can drag while holding the right mouse button, but I was wondering if it's possible to do the same with a scrollbar (the benefit is that the other Axis will stay fixed ... I guess we can achieve the same using : "IsZoomEnabled = false, IsPanEnabled = false", but i believe that having a scrollbar will be more intuitive, and you can start with a zoomed in and it'll be clear that there are move to the sides ...

objo wrote at 2013-11-06 23:18:

It should be possible to overlay the scrollbars, and adjust their position and size when the plot is changing!
See the OverlayDemo in the WpfExamples. It is overlaying a Rectangle, but it could also be a scroll bar aligned at one of the axes!
This could be a nice example to add!

tibel wrote at 2014-03-27 21:42:

Such a sample would be great.

Can this be done with an Annotaton?

One legend item for each group of LineSeries instances?

Oystein Bjorke 10 aastat tagasi 0
This discussion was imported from CodePlex

dcuccia wrote at 2014-03-25 22:05:

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!!

objo wrote at 2014-03-25 22:13:

did you try setting the Title for only the first green LineSeries and the first blue LineSeries?

dcuccia wrote at 2014-03-25 23:15:

objo wrote:
did you try setting the Title for only the first green LineSeries and the first blue LineSeries?
That'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!

Error using toolbox with managed C++

Oystein Bjorke 10 aastat tagasi 0
This discussion was imported from CodePlex

AaronJohnson wrote at 2013-12-19 23:40:

I have a managed C++ WinForm application that I am trying to drop a plot into. When I do so, I get the following error dialog:
---------------------------
Microsoft Visual Studio
---------------------------
Value does not fall within the expected range.
---------------------------
OK   
---------------------------
Helpful, right?

I am using the latest .NET 4.5 binaries. I added the plot control to the toolbox manually by browsing for OxyPlot.WindowsForms.DLL.

Any ideas? Is there any other information from me that would be helpful?

AaronJohnson wrote at 2013-12-20 16:16:

Figured it out. I wasn't able to add the winforms class library to the project references because my project was targeting .NET version 4.0. It will add the core OxyPlot library, but it will throw an error when you try to reference the winforms DLL.

You have to manually set the project's targeted framework to version 4.5. You do this by manually editing the project file and adding <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> to the globals section.

Once you've done this, you'll actually be able to reference all of the required class libraries and the toolbox will now be usable.

DateTime Axes X: Majorstep (& majorGrid) in seconds, minorStep (&minorGrid) in milliseconds

Oystein Bjorke 10 aastat tagasi 0
This discussion was imported from CodePlex

JHN wrote at 2012-09-18 09:05:

Hi all,

First the code is in C#.

I tried hard to have an axe with the major step in seconds and minor step in milliseconds but I had no success!

I have values with: X = DateTime type and Y = Float type

The Gap between 2 values is 10 miliseconds.

I tried this:

DateTimeAxis axeX1 = new DateTimeAxis();
axeX1.MajorStep = (double)1/24/60/60; //1/24 = 1 hour, 1/24/60/60 = 1 second
axeX1.MinorStep = axeX1.MajorStep/10; //1/10 10 miliseconds
axeX1.StringFormat = "hh:mm:ss";
axeX1.ShowMinorTicks = true;
axeX1.MajorGridlineColor = OxyColor.FromArgb(40, 255, 255, 255);
axeX1.MajorGridlineStyle = LineStyle.Solid;
axeX1.MinorGridlineColor = OxyColor.FromArgb(20, 255, 255, 255);
axeX1.MinorGridlineStyle = LineStyle.Solid;
  

But between 2 major ticks I have a gap of 8 seconds and no minor tick between 2 major ticks.

Anyone has a solution or a way to follow for this kind of problem?

Thanks in advance.

JHN


cedrelo wrote at 2013-12-04 08:39:

I have exactly the same problem ??


Anyone to help ?

objo wrote at 2013-12-09 21:01:

I think there is a fork related to this:
https://oxyplot.codeplex.com/SourceControl/network/forks/mroth/oxyplot/contribution/5446
I am awaiting some unit tests/examples on this.

There are also some issues related to DateTimeAxis:
https://oxyplot.codeplex.com/workitem/10089
https://oxyplot.codeplex.com/workitem/10045
https://oxyplot.codeplex.com/workitem/7988

cedrelo wrote at 2013-12-10 14:31:

Thanks

it's works with the fork

it would be great to include this in the main project

David_NET wrote at 2013-12-10 18:19:

thanks for sharing the problem, and pointing out the essential fork.