LegendSymbolPlacement for each Series
vindex wrote at 2011-09-17 19:30:
Hi,
Is it possible to set different LegendSymbolPlacement for each Series in a PlotModel? I'm using three axis (bottom, left, right) and it would be very useful to distinguish if the series are binded to the right or the left axis.
Thanks
objo wrote at 2011-09-18 13:42:
It is not currently possible. But I agree it is a good idea, please add it to the issue tracker.
I'm not sure how to implement it - maybe a list of legend settings (position, orientation, alignment etc) under the PlotModel and a reference (by a key) under each series?
vindex wrote at 2011-09-19 08:08:
Maybe let PlotModel's as default value, and add a new property to Series to overwrite it if necessary
WPFOxyPlot crash on DataPointSeries addPoint
prclot wrote at 2011-10-25 18:52:
When using a thread to update the pointseries and a dispatcher to redraw the plot the System systematically crashes after few iterations.
in the thread worker
public void Worker()
{
wile(true)
{
double x = counter * 0.1;
pointList.Add(new DataPoint(x, Math.Cos(100 * x * Math.PI / 180)));
counter++;
object retVal = Dispatcher.BeginInvoke(new ThreadStart(() => Update()), DispatcherPriority.Normal, null);
Thread.Sleep(10);
}
}
private void Update()
{
oxyPlot.RefreshPlot(true);
}
Any Suggestion?
Thanks to anybody
objo wrote at 2011-10-25 20:57:
did you try a lock on your plot model when you modify the points and when you refresh the plot?
prclot wrote at 2011-10-25 21:47:
Yes,
i have already did that.
A lock in the update method and a lock in the worker
Same error in :
DataPointSeries.cs
Line 319
foreach (var o in itemsSource)
InvalidOperationException : the enumerator has been reset
Thx
Can't define Axes in Xaml
I have added OxyPlot to my project using the nuget command
Install-Package OxyPlot.Wpf
-Pre
In my first test I defined a PlotView in Xaml and the PlotModel in C# code.
Then I wanted to try configuring the Axes in Xaml, but that doesn't seem possible with the current version. PlotView does not have a property Axes.
I have downloaded the OxyPlot samples from GitHub. Some of the samples (for example AxesDemo) do define Axes in Xaml. What is going on?
Even if I could define the Axes in Xaml, would this be incompatible with data-binding to the Model property?
Is there some high level documentation of the structure of Plot, PlotView and Controller?
Phil
Display tracker when the scatter point is selected
Gimly wrote at 2013-10-01 17:52:
The only issue I have with it is that it removes the tracker functionality.
I think it could be quite nice to display the tracker when the point is selected. Is there a way to programatically display the tracker for a point yet?
objo wrote at 2013-10-01 22:04:
e.Handled=true
- then the event will be passed to the trackerAlt. 2: You have
PlotModel.PlotControl.ShowTracker
but you must build the tracker hit result yourself - it contains more information than the mouse hit result. Also remember to call HideTracker.Gimly wrote at 2013-10-02 08:55:
e.Handled=true
removed because the
PlotModel.MouseDown
is called even if the Series.MouseDown
has been called (which is totally normal but it hadn't triggered in my head), which meant that my points were getting unselected directly.
I fixed it by simply testing if
e.HitTestResult == null
, if it's null => I'm clearing the selection, otherwise I don't do anything.
Works like a charm.
objo wrote at 2013-10-03 19:26:
ZoomRectangleManipulator updates all curves, but not all axes
I have multiple y-axes and a single x-axis. When I use the ZoomRectangleManipulator's methods, it correctly updates all of the LineSeries in the PlotModel. However, it does not update all of the y-axes. This is similar to what is described in the aforementioned issues, but I find it odd that it updates the Series contained in the axis without updating the axis itself. Please review if these are the same issue or if this is a different bug.
Thank you.
Legend with group names
mika_z wrote at 2013-09-25 14:35:
is there any way to add groups to the PlotModel's Legend? Like for example the names of the Axes that are in the PlotModel. At the moment I have multiple Y-axes and it would be nice to separate them in the Legend so it's easier for the user to find the correct series.
Best regards
Mika
DJDAS wrote at 2013-09-26 15:00:
Bye! :)
Drawing Toolbar Example
Slxe wrote at 2014-05-21 19:08:
Here's the drawing toolbar example I was talking about a bit. Please let me know what you think, if I'm doing anything wrong, or if you know of any improvements I can make to it =). I might add a few more features depending on if I get some more free time.
https://github.com/Slxe/OxyPlot-Drawing-Toolbar
Slxe wrote at 2014-05-26 15:40:
everytimer wrote at 2014-05-26 20:49:
objo wrote at 2014-05-26 20:58:
I have cloned your repository and had a look at the code. It is a really nice demo, and I hope we can include this in the 'official' demos later. But I have some comments after a first quick look:
- the architecture should be changed to use a
PlotController
- this can make the annotation creation/editing reusable on all platforms! - use some ui pattern (mvc, mvp, mvvm?) to separate all the logic from the views
- Convert.ToDouble is missing culture, it throws exceptions all the time on my machine. I got around by setting
System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
in the Program.Main.
Please continue on this demo! I can do more code reviews later, but expect response to vary from 2min to weeks... :-)
Slxe wrote at 2014-05-26 21:23:
As far as coding style goes I use ReSharper myself, but I'll look into what StyleCop suggests just so it matches up to the requirements. Wasn't really sold on regions yet either, so I'll just remove them as per the guidelines. lol I come from Python which has the PEP8 Coding Guidelines and the "pythonic" way of coding, so I try and approach new languages looking for language specific idioms (if that's even the right way to word that? O_o), so any tips at all are always welcome.
objo wrote at 2014-06-06 21:25:
I can probably help setting up a little "skeleton example" using a
PlotController
, but I have a few other tasks to finish first...Slxe wrote at 2014-06-06 22:34:
They've actually asked me to make a generic custom control at work that will let them add axes and series through the designers properties browser, as well as include the annotation toolbar and a custom legend (it lists all axes and series in the plotmodel with visibility checkboxes and colour buttons for the series pic), so I'll probably end up taking some time to rework it into a proper mvc pattern for that and submit it afterwards. I'm just reading up on proper implementation of a custom control, properties and such in winforms (although it's kinda hard finding a good post on the subject after 2005ish, was hoping to find one with C# 4/5 features). It'll hopefully be pretty generic (although winforms based) so I'd be happy to submit it if It'd be useful.
Slxe wrote at 2014-06-11 19:10:
Been looking myself, but you wouldn't happen to have any good resources on pattern implementation for custom user controls in C#? Or I guess if it's even needed/recommended for user controls? Just going off a book a co worker let my borrow and various msdn posts.
objo wrote at 2014-06-11 22:02:
http://mark-dot-net.blogspot.no/2014/06/is-windows-forms-dead-yet.html
Slxe wrote at 2014-06-11 22:28:
Slxe wrote at 2014-06-13 18:07:
objo wrote at 2014-06-14 08:48:
Position of axis values in Polar Plot.
ralphbernardes wrote at 2014-06-12 01:53:
I have a polar plot with two angle axis and two magnitudes which I change dinamically so the data is better seen no matter the value plotted.
The problem is that both values for both axis are overlaping each other. I think this image explains better:
Is there a way for me to place the labels in the red rectangle on the right in the rectangle on the left?
Thanks a lot!
ralphbernardes wrote at 2014-06-17 01:57:
I'm out of ideas, any help is much appreciated!
Thanks!
ralphbernardes wrote at 2014-06-17 15:18:
Thanks.
objo wrote at 2014-06-17 15:53:
MagnitudeAxisRenderer.RenderTickText
and I think it is possible to set the
Angle
property of the angle axis to 180 degrees to achieve what you want.
But I think this should be improved, so I have added https://oxyplot.codeplex.com/workitem/10223
ralphbernardes wrote at 2014-06-17 19:51:
I did change the angle of the AngleAxis it does not change the position of the label.
The only time it changed was when I put 180 degrees to all axis (two angleaxis and two magnitudeaxis).
Does the startAngle and / or endAngle properties influence on this in anyway?
Thanks!
Ralph
CustomCategoryAxis
ckoo wrote at 2012-07-17 04:16:
Hi Objo,
We have implemented a CutomCategoryAxis, which allows you specify the range of the labels, mainly to use with the RectagularBarSeries, but it also works well with LineSeries if you want to create custom regions.
Anyway, we had to create a new class to store label information, such as the Name, From value and To value.
class AxisLabel { public string Name {get;set;} public double From {get;set;} public double To {get;set;} }
You can can then add AxisLabels to the CustomCategoryAxis to have labels defined with custom start and end positions.
The question is, we think it is probably better to merge this into the CategoryAxis and refactor it. Since the CategoryAxis only takes a String[] of category names, we can assign "From" and "To" values to the AxisLabel based on the "TotalWidthPerCategory" values. What do you think?
This would also make it easier to add mouse events to the category axis and return the category range based on which label has been clicked. In fact is there a way of merging the AxisLabel with a TextAnnotation class?
objo wrote at 2012-08-09 00:37:
I'll add this to the issue tracker. Need to think more how (or if) this can be implemented.
Creating SVG-Plots
ffiala wrote at 2012-01-08 20:20:
I wanted to use OxyPlot to generate SVG plots. My first step was to create the examples. The method of the PlotModel ToSvg() is used. But whenever I use examples which add data points or specially scaled axes, the plot fails, saying the reference to these objects is null. But the objects are passed by the example code correctly.
The PieSeries example works
http://oxyplot.iam.at/examplesvg.aspx?title=PieSeries.World%20population
The axis examples with individually parametrized axes does not scale the axis. Code:
var model =
new PlotModel("AbsoluteMinimum=-17, AbsoluteMaximum=63",
"Zooming and panning is limited to these values.");
model.Axes.Add(new LinearAxis(AxisPosition.Bottom) { Minimum = 0, Maximum = 50, AbsoluteMinimum = -17, AbsoluteMaximum = 63 });
model.Axes.Add(new LinearAxis(AxisPosition.Left) { Minimum = 0, Maximum = 50, AbsoluteMinimum = -17, AbsoluteMaximum = 63 });
string Svg = model.ToSvg(800, 400);
// output to webpage
Other examples are showing errors saying that objects do not exist but the values are given by the example code.
All examples: http://oxyplot.iam.at/
I am including OxyPlot and ExampleLibrary to my project (but not OxyPlot.Silverlight, OxyPlot.Metro, OxyPlot.OpenXml, OxyPlot.Pdf. OxyPlot.WindowsForms, OxyPlot.Wpf, OxyPlot.Xps).
Does someone have a hint for me?
objo wrote at 2012-01-08 22:47:
thanks for reporting the error - there must be a bug somewhere.
I will look into it soon. Should add a test that exports all example models from the example library to the various output formats.
Your dll reference is ok, only OxyPlot.dll is required when you export to SVG.
pver wrote at 2012-02-05 12:47:
I found the solution for both of the problems you have ffiala. If you first call Update() on the plotmodel you created (just before the ToSvg() call) , both the scaling and rendering with datapoints works as expected:
...
plotModel1.Series.Add(lineSeries1);
plotModel1.Update();
string
Svg = plotModel1.ToSvg(800, 400);
...
objo, I'll upload a patch that handles this in the ToSvg() method
Kind regards,
Peter
objo wrote at 2012-02-08 09:13:
Thanks for the solution, Peter! Is this solving issue 9874? I applied the patch. Sorry I don't have time to test this properly myself right now.
pver wrote at 2012-02-08 16:26:
You're welcome!
This indeed fixes issue 9874. I was able to simulate the exceptions ffiala had before the change. And with the change, the SVGs were exported correctly.
Customer support service by UserEcho