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

Import Txt file to OxyPlot

Oystein Bjorke il y a 10 ans 0
This discussion was imported from CodePlex

loreleon wrote at 2014-02-06 20:06:

Hello.

I'm new at this.

I have one txt file, this was export from GnuPlot. This contains the (X,Y) points, I want import this file to Oxyplot. Someone knows how to do it?

Thank you so much!!

everytimer wrote at 2014-02-06 23:24:

This is not OxyPlot specific question.

Oxyplot accepts lists of DataPoint, so it is your job to read the file and store the data in your arrays/lists.

There are plenty of examples plotting data, and several of them read an external file.

Good luck

Axis displayed min and max tick labels

Oystein Bjorke il y a 10 ans 0
This discussion was imported from CodePlex

Slxe wrote at 2014-07-09 20:53:

Hey, was wondering if there's a way to have an Axis always show it's visible min and max tick labels, regardless of it being a minor or major tick, just to have a number always displayed on the edges of it. Didn't really notice anything besides implementing it myself in a custom axis.

As a shitty example, here's a picture altered in paint, red and purple ticks and labels being two different ideas for where to show the visible min and maxes.
Image

objo wrote at 2014-07-10 12:26:

Yes, this could be a new feature. But should the labels be at the ends of the axes (including 'padding') or at the most extreme value (excluding 'padding')?
If the most extreme value should be used, should it take the maximum/minimum of all series using that axis? What about the formatting - should it use the same formatting string as for the other labels, or have its own formatting string?
I have added https://oxyplot.codeplex.com/workitem/10229

Slxe wrote at 2014-07-10 15:59:

Hmmm some good points. It should definitely have some kind of subtle unique formatting (even just bolded), although it can be changed by the user ofc. As for where it should show up, I was originally thinking including padding, but actually might be better if it's on the min/max of the axes line itself, that way it doesn't interfere with other tick marks and their labels?

Double Line Series Plot with 2 Y axes

Oystein Bjorke il y a 10 ans 0
This discussion was imported from CodePlex

bball0246 wrote at 2013-02-18 17:47:

I was looking to make a graph with two line series. The series have drastically different Y ranges so I was wondering whether it would be possible to make two Y axes, one on the left and one on the right. Thanks.

ivarstange wrote at 2013-02-19 10:16:

Yes, this is possible:
var pm = new PlotModel();
var secondaryAxis = new LinearAxis(AxisPosition.Left, "Secondary"); // And add other axes as well
pm.Axes.Add(secondaryAxis); // Add them all
var ls = new LineSeries("Secondary Line");
// Do stuff to add datapoints here
secondaryAxis.Key = "Secondary";
ls.YAxisKey = "Secondary";
Edit: Typo

ivarstange wrote at 2013-02-19 10:43:

I notice, however, that when you zoom or pan, the secondary axis won't update. I haven't figured out how to fix this yet.

bball0246 wrote at 2013-02-19 20:46:

Thanks that is what I needed. It would be nice if they panned and zoomed proportionately to each other but I guess I can deal with that. Is there a way of associating the line series with either axis (color-coding perhaps)?

bball0246 wrote at 2013-02-19 21:14:

The line series can be associated with the axis by color:
secondaryAxis.TicklineColor = OxyColors.Red;
secondaryAxis.TitleColor = OxyColors.Red;
secondaryAxis.TextColor = OxyColors.Red;
ls.Color = OxyColors.Red;
Still working on the zoom/pan issue.

bball0246 wrote at 2013-02-19 21:28:

