LineSeries - Interpolated Points
Artiga wrote at 2013-09-04 16:04:
For my application I need the all points of a Line Series ... let me explain better:
Suppose I give two points to my Line Series, (0,0) and (10,10), OxyPlot will automatically plot the points between this two points.
It´s possible that I get this point list (the interpolated ones) ? For me will be nice, otherwise I will has to add a interpolate algorithm just to calculate then ....
Thx all
objo wrote at 2013-09-04 20:05:
You find the algorithm for the canonical splines in CanonicalSplineHelper.cs
EvaldsUrtans wrote at 2013-11-01 16:24:
/// <summary>
/// Interpulate LineSeries data points for linear slopes
/// </summary>
public static List<IDataPoint> InterpulateLinearLines(List<IDataPoint> points, double intervalX)
{
List<IDataPoint> pointsReturn = new List<IDataPoint>();
double x = 0.0;
double xPrev = -1.0;
while (x != xPrev)
{
xPrev = x;
IDataPoint point1 = null;
IDataPoint point2 = null;
foreach (IDataPoint pointKey in points)
{
if (pointKey.X <= x)
{
point1 = pointKey;
}
else if (point1 != null)
{
point2 = pointKey;
break;
}
}
if (point2 == null)
{
point2 = points[points.Count - 1];
}
{
double sideA1 = point2.Y - point1.Y;
double sideA2 = 0.0f;
double sideB1 = point2.X - point1.X;
double sideB2 = x - point1.X;
if (sideB1 > 0.0)
{
IDataPoint pointCalc = new DataPoint();
sideA2 = (sideA1 * sideB2) / sideB1;
pointCalc.Y = point1.Y + sideA2;
pointCalc.X = x;
if(pointsReturn.Count > 0)
{
foreach (IDataPoint pointKey in points)
{
if(pointsReturn[pointsReturn.Count -1].X < pointKey.X)
{
if (pointKey.X < pointCalc.X)
{
pointsReturn.Add(pointKey);
}
break;
}
}
}
pointsReturn.Add(pointCalc);
}
else
{
pointsReturn.Add(point1);
}
}
x += intervalX;
x = Math.Min(x, points[points.Count - 1].X);
}
return pointsReturn;
}
usage:lineSeries.Points = HelperGraphs.InterpulateLinearLines(dataPointsRough, fTimeInterval);
left mouse click on OxyPlot control Location move to other location in silverlight
anshien wrote at 2012-03-19 08:02:
I use OxyPlot Control In silverlight ChildWindow, when I click left mouse ,to show clicked Point value, but the control show value not on my mouse arrow.it's location offset a lot. How is it?How to solve this problem?Thanks !!!
objo wrote at 2012-03-20 18:40:
Can you try to replace the OxyPlot control with a Canvas, and check the mouse locations reported there - to rule out if the problem is with your panel/container.
Rendering performance when plotting multi lineseries with high fps
sunwayking wrote at 2013-06-16 04:47:
PS. OxyPlot is used in WPF 4.5
Program is running on my IBM Server(8 CPU cores, 16GB Memory)
objo wrote at 2013-06-18 12:48:
Turn off markers, axis grid lines, smoothing. Do not use ItemsSource (binding is slow).
125000 points at 20fps is probably at the limit of what is possible with WPF shapes (I tested the same number of points in the WpfExamples/RealtimeDemo)
Creating a rendering context for WPF using WriteableBitmap or DirectX could be a solution to achieve higher frame rates...
sunwayking wrote at 2013-06-20 12:39:
See https://oxyplot.codeplex.com/wikipage?title=Performance&referringTitle=DocumentationThanks for your advice. I gonna try WriteableBitmap.
Turn off markers, axis grid lines, smoothing. Do not use ItemsSource (binding is slow).
125000 points at 20fps is probably at the limit of what is possible with WPF shapes (I tested the same number of points in the WpfExamples/RealtimeDemo)
Creating a rendering context for WPF using WriteableBitmap or DirectX could be a solution to achieve higher frame rates...
Color saturation in Oxyplot Column Series
guilhermecgs wrote at 2014-03-15 14:35:
I want to generate a Column Series plot with light colors. I think the automatic color generator of Oxyplot generates colors too saturated and dark. Is there a way to define some parameters in order to to that, without the need to define the color manually for each ColumnSeries?
Below, on page 5, is a example of the type of color saturation I would like to have.
TEXT
objo wrote at 2014-03-19 16:20:
You can change the
PlotModel.DefaultColors
, I added an example. There may be a bug with the ColumnSeries, it seems not to update properly.
objo wrote at 2014-03-19 22:38:
Exporting plotmodel to xml file
meenakshi07 wrote at 2012-11-05 09:45:
Hello!
I would like to know how can I export details of the plotmodel (like axis collection, lineseries collection with its configuration like color gridlines etc and the data/datapoint collection) to a xml file.
I tried using xml serialization but since plotmodel uses generics and dictionaries thus unable to do so.
Could you please help ?
Thanks!
Meenakshi
objo wrote at 2012-11-06 19:44:
I think this should be covered by http://oxyplot.codeplex.com/workitem/9986
But I don't recommend serializing the PlotModel directly - I will not guarantee backwards compatibility in the future...
please help me track down this (WPF) zoom bug
brantheman wrote at 2012-06-05 19:37:
I'm trying to track down a zoom issue. Steps to repeat the issue:
1. Open the OxyPlot.Wpf solution.
2. Set the WpfExamples project as the startup project.
3. Modify WpfExamples.Examples.BarSeriesDemo.MainWindow.xaml.cs to look like this:
tmp.Axes.Add(new CategoryAxis { ItemsSource = Items, LabelField = "Label", AbsoluteMinimum = 0, AbsoluteMaximum = Items.Count, IsPanEnabled = true, IsZoomEnabled = true});tmp.Axes.Add(new LinearAxis(AxisPosition.Left) { MinimumPadding = 0, AbsoluteMinimum = 0, IsZoomEnabled = false, IsPanEnabled = false});
4. Fire up the BarSeries demo and zoom in and out. Give that mouse wheel a good strong spin and watch as you zoom to outer space, which wasn't expected given the axes' parameters noted above.
It's almost like the flip of a switch. I can even get it into a situation where a single click on the mouse wheel jumps the zoom/pan out of any viewable content.
objo wrote at 2012-06-19 12:41:
thanks for the bug report - will look into this later!
objo wrote at 2012-06-27 15:52:
I could not reproduce this. It works fine here.
I changed AbsoluteMinimum=-0.5 and AbsoluteMaximum=Items.Count-0.5 in order to get the CategoryAxis to look right (the AbsoluteMinimum/Maximum are not checked before the user tries to zoom/pan).
My code currently looks like this:
tmp.Axes.Add(new CategoryAxis { ItemsSource = this.Items, LabelField = "Label", AbsoluteMinimum = -0.5, AbsoluteMaximum = this.Items.Count - 0.5, IsPanEnabled = true, IsZoomEnabled = true }); tmp.Axes.Add(new LinearAxis(AxisPosition.Left) { MinimumPadding = 0, AbsoluteMinimum = 0, IsZoomEnabled = false, IsPanEnabled = false });
brantheman wrote at 2012-06-27 22:09:
This bug definitely still exists. I'm using a Microsoft mouse with a fairly recent version of Intellipoint. Normal mouse wheel behavior doesn't show the problem. You have to spin the wheel really fast for the problem to occur.
objo wrote at 2012-06-28 06:31:
Ok, I submitted a change that might help - can you verify? I still could not zoom fast enough to reproduce this error (I have an old Logitech G3 mouse with standard Windows 7 HID driver).
If it is still a problem, can you create a log of the Delta values from the MouseWheelEventArgs?
brantheman wrote at 2012-06-29 17:25:
Yes, that change fixes it. Thank you! As a second note, it appears that you're not setting the Handled property on the various mouse events for WPF when you use the event. Nor do you check it before using the event. Do you think that might help?
For the record, I did make a log of my delta values:
-120, -120, -240, -360, -360, -131, -131, -394, -262, -171, -514, -514, -514, -514, 120, 600, 600, 360, 240, -120, -240, -360, -120, -120, -131, -394, -394, -394, -394, -262, -171, -514, -514, -514, 120, 600, 240, 144, 722, 722, 433, 433, -120, -360, -360, -360, -360, -480, -131, -394, -394, -525, -171, -514, -686, -514, -686, -514, -686, -514, -202, -606, -809, -606, -809, -606, -606, -227, -908, -681, -908, -681, -247, -743, -1983, -1487, -991, -1487, -991, -743, -265, -797, -1063, -797, -797, -281, -844, -1126, -844, -2253, -844, -1126, -844, -1126, -295, -887, -1182, -887, -1182, -887, -308, -616, -925, -925, -2466, -925, -925, -319, -1279, -959, -1279, -959, -1279, -959, -330, -991, -2644, -991, -2644, -991, -1322, -340, -1361, -1020, -2722, -2041, -1361, -1020, -1361, -1020, -349, -2096, -4193, -2096, -2096, -1397, -1048, -1397, -357, -2863, -2147, -2863, -2147, -1431, -2147, -1073, -365, -1097, -2927, -5122, -2195, -1463, -1097, -1463, -373, -2240, -5227, -2240, -2987, -1120, -1120, -380, -1141, -3044, -2283, -3044, -2283, -3044, -1141, -1522, -1141, -387, -1162, -3098, -6972, -2324, -1549, -1162, -1549, -1162, -393, -1181, -1181, -1575, 120, 1440, 1200, 2160, 600, 1440, 600, 600, 288, 1733, 1444, 866, 722, 866, 188, 1132, 1887, 2265, 943, 222, 1335, 1112, 1335, 2225, 1335, 1112, 249, 1249, 1249, 2498, 1249, 272, 1636, 1363, 1636, 1363, -240, -1320, -360, -480, -360, -480, -131, -394, -1050, -788, -1050, -394, -525, -394, -394, -171, -686, -514, -1372, -1029, -686, -514, -686, -202, -606, -1213, -1618, -1213, -809, -606, -809, -606, -227, -681, -1816, -1362, -1816, -1362, -681, -908, -681, 120, 1200, 1440, 600, 720, 360, 144, 866, 722, 1733, 722, 722, 377, 1887, 1132, 943, 222, 1112, 2670, 1112, 1335, 1112, 1112, 249, 2997, 2498, 1498, 1249, 272, 1363, 3272, 2727, 1363, 1636, 1363, 584, 2924, 3509, 1462, 1462, -120, -720, -480, -360, 120, 720, 1200, 1440, 600, 720, -120, -960, -720, -480, -360, 120, 1440, 1200, 720, 600, -240, -960, -720, -480, -360, -480, -262, -525, -788, -1050, -788, -525, -394, -525, -171, -1029, -686, -514, -686, -202, -809, -1213, -1618, -606, -809, -606, -809, -227, -1816, -1362, -1816, -1362, -908, -1362, -681, -247, -991, -1487, -1983, -1487, -1983, -743, -991, -743, -265, -797, -3722, -1063, -1595, -1063, -797, -563, -3942, -1689, -1126, -1689, -844, -295, -1774, -2365, -2661, -2365, -887, -1182, -887, -308, -2466, -4316, -925, -2466, -925, -319, -1919, -1279, -1919, -1919, -1279, -959, -1279, -330, -1983, -5618, -2644, -991, -1322, -991, -1322, -340, -2041, -2722, -2041, -2722, -3062, -1020, -349, -2096, -4193, -2096, -1397, -1048, -2445, -357, -2147, -2863, -2147, -2863, -1073, -1431, -1073
objo wrote at 2012-07-11 00:27:
Thanks for the notice about the missing checks of the Handled property. I added the checks now (WPF control only), I hope I got it right.
Is it possible to set your own interval on a logarithmic scale?
willmoore88 wrote at 2013-07-12 16:35:
http://openeeg.sourceforge.net/doc/modeeg/images/filter_delay_log.png
By setting the base to 2.718281828 I get this, but the intervals between the major ticks aren't right and the values that have been chosen are pretty random and I need them rounding to more meaningful values.
This is the output at the minute.
https://www.dropbox.com/s/5dr70tk34vz1wp2/logscale.jpg
This is now a real sticking point in using this library in my application which would be a real shame as I've got some brilliant results so far.
If anyone can help me out then I can share some code then.
willmoore88 wrote at 2013-07-12 16:51:
So this is exactly what I want...
https://www.dropbox.com/s/njef6lzuts2qrof/log2.png
But this is plotting from 0.1 to 1.
I need to plot from 0(ish) to 32,800.
everytimer wrote at 2013-07-12 21:13:
LogarithmicAxis axis1 = new LogarithmicAxis();
axis1.Position = AxisPosition.Bottom;
axis1.Base = 8;
axis1.MinorStep = 2;
axis1.MinorGridlineStyle = LineStyle.Dot;
axis1.MinorGridlineColor = OxyColors.LightGray.ChangeAlpha(20);
axis1.Minimum = 0;
axis1.Maximum = 32800;
plotter.Model.Axes[0] = axis1;
plotter.RefreshPlot(true);
Results:Log2
Log8
Log10
I think you can't retrieve the label for minor ticks right now, correct if I'm wrong.
By the way: why would you set the base to "e"? Its logical to obtain "random" values (e^2, e^3...)
Handling massive series
moes_leco wrote at 2014-03-31 16:12:
- prevented boxing of data and screen points
- added ability to decimate
- added ability to append without re-rendering each series via a safe INotifyCollectionChanged supporting bulk addition
- allows binding directly to data if using IList<IDataPoint>
- avoids reflection and accessor functions when iterating through source data points
- avoids unnecessary recalculation of max-mins
- avoids redundant calculations in valid values
- reuses intermediate memory for rendering (to avoid stressing 3rd generational memory)
- avoids recreating model upon each render for MVVM
- I'm sure there's more
Would you be interested in pulling some of this in?
objo wrote at 2014-03-31 18:32:
Have you checked if the following changes could have a performance improvement
- not performing the actual clipping, but depending on the rendering capability of the output device
- clipping in a parallel loop
moes_leco wrote at 2014-04-08 19:21:
I made the updates in https://hg.codeplex.com/forks/moes_leco/performance. I just ported my inheritance-based solution to one that would better fit into yours. I haven't tested the port. I do have unit tests for the Decimator, EnhancedObservableCollection, & EnhancedListCollectionView if you need, but did not add them. Really EnhancedObservableCollection & EnhancedListCollectionView may not belong in the project, but I added them so you could use to test appending without WPF misbehaving.
objo wrote at 2014-04-08 20:11:
moes_leco wrote at 2014-04-08 20:31:
objo wrote at 2014-04-11 07:28:
I still need some time to review the last changes, I am hesitant to adding the observable pattern to the whole model...
Oxyplot on VS2012 with Metro project
poweramd wrote at 2012-08-22 11:37:
Hi everyone,
with a couple of friends of mine we're starting one project of a Metro-style app and we're evaluating Oxyplot as our charting library.
But here we come to the problem: I've tried installing Oxyplot with NuGet, via Package Manager Console or manually adding the references, none of this methods worked.
The problems seems to be with metro project, because with wpf app I don't have this issue and everything works just fine.
Do you plan to add the support to Metro app?
So, let's recapitulate:
- VS 2012 Pro
- Win 8 RTM x64 eng
- Oxyplot 2012.3.127.1
- Metro project
I've actually attached a print screen of the failing setup as well as the output of the Package Manager Console.
Any help will be much appreciated, thanks
http://i.imgur.com/gAnho.png
PM> Install-Package OxyPlot.Wpf Successfully installed 'OxyPlot.Wpf 2012.3.127.1'. Successfully uninstalled 'OxyPlot.Wpf 2012.3.127.1'. Install failed. Rolling back... Install-Package : Failed to add reference to 'OxyPlot'. At line:1 char:1 + Install-Package OxyPlot.Wpf + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
objo wrote at 2012-08-23 08:44:
Yes, a Metro version is planned, and a NuGet package will be added when it is done! I will start testing on Windows 8 soon. See the fork http://oxyplot.codeplex.com/SourceControl/network/forks/elliatab/MetroFix, I plan to merge this into the main branch soon.
objo wrote at 2012-08-24 14:44:
Is it possible to build a Metro project on Windows 7? Otherwise I need to move the build server to Windows 8 before I can create the nuget package automatically. The Oxyplot library will be PCL.
poweramd wrote at 2012-08-24 15:43:
Hi objo,
thanks for your reply.
So, first, I think we can wait the release of Oxyplot for Metro. We have much work to do before plotting the results, so, no problem. I'm happy to know that you're working on.
Second, I'm not really sure if you can build a Metro app in Win 7. When developping for WP7 there was an emulator of the phone, I don't know if there is something similar. If I have some spare time, I'll try to install VS2012 on Win 7 and let you know what
happen.
poweramd wrote at 2012-08-24 23:35:
Well, it seems that you cannot create Metro project if running VS 2012 on Win 7...
Edit: this is how it looks like on Win 8
objo wrote at 2012-08-25 06:43:
(I will create the project on a Windows 8 machine, so that should be ok)
But can Msbuild build Metro projects on a windows 7 machine? The following link looks promising :)
http://stackoverflow.com/questions/11604794/msbuild-windows-8-metro
Customer support service by UserEcho