Re-sizing of image in imageannotation
BlindMonk wrote at 2013-07-25 16:31:
There is a weird issue with the image zoom and resize. When I resize the window horizontally, horizontal axes changes values, which is fine, but the image also resizes, and the Y axis doesnt change. So I end with different height.
I tried to set both width and height, but then image is missing. Its a simple code. I am pasting below.
byte[] b = new byte[160000];
for (int i = 0; i < b.Length; i++) b[i] = 125;
image = OxyImage.FromArgb(200, 200, b,96);
model.Annotations.Add(new ImageAnnotation
{
ImageSource = image,
X = new PlotLength(0, PlotLengthUnit.Data),
//Y = new PlotLength(0, PlotLengthUnit.Data),
Interpolate=false,
Width = new PlotLength(200, PlotLengthUnit.Data),
//Height = new PlotLength(200, PlotLengthUnit.Data),
//HorizontalAlignment = OxyPlot.HorizontalAlignment.Center,
//VerticalAlignment = OxyPlot.VerticalAlignment.Top
});
Any tips are deeply appreciated. PS: I checked other annotation examples, there they dont have such issue.
BlindMonk wrote at 2013-07-30 16:00:
If I set both width and height of imageannotation, the image is not rendered.
yetangye wrote at 2013-08-27 17:33:
Is there any method can avoid this problem?
Thanks.
BlindMonk wrote at 2013-08-27 17:42:
objo wrote at 2013-08-28 00:00:
How do get DateTime of a TrackerHitResult?
lars_fagerbakke wrote at 2013-10-25 12:49:
Plot plot = sender as Plot;
var series = plot.GetSeriesFromPoint(new ScreenPoint(e.GetPosition(plot).X, e.GetPosition(plot).Y), 10);
var result = series.GetNearestPoint(new ScreenPoint(e.GetPosition(plot).X, e.GetPosition(plot).Y), true);
var data = result.DataPoint;
data's X should be a DateTime value, its a double, but how can i convert it back to DateTime?how to get the max point coordinate on the showing screen?
aoi wrote at 2014-05-21 05:22:
Any ideas how I can do that?
everytimer wrote at 2014-05-21 07:32:
MyData.Select( p => p.Y).Max();
For the data shown in the ViewPort: Get the ActualMinimum/ActualMaximum of the X axis in your Model (MyModel.Axes[0].ActualMinimum etc), perform the same operation as before but only for the interested points:MyData.Select( p => p.Y && p.X > myMin && p.X < myMax).Max();
I haven't tested the code above, but should be enough to point you in the right direction.Good luck
aoi wrote at 2014-05-21 09:52:
Further, if there are two or more lines in the ViewPort, I need to run the operation specific times to get the max point of these lines. Have any methods to make the "MyData" cover all the points in different lines in the ViewPort?
everytimer wrote at 2014-05-21 11:22:
List<string> names = new List<string>();
List<double> maxima = new List<double>();
foreach(LineSeries ls in MyModel.Series.OfType<LineSeries>())
{
double max = ls.Points.Select( p => p.Y && p.X > myMin && p.X < myMax).Max();
maxima.Add(max);
names.Add(ls.Title);
}
//Show gathered maxima
for(int i=0; i<names.Count; i++)
{
MessageBox.Show("Maximum of " + names[i] + " in the current view is " + maxima[i]);
}
(Untested)EDIT: I think the way of obtaining the maximum of a range is not correct (you wont be able to compile that), you can select the range using .Where from Linq namespace.
var range = MyData.Where(p => p.X > MyMin && p.X < MyMax);
double max = range.Select( p => p.Y).Max();
Good luckaoi wrote at 2014-05-21 11:53:
req: disable scroll wheel zoom.
steunissen wrote at 2011-08-10 08:37:
Again : I love OxyPlot. Keep it going !
I am now using a plot inside a scroll viewer. Scrolling (with the scroll wheel of my mouse) through my scroll viewer while reaching my plot, interferes with the scroll zoom of the plot, mixing up my plot.
It would be nice if the scroll zoom could be disabled while keeping the zoom by rectangle enabled.
Sander.
objo wrote at 2011-08-10 13:24:
set IsZoomEnabled = false on the axes where you want the scroll wheel to be disabled. The property is only available when defining a PlotModel, I will add it to the WPF Axis controls later.
See the "Zooming disabled" example in the ExampleBrowser application (working for both WPF and Silverlight).
steunissen wrote at 2011-08-10 14:57:
IsZoomEnabled=false disables both the zoom by scrollwheel and zoom by drawing a rectangle on the chart.
I would like to have a property like : ScrollWheelZoomEnabled=false;
objo wrote at 2011-08-24 07:34:
I added IsMouseWheelEnabled to the WPF and SL Plot controls. This will enable/disable the mouse wheel for all axes. If you need individual settings for each axis, we need to add a property to the Axis class.
watbywbarif wrote at 2014-05-22 15:45:
How to compile OxyPlot?
goicox wrote at 2013-09-09 17:12:
Are there instructions on how to compile OxyPlot? I am trying to compile the source code using VS2010 professional, but I am getting problems opening .csproj files.
Thank you in advance, Javier
objo wrote at 2013-09-09 17:35:
http://visualstudiogallery.msdn.microsoft.com/b0e0b5e9-e138-410b-ad10-00cb3caf4981
goicox wrote at 2013-09-10 09:42:
Thank you for the pointer. I am able to open some projects now. Still there are some others that are not available, so I probably need to install additional libraries or packages.
Bellow is the list of project unavailable / incompatible:
OxyPlot.Metro
OxyPlot.MonoForAndroid
OxyPlot.OpenXml
OxyPlot.Pdf
OxyPlot.Pdf.Test
OxyPlot.Pdf.SL5
OxyPlot.Silverlight
OxyPlot.Tests
OxyPlot.WindowsForms
OxyPlot.Wpf
OxyPlot.Wpf.Test
OxyPlot.Xps
OxyPlot.MfA
Could you please point to the additional resources needed?
Thank you in advance, Javier
objo wrote at 2013-09-11 19:55:
OxyPlot.MonoForAndroid: you need to install mono for android
Silverlight: you need Silverlight 4/5 SDK
.NET 4.5 projects: you need VS 2012
The others should work without any additional libraries.
Try OxyPlot.WindowsForms_NET40.sln or OxyPlot.WPF_NET40.sln, these should work on VS2010 (it is possible you need to modify the version number on the top of the sln files)
How to plot in Windows Forms application
JohnnyPP wrote at 2012-07-11 23:35:
Hello,
I would like to make a simple plot in a Windows Forms Application. After pressing a button the plot should be displayed. So far I have done following steps:
1. Created Windows Forms Application project,
2. Added one button that should display the plot,
3. Added OxyPlot Package by choosing Tools->Library Package Manager-> Package Manager Console and printing Install-Package OxyPlot.WindowsForms
4. I chose one Plot from the examples:
[Example("LineSeries")]
public static PlotModel LineSeries()
{
var plotModel1 = new PlotModel();
plotModel1.LegendSymbolLength = 24;
plotModel1.Title = "LineSeries";
plotModel1.Axes.Add();
plotModel1.Axes.Add();
plotModel1.Series.Add();
var linearAxis1 = new LinearAxis();
linearAxis1.Position = AxisPosition.Bottom;
plotModel1.Axes.Add(linearAxis1);
var linearAxis2 = new LinearAxis();
plotModel1.Axes.Add(linearAxis2);
var lineSeries1 = new LineSeries();
lineSeries1.Color = OxyColors.SkyBlue;
lineSeries1.MarkerFill = OxyColors.SkyBlue;
lineSeries1.MarkerSize = 6;
lineSeries1.MarkerStroke = OxyColors.White;
lineSeries1.MarkerStrokeThickness = 1.5;
lineSeries1.MarkerType = MarkerType.Circle;
lineSeries1.Title = "Series 1";
lineSeries1.Points.Add(new DataPoint(0,10));
lineSeries1.Points.Add(new DataPoint(10,40));
lineSeries1.Points.Add(new DataPoint(40,20));
lineSeries1.Points.Add(new DataPoint(60,30));
plotModel1.Series.Add(lineSeries1);
return plotModel1;
}
End there is my question. I have the code for the button like this:
private void button1(object sender, EventArgs e)
{
}
How to use the code from [Example("LineSeries")] in button1?
Any help appreciated.
JohnnyP
objo wrote at 2012-07-11 23:43:
You need to add an OxyPlot.WindowsForms.Plot control to your Form.
Then set the Model property of that control to the model provided by your LineSeries method.
See Examples/WindowsForms/WindowsFormsDemo/Form1.cs
JohnnyPP wrote at 2012-07-12 00:17:
Hello Objo,
Thanks for the answer. In Examples\WindowsForms\WindowsFormsDemo\ I can find only these flies: OxyPlot.dll, OxyPlot.WindowsForms.dll, WindowsFormsDemo.exe and no Form1.cs
objo wrote at 2012-07-13 09:32:
See the "Source code" tab on top of the page
Problem with dataseries
MikeRam wrote at 2013-01-24 15:00:
Hi! I' ve a big problem on displaying a dataseries because in some cases not all points are being show in the graph
This is a dynamic dataseries which is refreshed every 5 second because it's done by incoming signals. The other dataseries are static.
When i move the mouse or i try to zoom into the graph there are some points ( or segments ) which disappear and some others which appear.
Anyone could help me to solve this problem?
Thank you
Mike
objo wrote at 2013-02-10 23:24:
Could this be a thread synchronization problem? The PlotModel has a SyncRoot object!
Does anyone have exampls of using oxyplot to performing trending
drj1000 wrote at 2013-01-26 21:21:
I have an app where I need to trend data from a simullator as the simulator is running. I want to have a window of data and is changing as the simulator changes. I will display a fixed number of data on the plot and as the data changes the graph shifts left. It would be nice to only have to add the latest data point the graph shifts - i.e. to reduce CPU time.
Anybody got any ideas , I would like to hear them.
Thanks
Jerry
objo wrote at 2013-02-10 23:17:
Bound MarkerFill for LineSeries
Jerry007 wrote at 2013-11-14 14:24:
I'm newbie user of OxyPlot. It looks impressive, however I can not find how to do the following:
I have a LineSerie bound to list of POCO's. One of the property of the poco is "status" enum
...I'd like to bind the state to a particular MarkerFill (like red/gree/blue)...is there a way how to achieve this?
As a workaround I would have to create additional 3 ScatterSeries with just points per each status with constant MarkerFill....
objo wrote at 2013-11-14 21:03:
The workaround sounds like a good solution! Or you can populate the points of the scatter series yourself, not using binding.
Sparklines using OxyPloy
dpraveen9 wrote at 2013-12-30 19:38:
http://en.wikipedia.org/wiki/Sparkline
Few articles about them
http://www.edwardtufte.com/bboard/q-and-a-fetch-msg?msg_id=0001OR
examples
http://omnipotent.net/jquery.sparkline/#s-about
objo wrote at 2014-01-07 21:38:
There is an example for Silverlight, see Source\Examples\Silverlight\SparklineDemo.
I think it can be done the same way for WPF and Win8!
Customer support service by UserEcho