Both axes are independent so each one has to be zoomed independently. By default (I don't know if this can be changed), the left axis is the one that has control when the mouse is over the graph. To control the right axis, you have to hover over it and scroll to zoom or right-click drag to pan.

ivarstange wrote at 2013-02-19 21:39:

I noticed the same thing. It can be useful (sometimes) to control them independently. I believe that most people would want the (ctrl+RMB)-zoom to function as if they were dependent/connected, and that they could be independently controlled if the mouse was over the axis. (But this is another discussion, I guess)

urm3l wrote at 2013-04-03 23:59:

Not sure if you still need an answer to the proportional zooming but maybe someone else will.

You can work around the issue of the independent axes with following the example of the coupled axes, But instead of using the actualMaximum of the other axis you are computing a proportion factor with the two maxima of your plots. Then you can scale the actualMaximum with that factor.

Its a little trickier to do that for the mimima as well but it should work.
0

Graph autoadjust disable.

Wilson il y a 10 ans 0
Using Windows forms, how can I disable the graph autoadjust?
If I add one scatterpoint using:
scatterSeries1.Points.Add(new ScatterPoint( x, y));
and then:
plotView1.InvalidatePlot(true);
the graph is autoadjusted to see the plot. Thanks in advance

Heatmap support

Oystein Bjorke il y a 10 ans 0
This discussion was imported from CodePlex

AlexeiShcherbakov wrote at 2012-11-15 13:04:

  1. Is it planned?
  2. If no, how to implement it correctly

objo wrote at 2012-11-15 19:51:

yes, it is http://oxyplot.codeplex.com/workitem/9985 and http://oxyplot.codeplex.com/workitem/9801

sorry, I have not looked into how to implement it yet. Would like to render using bitmaps for performance...

0

Disable Zooming and Panning In Xamarin Forms

LongTran2006 il y a 9 ans mis à jour par petricorde il y a 9 ans 1
Hello,
I am doing my application with real time plot view. The problem is that when i touch to the plot area (Panning or Zooming), the plot view stop updating. There fore i would like to ask if someone know how to disable zooming or panning or Is there any other methods to fix my problem.
Thank you very much in advance

Does OxyPlot work in .NET 3.5?

Oystein Bjorke il y a 10 ans 0
This discussion was imported from CodePlex

guilhermecgs wrote at 2013-10-11 19:14:

Is there any release of OxyPlot for .NET 3.5?

I couldn't find it in http://oxyplot.codeplex.com/, but maybe there is an old version...

objo wrote at 2013-10-15 15:09:

No, there is no releases for .NET 3.5.
The core is PCL, and this is not supported by 3.5 (http://msdn.microsoft.com/en-us/library/gg597391.aspx).
You need to build the core for .NET 3.5 yourself.
The WPF, Winforms, pdf etc. libraries should also be possible to compile for 3.5.

ryoujr wrote at 2013-10-15 21:17:

Hello objo,

I was also looking for any solution for .NET 3.5. So, could you please elaborate more on this how I can make my own libraries for .NET 3.5 (how to build the core for .NET 3.5 and so on)? I'm new to PCL stuff.

Thank you very much.

andygough1974 wrote at 2013-10-16 19:57:

Hi Objo

Can you clarify what you mean by "core" please?

Many thanks

ryoujr wrote at 2013-10-18 00:14:

Hello Objo,

Based on your comment which said it should be possible to build oxyplot libraries for .NET 3.5, I started working on this.
I'm using 3 libraries (OxyPlot, OxyPlot.Wpf, OxyPlot.Xps) and I just made a new project with "Class Library" option for a OxyPlot and added all required files to the project to remove PCL stuff. (Seems you mentioned this to Core)
Now, it seems okay for this OxyPlot, but when I try to build WPF and XPS libraries by changing .net version to 3.5, it showed several errors which include "ManipulationCompletedEventArgs not defined"
I found that this was also supported from .NET 4.0, and others also looked something like this.
So, I would appreciate it if you could elaborate more on this procedure to make it working on .NET 3.5, and if I was doing something wrong, I hope you can correct me.

Thank you.

guilhermecgs wrote at 2013-10-18 00:32:

Hello Andy and others,

I am no expert at Oxyplot, but as a developer I wouldn't try to change the source code to make it compatible to .NET 3.5.
  1. It will probably need tons of time to make it work, (if it work)
  2. There's going to be several bugs
  3. You will be by your on
  4. There is several other options, such as DynamicDataDisplay
If you do have time and you want to contribute to the community, go ahead, thats great. But wouldn't it be easier to just change your framework to .NET 4?
Also, if you want to contribute to the community, make sure your improvement or functionality is needed by other people. I suggested you contact the main developers of this project and try to include this feature in the product roadmap.

objo wrote at 2013-10-19 09:26:

I have added NET 3.5 project files for the core, WPF and XPS projects.
The WPF touch event handlers are moved into a partial class that is not compiled in the NET 3.5 project.
I am not adding the NET 3.5 solution into the build for NuGet, you need to build OxyPlot yourself if you want to use it with this version of the .NET framework.

ryoujr wrote at 2013-10-19 17:25:

Thank you very much Objo.

So, if I understand correctly, maybe I should update to the latest build, then I can build my own NET 3.5 libraries without above issues.

Metro style app-display problem

Oystein Bjorke il y a 10 ans 0
This discussion was imported from CodePlex

Leilunte wrote at 2012-10-24 09:54:

Hi, objo

I am following the metro example of BasicSample step by step.

And, I pass the debug.

However, I can't see anything on my window 8.

Is it any way to solve it?

Thanks.


taschmidt wrote at 2012-10-27 16:06:

I'm having the same problem.  Anyone find a solution yet?


objo wrote at 2012-10-27 19:08:

Could it be a missing Generic.xaml? (as in http://oxyplot.codeplex.com/workitem/10008)

Possible workaround: try to include OxyPlot and OxyPlot.Metro in your solution, and reference the projects instead of the assemblies.

Hope we find a solution to this soon!


taschmidt wrote at 2012-10-28 04:20:

Yep, grabbing the source and setting a project reference worked.  I'm assuming this is a temporary thing?

Thanks!


objo wrote at 2012-10-28 08:25:

This should now be corrected. Try the latest NuGet package.


taschmidt wrote at 2012-10-28 17:04:

The latest NuGet package fixed it!  Thanks a lot for the fast turnaround!

Plotting time-series data (Speech and Other events)

Oystein Bjorke il y a 10 ans 0
This discussion was imported from CodePlex

vermahimanshu7 wrote at 2014-04-14 15:50:

Hi,

I have to generate time-series graphs where I can show speech (not as fancy speech waveforms) for different users. In addition, I would like to overlay other important discrete events on the speech. Is this possible to do in OxyPlot?

Maybe the question that I asked sounds a bit stupid, but I have to quickly decide on an effective API for generating charts where I am free to add multiple streams of data and can play around with the customization of the charts. I am quite proficient in WPF and C#.

Thanks in advance and any help would be greatly appreciated :)

Memoryleak in the heatmap?

Oystein Bjorke il y a 10 ans 0
This discussion was imported from CodePlex

EydenJones wrote at 2013-04-05 09:50:

Hello,

I've used oxyplot (which is great); but I have a memory leak while using the heatmap in wpf.
Every couple of seconds, I update the data of the heatmap like so:
heatMapSeries.Data = dataValues;
  • refresh plotmodel
However, I see in the Wpf.ShapesRenderContext that the dictionary imageCache keeps growing. After a couple of minutes, I have several OxyImages stored in that cache, and it doesn't seem to release it?

Kind regards

EydenJones wrote at 2013-04-05 10:09:

Could it be that the CleanUp method in the rendercontext is not called?
I tried overriding the Render method, call the base and then call the cleanup method myself, but it throws an collection modified exception. Sadly :)

I've looked in the sourcecode

// Find the images in the cache that has not been used since last call to this method
            var imagesToRelease = this.imageCache.Keys.Where(i => !this.imagesInUse.Contains(i));

            // Remove the images from the cache
            foreach (var i in imagesToRelease)
            {
                this.imageCache.Remove(i);
            }

            this.imagesInUse.Clear();
There may be a bug in here. I would call the ToList() at the end of the first line.

Kind regards

objo wrote at 2013-04-18 09:54:

Thanks for reporting the bug! This should be investigated closer. It should also be checked that the cache is being cleared properly when the control is unloaded.
I added the issue: https://oxyplot.codeplex.com/workitem/10042

NejibCh wrote at 2013-04-23 21:30:

Can you please provide a heat map project example using WPF. I really appreciate your time and effort.

I am using WPF, Visual Studio 2012, C#, .Net4.0
Kind Regards

objo wrote at 2013-04-24 11:12:

I prefer to add examples to the cross-platform ExampleLibrary, but will try to make a WPF example for the HeatMapSeries in the Examples/Wpf/WpfExample application later. Can you propose an interesting example? It is more fun showing some real data than dummy values :)

