DateTimeAxis, vb and WPF error
kelvinlaw wrote at 2012-09-10 16:18:
Anyone else using this library with the combination DateTimeAxis +VB.net 2010 +WPF?
I'm getting an error on creating an axis:
'.ctor' is ambiguous because multiple kinds of members with this name exist in class 'OxyPlot.DateTimeAxis'
with the code: (error is on the variable)
Dim xAxis As New DateTimeAxis()
xAxis.IntervalType = DateTimeIntervalType.Months
xAxis.Title = "Time"
model.Axes.Add(xAxis)
Am I using this wrong or is this an error with the vb only?
kelvinlaw wrote at 2012-09-10 19:16:
Looking into it a bit more VB has an issue with constructors where the properties are optional:
DataTimeAxis.cs:
public DateTimeAxis()
public DateTimeAxis( AxisPosition pos = AxisPosition.Bottom, string title = null, string format = null, DateTimeIntervalType intervalType = DateTimeIntervalType.Auto) : base(pos, title)
Commenting out the first constructor gets rid of the problem.
Labels inside ScrollView
brainsprinter wrote at 2012-06-27 12:57:
First of all, thank you for a great job.
My question is: is there a way to put labels inside ScrollView ?
Thank you in advance
objo wrote at 2012-06-27 15:41:
Which labels do you want inside scroll viewers? Currently there are no ScrollViewer used in this solution.
I try to keep the graphical output identical on all platforms, and what you see on the screen should be exactly the same as exported (pdf/png) or printed.
brainsprinter wrote at 2012-06-27 17:03:
Thank you for the fast response!
I am using LineSeries, and up to 10 lines is everithing OK. With more than 10 lines the labels are taking whole plot area, and no lines are visible. I just wan to group the labels on the right side. Labels are not generated, I am using custom template, so the label can have up to 3 lines of text.
Thanks
objo wrote at 2012-06-28 06:18:
You can move the "legends" outside the plot area - see the "LegendsDemo" in the "WpfExamples" example application.
If your legends are still too long, I suggest to create a separate ItemsControl (outside the OxyPlot.Plot control) where you render the legends. And this control could be contained in a ScrollViewer!
brainsprinter wrote at 2012-06-28 10:49:
I am sorry, yes, "legends", thats what I actually thought... it was a stressfull day :) Thank you very much!
(Question) Newly added line does not appear immediately.
typingcat wrote at 2012-06-27 11:15:
I have already drawn some lines already,
plot.Series.Add(line3);
MyGraph.Model = plot;
and now I want to let users display additional lines by checking on some options.
MyGraph.Model.Series.Add(optLine);
But the new line does not appear until the graph is redrawn (for example, resizing the window). Calling MyGraph.Model.RefreshPlot() make it appear but then that makes all successive new lines have the same colour. (If I do not use RefreshPlot(), lines have random colours.)
What is the correct way to add new lines dynamically?
objo wrote at 2012-06-27 15:34:
Yes, the plot model is not automatically redrawn. This was a choice I made to keep the code as simple as possible! I think it is also good for performance to have the control when the plot is redrawn.
I checked in a fix for the color bug when series are added at different times. I hope this solves your problem. Thanks for the notice!
typingcat wrote at 2012-06-29 08:12:
Thank you. I downloaded and built the latest source code, and now the colours looked OK.
The only concern for me is that the binary I am using is no longer a 'stable' version.
OxyPlot on Linux (no GUI)
WololoW wrote at 2014-06-10 13:18:
Thank you very much
objo wrote at 2014-06-10 13:40:
PngExporter
in the Gtk# implementation! I have not tried this on linux myself yet, so it will be interesting to hear your experiences!Auto Pan Oxyplot DateTimeAxis
lolcodez wrote at 2014-07-23 22:41:
While the posted example appears to work for a LinearAxis, it doesn't work for a DateTimeAxis.
The pan steps are far too large, jumping extremely long distances.
var now = DateTimeAxis.ToDouble(DateTime.Now);
data.Points.Add(new DataPoint(now, yValue));
if (data.Points.Count > 3)
{
//panStep is -6045706.002716762
double panStep = timeAxis.Transform(timeAxis.Offset - 1);
timeAxis.Pan(panStep);
}
Q: What is the correct was to autopan a DateTime axis? lolcodez wrote at 2014-07-25 21:32:
lolcodez wrote at 2014-08-08 21:43:
Anyone qualifies to write an overview of the 37 forks?
David_NET wrote at 2013-12-10 10:57:
What have been included in the updates and what is not?
Could we start an update here so authors of these forks could advice us if we should examine or not to examine these forks?
objo wrote at 2013-12-11 07:51:
It would be nice to have updated description fields and to know the status of each fork.
I am trying to close the pull requests, but for the 3 remaining it is actually quite a bit of work to decide whether to accept or decline. I hope to be able to do this in not too distant future (I will stop saying 'soon' :-)
Remember to include examples/unit tests when submitting pull requests, I will be more strict about this in the future.
Cannot add image annotation in Windows Phone 8.1.
I'm working on WP8.1 project with MvvmCross - Hot Tuna v3.5.0 and MvvmCross Resource Loader Plugin v3.5.0 on Visual Studio 2013 Update 4.
I have a problem with Image Annotation. For the scenario, after check box is checked, graph adds vertical line with image next to the line. In this case, the line works fine but the image makes the app freezing.
The following code is my demo project to check that the Image Annotation works properly or my code breaks it. This example adds image directly to the graph. However, I encounter the same problem.
FirstViewModel.cs:
public class FirstViewModel
: MvxViewModel
{
public PlotModel PlotModel { get; private set; }
private Dictionary<string, OxyImage> _annotationImages;
public FirstViewModel(IMvxResourceLoader resourceLoader)
{
var model = new PlotModel { Title = "Hello Windows" };
model.Axes.Add(new LinearAxis { Position = AxisPosition.Bottom });
model.Axes.Add(new LinearAxis { Position = AxisPosition.Left });
var lineSeries = new LineSeries { Title = "LineSeries", MarkerType = MarkerType.Circle };
lineSeries.Points.Add(new DataPoint(0, 0));
lineSeries.Points.Add(new DataPoint(10, 18));
lineSeries.Points.Add(new DataPoint(20, 12));
lineSeries.Points.Add(new DataPoint(30, 8));
lineSeries.Points.Add(new DataPoint(40, 15));
OxyImage image = null;
try
{
resourceLoader.GetResourceStream(imageFileName, (stream) =>
{
image = new OxyImage(stream);
});
}
catch (Exception ex)
{
Mvx.TaggedError("RotavaporPlotModel", "Failed to load image for annotation: {0}", ex);
}
var imageAnnotation = new ImageAnnotation()
{
ImageSource = image,
Opacity = 0.2,
Interpolate = false,
X = new PlotLength(0.5, PlotLengthUnit.RelativeToPlotArea),
Y = new PlotLength(0.5, PlotLengthUnit.RelativeToPlotArea),
Width = new PlotLength(1, PlotLengthUnit.RelativeToPlotArea),
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Middle
};
model.Annotations.Add(imageAnnotation);
model.Series.Add(lineSeries);
this.PlotModel = model;
}
}
FirstView.xaml:
<views:MvxWindowsPage
x:Class="OxyPlotDemo.Phone.Views.FirstView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:oxy="using:OxyPlot.Windows"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:views="using:Cirrious.MvvmCross.WindowsCommon.Views"
mc:Ignorable="d">
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<oxy:PlotView Model="{Binding PlotModel}"/>
</Grid>
</views:MvxWindowsPage>
FirstView.xaml.cs:
using Cirrious.MvvmCross.WindowsCommon.Views;
namespace OxyPlotDemo.Phone.Views
{
public sealed partial class FirstView : MvxWindowsPage
{
public FirstView()
{
this.InitializeComponent();
}
}
}
The following lines are stack trace after I run this code (these are done in WorkerThread):
mscorlib.ni.dll!System.Threading.Monitor.Wait(object obj, int millisecondsTimeout, bool exitContext)
mscorlib.ni.dll!System.Threading.Monitor.Wait(object obj, int millisecondsTimeout)
mscorlib.ni.dll!System.Threading.ManualResetEventSlim.Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken)
mscorlib.ni.dll!System.Threading.Tasks.Task.SpinThenBlockingWait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken)
mscorlib.ni.dll!System.Threading.Tasks.Task.InternalWait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken)
mscorlib.ni.dll!System.Threading.Tasks.Task<Windows.Storage.Streams.IRandomAccessStream>.GetResultCore(bool waitCompletionNotification)
mscorlib.ni.dll!System.Threading.Tasks.Task<System.__Canon>.Result.get()
OxyPlot.Windows.DLL!OxyPlot.Windows.RenderContext.GetImageSource(OxyPlot.OxyImage image)
OxyPlot.Windows.DLL!OxyPlot.Windows.RenderContext.DrawImage(OxyPlot.OxyImage source, double srcX, double srcY, double srcWidth, double srcHeight, double destX, double destY, double destWidth, double destHeight, double opacity, bool interpolate)
OxyPlot.DLL!OxyPlot.RenderingExtensions.DrawImage(OxyPlot.IRenderContext rc, OxyPlot.OxyImage image, double x, double y, double w, double h, double opacity, bool interpolate)
OxyPlot.DLL!OxyPlot.Annotations.ImageAnnotation.Render(OxyPlot.IRenderContext rc)
OxyPlot.DLL!OxyPlot.PlotModel.RenderAnnotations(OxyPlot.IRenderContext rc, OxyPlot.Annotations.AnnotationLayer layer)
OxyPlot.DLL!OxyPlot.PlotModel.RenderOverride(OxyPlot.IRenderContext rc, double width, double height)
OxyPlot.DLL!OxyPlot.PlotModel.OxyPlot.IPlotModel.Render(OxyPlot.IRenderContext rc, double width, double height)
OxyPlot.Windows.DLL!OxyPlot.Windows.PlotView.UpdateVisuals()
OxyPlot.Windows.DLL!OxyPlot.Windows.PlotView.ArrangeOverride(Windows.Foundation.Size finalSize)
Then I try to run example project which I get from GitHub. Example project version is 0.0.1.0.
I got the following stack trace:
mscorlib.ni.dll!System.Threading.Monitor.Wait(object obj, int millisecondsTimeout, bool exitContext)
mscorlib.ni.dll!System.Threading.Monitor.Wait(object obj, int millisecondsTimeout)
mscorlib.ni.dll!System.Threading.ManualResetEventSlim.Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken)
mscorlib.ni.dll!System.Threading.Tasks.Task.SpinThenBlockingWait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken)
mscorlib.ni.dll!System.Threading.Tasks.Task.InternalWait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken)
mscorlib.ni.dll!System.Threading.Tasks.Task<Windows.Storage.Streams.IRandomAccessStream>.GetResultCore(bool waitCompletionNotification)
mscorlib.ni.dll!System.Threading.Tasks.Task<System.__Canon>.Result.get()
OxyPlot.Windows.DLL!OxyPlot.Windows.RenderContext.GetImageSource(OxyPlot.OxyImage image) Line 793
OxyPlot.Windows.DLL!OxyPlot.Windows.RenderContext.DrawImage(OxyPlot.OxyImage source, double srcX, double srcY, double srcWidth, double srcHeight, double destX, double destY, double destWidth, double destHeight, double opacity, bool interpolate) Line 571
> OxyPlot.DLL!OxyPlot.RenderingExtensions.DrawImage(OxyPlot.IRenderContext rc, OxyPlot.OxyImage image, double x, double y, double w, double h, double opacity, bool interpolate) Line 239
OxyPlot.DLL!OxyPlot.Annotations.ImageAnnotation.Render(OxyPlot.IRenderContext rc) Line 176
OxyPlot.DLL!OxyPlot.PlotModel.RenderAnnotations(OxyPlot.IRenderContext rc, OxyPlot.Annotations.AnnotationLayer layer) Line 346
OxyPlot.DLL!OxyPlot.PlotModel.RenderOverride(OxyPlot.IRenderContext rc, double width, double height) Line 109
OxyPlot.DLL!OxyPlot.PlotModel.OxyPlot.IPlotModel.Render(OxyPlot.IRenderContext rc, double width, double height) Line 32
OxyPlot.Windows.DLL!OxyPlot.Windows.PlotView.UpdateVisuals() Line 897
OxyPlot.Windows.DLL!OxyPlot.Windows.PlotView.ArrangeOverride(Windows.Foundation.Size finalSize) Line 793
Could you please help me with this? Am I do anything wrong or it is a bug here?
Thank you in advance for your feedback.
Cheers,
Peerapon P.
Custom format in Tracker (WPF)
tibel wrote at 2013-12-09 14:56:
Axis.FormatValueForTracker(double x)
to format the value.
Instead
TrackerHitResult
uses Axis.GetValue()
, what makes no sense for me.
I have a size axis and want to change the scaling (from nm to m) at runtime.
How is this intended to be used?
objo wrote at 2013-12-09 20:58:
The
Axis.FormatValueForTracker
was only overriden by Bar/Column series and can easily be removed.
The
GetNearestPoint
methods should use the TrackerFormatString
property to format the values (which are converted from coordinates to the axis data type by the
Axis.GetValue
method). I will submit a fix.
The tracker control is missing for WinForm?
heromyth wrote at 2011-11-17 05:08:
It seems not easy to be implemented like WPF/Silveright.
objo wrote at 2011-11-17 12:16:
yes, the tracker is not implemented in the WinForms version. It should not be hard to implement, but I am not sure if it should be another control on top of the plot control, or if it should be handled in the Paint method.
Scale on LinearAxes is always 0 for WPF
Andywmm9 wrote at 2012-07-24 03:33:
Hi,
I have an image and an OxyPlot chart which are inside a canvas. I want to set the position of the image based on the two variables I have, XAxisHostValue and YAxisHostValue. I noticed the Scale property on the linear axes, however no matter what they are always zero. Is there another way to convert the coordinates in my canvas (which is the same size as the chart) to plot coordinates? Thanks
double xScale = PlotModel.Axes[0].Scale; double yScale = PlotModel.Axes[1].Scale; mDragCG.SetValue( Canvas.LeftProperty, xScale * XAxisHostValue); mDragCG.SetValue( Canvas.TopProperty, yScale * YAxisHostValue);
Tech_Junkie wrote at 2012-07-26 16:07:
The scale is only set after the element is loaded, so if you set these variables in your constructor it won't work.
Fortunately you can use the InverseTransform function of an axis to convert from a datapoint to a screenpoint. The Transform function does the opposite.
objo wrote at 2012-08-09 00:08:
Yes, the scale is not set before the plot has been rendered (it depends on the size of the control, and the contents of the plot model).
Use the Transform functions to transform from 'data' points to 'screen' points.
Service d'assistance aux clients par UserEcho