StringFormat instead of formatted value on DateTimeAxis
akiss wrote at 2013-09-20 14:14:
I've just installed OxyPlot and started experimenting with it. However, with DateTimeAxis, I ran into a strange problem. Whatever I set as StringFormat shows verbatim as the labels below the axis. I.e., if StringFormat=@"D", I see lots of Ds on the chart not the actual dates. If I set the property to null then yyyy appears instead of the years. Any ideas what's gone wrong?
Snipets below.
Thanks,
Akos
XAML:
<oxy:Plot x:Name="chart" Title="A Graph"/>
C#:PlotModel model = new PlotModel();
var xAxis = new DateTimeAxis(AxisPosition.Bottom, null, @"D", DateTimeIntervalType.Months) { MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Dot };
model.Axes.Add(xAxis);
var yAxis = new LinearAxis(AxisPosition.Left, 0.0 / 0.0, 0.0 / 0.0, "Value") { MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Dot };
model.Axes.Add(yAxis);
chart.Model = model;
Configuration: Win 7SP1 (Hungarian), VS Pro 2012U3, OxyPlot.Core|Wpf 2013.1.82.1 via NuGetobjo wrote at 2013-09-20 14:46:
https://oxyplot.codeplex.com/workitem/10077
akiss wrote at 2013-09-20 14:54:
OxyColors Gradient
A7eex wrote at 2013-08-14 10:23:
i'm currently trying to improve the Graphics of my Chart and therefore i wanted to change the PlotAreaBackground to a gradient Color so that it switches from i.e. white to light grey.
This feature is not supported yet, is it? Is there a way to achive this?
Regards Alex
objo wrote at 2013-08-14 10:42:
I recommend reading the books of Tufte and Few (links on home page), they have many recommendations about how a chart should be styled. Background gradients is one of the embellishments they don't recommend!
everytimer wrote at 2013-08-14 11:11:
A7eex wrote at 2013-08-14 11:23:
objo wrote at 2013-08-14 21:25:
See the example I just added! (Sorry, I didn't try to make it look pretty :)
A7eex wrote at 2013-08-16 09:56:
Measure rotated labels
anomistu wrote at 2012-03-28 16:58:
Just an fyi for this...
If ever you want to set the angle of an axis for displaying rotated major labels, you may want to correct the AxisBase.Measure method with the angle. Here's one quick way to do it:
...
double radians = this.Angle * Math.PI / 180; var maximumTextSize = new OxySize(); foreach (double v in majorLabelValues) { string s = this.FormatValue(v); OxySize size = rc.MeasureText(s, this.ActualFont, this.FontSize, this.FontWeight, this.Angle); size = new OxySize( Math.Abs(size.Width * Math.Cos(radians) + size.Height * Math.Sin(radians)), Math.Abs(size.Width * Math.Sin(radians) + size.Height * Math.Cos(radians)));
...
anomistu wrote at 2012-03-28 18:41:
Fixed (I hope) by bringing to first quadrant:
double radians = Math.Abs(this.Angle) * Math.PI / 180; var maximumTextSize = new OxySize(); foreach (double v in majorLabelValues) { string s = this.FormatValue(v); OxySize size = rc.MeasureText(s, this.ActualFont, this.FontSize, this.FontWeight, this.Angle); if (radians > Math.PI / 2) radians = Math.PI - radians; size = new OxySize( size.Width * Math.Cos(radians) + size.Height * Math.Sin(radians), size.Width * Math.Sin(radians) + size.Height * Math.Cos(radians));
objo wrote at 2012-03-30 13:23:
thanks, I will have a look at this! But isn't it necessary to check all 4 corners of the text bounding box to get the correct extents?
chage wrote at 2014-02-12 00:19:
I changed the axis code according to above example to handle rotated label. Things look great on WPF but the PDF export has the label overlapped with the axis, can you advise how to fix this as well?
Displaying message and axes on mouse click on the line serie
vboilay wrote at 2014-04-28 17:34:
I could not find an example about how to have a text message displaying clicked point coordinates as well as axes exactly like it is done in many examples (normal distribution for instance).
Same issue with finding a click event handler....
This is for winform/C#
The documentation is not easy to navigate. The product itself is stunning !
Thx for the good work.
objo wrote at 2014-04-29 09:17:
To handle click events I recommend using a
PlotController
. Can somebody explain how to do this for vboilay?vboilay wrote at 2014-04-29 09:50:
I understand that.
I have myself 2 kids and that is my first time using oxyplot.
Be ensured that by time passing by, if I am getting experienced, I will help the best I can.
Maximum number of LineSeries?
AntiqueMapMan wrote at 2014-02-12 02:49:
Is there a maximum number of LineSeries in a PlotModel? I added 8, but only the first 5 are displaying. As far as I can tell (and I've checked it a number of times) I'm treating all 8 LineSeries the same.
Thanks,
Dan
AntiqueMapMan wrote at 2014-02-12 21:09:
Thanks,
Dan
Context menu broken in the latest Nuget package?
bvsms wrote at 2014-04-03 02:50:
The last working Nuget version is 2014.1.229.1. Since then context menus are broken. Has something changed or this is a bug?
objo wrote at 2014-04-03 08:45:
OxyPlot.Wpf.Plot.OnMouseUp
method. We should add examples with context menu for both WPF and Silverlight.bvsms wrote at 2014-04-03 08:53:
Yes I went to the Silverlight online example (http://www.oxyplot.org/examplebrowser) and tried to look for a "context menu" example to double check but could not find an entry.
objo wrote at 2014-04-03 16:10:
objo wrote at 2014-04-03 22:26:
bvsms wrote at 2014-04-04 00:29:
Colored background bands
antdig wrote at 2012-07-10 22:30:
I've created a line graph to plot data on and it's working well. I'd like to have the background show colored bands to represent red/yellow/green areas. For example, the background of the graph should be red for Y values less than 10; yellow for Y values >= 10 and < 20; green for Y values >= 20.
What's the best way to achieve this?
(Here's a crude example: http://www.csc-scc.gc.ca/text/pblct/rpp/rpp2012-13/images/ex1-eng.jpg )
objo wrote at 2012-07-11 00:24:
This could be done by annotations. I added a "RectangleAnnotation" class - see the example "Annotations | RectangleAnnotation - horizontal bands" in the "Example browser". The code is in the ExampleLibrary/Examples/AnnotationExamples.cs
antdig wrote at 2012-07-11 02:23:
Dude, you rock! That works perfectly.
One thing I noticed is that if I specify the MaximumY parameter as double.MaxValue it didn't plot the RectangleAnnotation. However, this was trivial to solve by omitting the MaximumY parameter.
objo wrote at 2012-07-11 14:50:
I added support also for double.MinValue/MaxValue (same effect as using NaN). I see this is useful when setting only the upper/lower bound.
Ps. The hatched (pattern) brush in your example is not supported by OxyPlot.
Watermark
bsguedes wrote at 2012-05-25 15:46:
Hello again!
Is it possible to set an image as a watermark background in a plot?
Thanks!
objo wrote at 2012-05-26 08:28:
sorry, image/bitmap rendering is currently not supported (there are some challenges how to implement the bitmap data across the different render contexts (svg, wpf, sl, winforms, pdf etc.)
simple logos could be traced and added as vector graphics (see the Misc|La Linea example in the example browser for an example of a traced image)
bsguedes wrote at 2012-05-28 22:04:
Thanks for the answer! I was trying to solve the shadow grid problem reported on the other thread using a watermark, but now I'll no longer use dotted lines on the grid so it's fine!
Failed Implementation of Custom/Absolute StairStep Series
Camuvingian commented 20 hours ago
Math.Abs
value and when this occurs, the line style to reflect this has happened (by using color and or LineStyle
). So, to highlight what I wantTo do this, I have created the two classes (I have pasted actual code used below). This is conceptually easy when you know the tools you are working with, which I don't. My problem is directly related to my improper use of
rectangle.DrawClippedLineSegments()
. I can get a standard StairStepSeries
plotting (copying the internal code) but when I attempt to use the rectangle.DrawClippedLineSegments()
intuatively I realise I have not got a clue what this method does or how it is supposed to be used, but can't find any documentation. What is rectangle.DrawClippedLineSegments()
doing and how should this method be used?Any help anyone can provide (esp. changes or ammendments to my non-working class), it would be most appreciated. Thanks for your time.
Multiple Trackers
michael75 wrote at 2012-05-16 12:04:
Hi there!
First of all thank you very much for this excellent charting control! I love it!
Now to my question:
I would like to have multiple trackers in a chart available. For example for "measuring" a range. It should be possible to click at the first point and then drag over the data. While doing so, it should display both trackers and show additional data like the range value between the two data points.
How can I achieve this? Do I have to modify the sources or is it possible by customizing the Tracker property of the control?
Thanks in advance for your answers!
Michael
objo wrote at 2012-05-26 08:31:
I think you have to create a custom tracker control here. Then set the DefaultTrackerTemplate property of the Plot control (WPF/SL only).
Сервис поддержки клиентов работает на платформе UserEcho