ManhoiHur wrote at 2013-04-26 05:21:

I can give real data like crude oil. Do you need it? please let me know. I will send it to you.


NejibCh wrote at 2013-04-27 05:49:

Thanks guys for the fast replies. for some reason I could not run access to the web location you just sent . But fortunately I done what I need and here is portion of my code.

I had many challenges to set the contours, contour labels and colorAxis position (Needed to add a transparent axis to push the ColorAxis further for plotArea)
By the way this is great tool. Much better than some marketed tools "like Infragistics for example).
Good job guys.

!!!!!!!!!!!!!!!!!!!!!!!!!!! ----------------------- in the XAML

<Window x:Class="TreeMapInfragistics.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"
    xmlns:oxy2="clr-namespace:OxyPlot.Series;assembly=OxyPlot"
    Title="MainWindow" Height="610" Width="610">
<Grid>
    <oxy:Plot x:Name="MyOxyPlot" Model="{Binding MyPlotModelTab3}"/>
</Grid>
</Window>


!!!!!!!!!!!!!!!!!!!!!!!!!!! ----------------------- in the ViewModel

using System;
using System.Linq;
using OxyPlot;
using OxyPlot.Axes;
using OxyPlot.Series;

namespace HeatMapWithContours
{
public class MainViewModel: BaseViewModel
{
    public double [] mnMxXY = new double[6];
    public double[] WOB;
    public double[] RPM;

    public MainViewModel()
    {
        UpdateChart();
    }

   // ..........................................
   private PlotModel _myPlotModelTab3;
   public PlotModel MyPlotModelTab3
   {
       get { return _myPlotModelTab3; }
       set
       {
           _myPlotModelTab3 = value;
           OnPropertyChanged("MyPlotModelTab3");
       }
   }

   public void UpdateChart()
   {
       double[,] MyData = GenerateData();

       #region  HeatMapSeries

       var hm = new HeatMapSeries();
       hm.Data = MyData;
       hm.Selectable = false;
       hm.X0 = mnMxXY[0]; // Min X-axis
       hm.X1 = mnMxXY[1]; // Max X-axis

       hm.Y0 = mnMxXY[2]; // Min Y-axis
       hm.Y1 = mnMxXY[3]; // Max Y-axis

       #endregion

       #region ContourSeries

       var cs = new ContourSeries()
       {
           // ..............
           ColumnCoordinates = WOB, //yvalues
           RowCoordinates = RPM,//xvalues
           Data = MyData,

           // ............
           ContourLevelStep = 5,
           StrokeThickness = 0.5,
           LineStyle = LineStyle.Solid,
           Color = OxyColors.Gray,
           //ContourColors = new[] { OxyColors.SeaGreen, OxyColors.RoyalBlue, OxyColors.IndianRed },

           // ...............
           LabelFormatString = "[0.00]",
           LabelBackground = null,
           //LabelSpacing  = double.NaN,
           //Font = null,
           //LabelStep = 10,
           FontSize = 11,
           FontWeight = FontWeights.Normal,
           TextColor = OxyColors.Black
           //Background = OxyColor.FromAColor(220, OxyColors.White),
           //TrackerFormatString = null,

       };

       #endregion

       #region X- Axis

       LinearAxis xAxis = new LinearAxis
       {
           Position = AxisPosition.Bottom,
           Title = "RPM",
           ClipTitle = true,
           TitlePosition = 0.5,
           MinorGridlineStyle = LineStyle.Dot,
           MajorGridlineStyle = LineStyle.Dot,
           MinorGridlineThickness = 1,
           MajorGridlineThickness = 1,
           IsAxisVisible = true,
           IsZoomEnabled = false,
           IsPanEnabled = false,
           Angle = 0,
           AxisTitleDistance = 4,
           AxisTickToLabelDistance = 4,
           MajorTickSize = 7,
           MinorTickSize = 4,
           Minimum = mnMxXY[0],
           Maximum = mnMxXY[1],
           ShowMinorTicks = true
       };

       #endregion

       #region Y- Axis

       LinearAxis yAxis = new LinearAxis
       {
           Position = AxisPosition.Left,
           Title = "WOB",
           ClipTitle = true,
           TitlePosition = 0.5,
           MinorGridlineStyle = LineStyle.Dot,
           MajorGridlineStyle = LineStyle.Dot,
           MinorGridlineThickness = 1,
           MajorGridlineThickness = 1,
           IsAxisVisible = true,
           IsZoomEnabled = false,
           IsPanEnabled = false,
           Angle = 0,
           AxisTitleDistance = 4,
           AxisTickToLabelDistance = 4,
           MajorTickSize = 7,
           MinorTickSize = 4,
           Minimum = mnMxXY[2],
           Maximum = mnMxXY[3],
           ShowMinorTicks = true
       };

       #endregion

       #region Y1- Axis

       LinearAxis y2Axis = new LinearAxis
       {
           Position = AxisPosition.Right,
           IsAxisVisible = true,
           IsZoomEnabled = false,
           IsPanEnabled = false,

           TicklineColor = OxyColors.Transparent,
           AxislineColor = OxyColors.Transparent,
           TextColor = OxyColors.Transparent
       };

       #endregion

       #region ColorAxis

       ColorAxis cAxis = new ColorAxis
       {
           Position = AxisPosition.Right,
           PositionTier = 1,
           Palette = OxyPalettes.Jet(500),
           HighColor = OxyColors.Red,
           LowColor = OxyColors.Blue,
           Minimum = mnMxXY[4],
           Maximum = mnMxXY[5],
           StartPosition = 0.05,
           EndPosition = 0.95,
           IsAxisVisible = true,
           Angle = 0,
           AxisTitleDistance = 4,
           AxisTickToLabelDistance = 4,
           MajorTickSize = 7,
           MinorTickSize = 4,
           ShowMinorTicks = true,
           UseSuperExponentialFormat = true
       };

       #endregion

       #region PlotModel

       PlotModel tempPlotModel = new PlotModel();

       tempPlotModel.AutoAdjustPlotMargins = true;
       tempPlotModel.PlotAreaBackground = OxyColors.Red;
       tempPlotModel.Title = "Critical Speed Map (XPos)";
       tempPlotModel.TitleFontWeight = FontWeights.Normal;
       tempPlotModel.PlotAreaBorderThickness = 1;
       tempPlotModel.PlotAreaBorderColor = OxyColors.Black;

       tempPlotModel.Axes.Add(xAxis);
       tempPlotModel.Axes.Add(yAxis);
       tempPlotModel.Axes.Add(y2Axis);

       tempPlotModel.Axes.Add(cAxis);
       tempPlotModel.Series.Add(hm);
       tempPlotModel.Series.Add(cs);

       #endregion

       MyPlotModelTab3 = tempPlotModel;
  }

   #region Generate Data

   private double[,] GenerateData()
   {
            ..........
       }
}
}

objo wrote at 2013-04-29 13:23:

manhoihur: crude oil data sounds good if it is ok to publish under MIT license.
This bug is high priority (I don't want memory leaks in this library), but it is possible I need some time to solve this...

guevara123 wrote at 2013-05-22 11:18:

I also experienced those memory leaks. My impression was that it comes from the image rendering which is kinda memory intensive, when you have unfavorable data or huge amounts of data.
I.e.: A huge spectrum of values needs way more rendering, than a small spectrum of values.

Could you provide what kind of data is used?

willmoore88 wrote at 2013-08-28 15:22:

This is also happening in an ImageAnnotation (https://oxyplot.codeplex.com/discussions/454756).

Any news on a fix for this? Or a pointer on where to look in the code and i'll give it a go myself.

objo wrote at 2013-08-28 15:40:

For WPF: set a breakpoint in the CleanUp() method in ShapesRenderContext. It seems I have forgot to call it...

objo wrote at 2013-08-28 15:48:

I have submitted a fix, let us know if this solves the problem!

yetangye wrote at 2013-09-04 12:33:

objo wrote:
I have submitted a fix, let us know if this solves the problem!
Yes, you fixed it! Thank U very much!
I tested the new version with a huge ImageAnnotation, and the program's memory leak disappeared.