DateTime Label Formatter over 2 lines
SteveReedSr wrote at 2014-07-07 05:29:
07/06
10:00 am
I have been unable to determine how to a) get it broken onto 2 lines (I've tried putting \n in the format string without success), and b) how to get the am / pm designator.
I'm doing this using Xamarin for Android
Thanks in advance!
objo wrote at 2014-07-10 12:21:
DateTimeAxis
. I have added https://oxyplot.codeplex.com/workitem/10228
Performance improvement with DateTimeAxis
kidproquo wrote at 2012-08-17 14:36:
Hi,
In your wiki page for performance, you mention that the slowest performance is when we set ItemsSource and use the data field properties.
However, this is what is done in the DateTimeDemo (Examples.WPF.WpfExample.DateTimeDemo). I followed this tutorial to have 300k points with DateTimeAxis in the bottom and a LinearAxis on the left. The chart is slow to respond to mouse events (click/zoom/resize window, etc.).
Any way to optimize this? How can I use IDataPoint or Mapping (the first three recommendations in the performance page) when my X-axis data is of type DateTime?
Regards,
Kid
kidproquo wrote at 2012-08-18 03:07:
Ah..I figured it out. Now I do this:
mySeries.Points.Add(new DataPoint(DateTimeAxis.ToDouble(myDateTime),myValue))
However, plot response is slow for 300k points. Any suggestions?
objo wrote at 2012-08-21 13:18:
If you use a ScatterSeries, you can increase the "BinSize" property - but this will make a less accurate plot...
You should also run a performance profiler to see if the bottleneck is in your code, oxyplot or wpf.
Small typo in OxyPlot.Metro.csproj XML
dcuccia wrote at 2012-06-24 02:32:
First, off - awesome library. Second, I checked out Thursday's changeset (bdba153d17f0) and attempted to load the Metro solution/project - ran into this message. Looks like the runtime reference in the XML has a typo - changed the following framework reference from v1.0 to v11.0 as follows and it worked:
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v11.0\Microsoft.Windows.UI.Xaml.CSharp.targets" />
objo wrote at 2012-06-26 06:06:
Thanks! I changed the version numbers.
Note that this was done with the first preview of VS2012/Metro, I have not tested with the latest release candidate yet.
Feel free to create a fork if you do more work to get the Metro version running!
PNG encoder changes?
thomasdr wrote at 2013-12-16 19:25:
objo wrote at 2013-12-16 20:55:
https://oxyplot.codeplex.com/SourceControl/changeset/62c4f57c6da9
(to make all the pixel arrays consistent - in OxyImage, pdf exporter, png encoder etc)
See the documentation for the PngEncoder.Export method, I guess you need to change the order of the indices in the source array:
/// <summary> /// Encodes the specified image data to png. /// </summary> /// <param name="pixels"> /// The pixel data indexed as [x,y] (bottom line first). /// </param> /// <returns> /// The png image data. /// </returns> public byte[] Encode(OxyColor[,] pixels)
thomasdr wrote at 2013-12-30 15:45:
objo wrote at 2014-01-07 21:36:
How can I make line series color, axis label color & axis title color to be the same.
krishnaramuu wrote at 2014-04-19 12:01:
Thanks,
Ramakrishna
objo wrote at 2014-04-25 09:40:
For the axis use the TitleColor and TextColor properties, for the LineSeries use the Color property.
BarSeries axis
jezza323 wrote at 2012-01-05 17:02:
Looking at the Histogram example, is there a way currently to set a MajorStep on the CategoryAxis so that not every number on the axis is displayed, say every 5th one as you would get if it were a regular LinearAxis? If not is anyone else interested in this functionality?
jezza323 wrote at 2012-01-05 21:17:
Playing with the code I am able to make a change so the default behaviour stays as is, but Majorsteps are supported. I will submit a patch if anyone else has interest?
objo wrote at 2012-01-05 21:26:
Yes, it sounds ok to use MajorStep to provide this functionality. Please submit a patch :)
jezza323 wrote at 2012-01-06 19:15:
Patch submitted, please see WorkItem 9787
OxyPlot paint Exception : XAxis not defined
OverDriver wrote at 2014-07-14 17:51:
I had this bug (OxyPlot paint Exception : XAxis not defined ) in my code. If I scale the plot with mouse it goes away but I can always see it when something is newly plotted. I did add axes to my Model.
Here's the code
newPlot.DrawGraph(graphMain);// this calls DrawGraph function
public void DrawGraph(OxyPlot.WindowsForms.PlotView iptGraph)
{
var tmp=new OxyPlot.Series.LineSeries();
tmp.StrokeThickness= 0.4;
for (int i = 0; i < _resampledPoints.Count(); i++)
{
tmp.Points.Add(_resampledPoints[i]);
}
iptGraph.Model.Series.Add(tmp);
}
Thanks a lot!Slxe wrote at 2014-07-14 19:08:
foreach (var p in _resampledPoints) tmp.Points.Add(p);
tmp.Points.AddRange(_resampledPoints);
Second, please provide the code you use to assign the horizontal axis (or just all of them) to the PlotModel, can't really help when you're just adding points to a series =P.
OverDriver wrote at 2014-07-14 19:27:
These are the codes that I use to add axies to the PlotModel (graphMain).
OxyPlot.Axes.LinearAxis XAxis = new OxyPlot.Axes.LinearAxis { Position = OxyPlot.Axes.AxisPosition.Bottom, MinimumPadding = 10, MaximumPadding = 15, AbsoluteMinimum = 0,Maximum=80};
OxyPlot.Axes.LinearAxis YAxis = new OxyPlot.Axes.LinearAxis { Position = OxyPlot.Axes.AxisPosition.Left, MinimumPadding = 10, MaximumPadding = 15, AbsoluteMinimum = 0, Maximum=400};
graphMain.Model.Axes.Add(YAxis);
graphMain.Model.Axes.Add(XAxis);
If I try to define plotmodel under DrawGraph function this exception actually disappears. But I need to add multiple lines to PlotModel so I can't really do that.Slxe wrote at 2014-07-14 20:11:
using System.Linq; using OxyPlot; using OxyPlot.Axes; using OxyPlot.Series; // cut out namespace and class definitions to save indention levels private void InitializeChart() { // didn't see it in your code, but you should initialize your own PlotModel and assign it to the // PlotView before using PlotView.Model var model = new PlotModel(); model.Axes.Add(new LinearAxis { Key = "xAxis", Position = AxisPosition.Bottom, Title = "X Axis" }); // just to show another way of using the new axis var yAxis = new LinearAxis { Key = "yAxis", Position = AxisPosition.Left, Title = "Y Axis" }; // the series title will show up in the legend var series = new LineSeries {Title = "Resampled Points", YAxisKey = "yAxis"}; foreach (var p in _resampledPoints) series.Points.Add(p); // two examples of how to get the axes, highly suggest LINQ if you're in dotNet 3.0+ model.Axes.OfType<LinearAxis>().First(a => a.Key == "xAxis").AbsoluteMinimum = 0; model.Axes.OfType<LinearAxis>().First(a => a.Key == "xAxis").Maximum = 80; yAxis.AbsoluteMinimum = 0; yAxis.Maximum = 400; // I'm guessing your graphMain is your PlotView graphMain.Model = model; }
Not really sure what you mean by defining it under the drawgraph function, you'll have to elaborate.
Also, welcome to C#! I've been in this space for around 5 months now, came from Python and Java myself, mainly for work. Quite enjoying the language (don't really like the framework restrictions though, being a linux guy), hope you like it here! I'm currently playing around with F# myself, really falling for functional programming lately.
OverDriver wrote at 2014-07-14 20:30:
Thanks!
public void DrawGraph(OxyPlot.WindowsForms.PlotView iptGraph)//this function will add line series to PlotView
{
var tmpModel = new OxyPlot.PlotModel();
int xpixels = iptGraph.Width;
double xratio = (double)_points.Count() / (double)xpixels;
var tmp = new OxyPlot.Series.LineSeries();
_resampledPoints.Clear();
for (int i = 0; i < xpixels; i++)//set resampled points
{
int idx = (int)(i * xratio);
_resampledPoints.Add(new OxyPlot.DataPoint(_points[idx].X+_xOffset, _points[idx].Y+_yOffset));
if (_xMax < _points[idx].X) _xMax = _points[idx].X;
if (_yMax < _points[idx].Y) _yMax = _points[idx].Y;
}
tmp.StrokeThickness= 0.4;
tmp.Points.AddRange(_resampledPoints);
iptGraph.Model.Series.Add(tmp); //Here I add tmp line to PlotView graph
}
Slxe wrote at 2014-07-14 20:54:
For example in your chart class you can have an InitializeChart() method that sets up basic axes and series, (or for more dynamic control, InitializeChart(), AddSeries(various series info arguments), and AddAxis(various axes info arguments), and some kind of AddPoints(object tag, IEnumerable<DataPoints>) to add data to the series, using the tag to look up the correct one with linq (view.Model.Series.First(s => s.Tag == tag), or Single if you're only expecting one result).
I'm actually doing something similar to this in a simplified custom control I'm making for work, if you need a more comprehensive example I'd be happy to share.
OverDriver wrote at 2014-07-14 21:13:
I'll try the Linq! It looks very handy.
Thanks again!
Slxe wrote at 2014-07-14 21:19:
OverDriver wrote at 2014-07-14 22:05:
More than one legend
jesusvpct wrote at 2014-06-02 12:11:
Thanks.
objo wrote at 2014-06-06 21:01:
We have a similar feature request in https://oxyplot.codeplex.com/workitem/9192
How is this defined in mschart?
Could we add a
LegendGroup
property to the series? Then define how the legend groups should be presented in the plot model.Margin for the ResetAllAxis command and take into account annotations
Also, I would like to have a way to force annotation to be took into consideration for the reset axis. I use some annotations to display information and I would like that the annotation is displayed completely when the user reset all the axis.
Maybe something already exists, but I didn't find it.
Thanks
XAML support for ColumnSeries and RectangleBarSeries?
RickNZ wrote at 2012-08-29 09:32:
It looks like XAML support isn't yet available for a few types of series, including ColumnSeries and RectangleBarSeries.
Is this a known bug/limitation?
objo wrote at 2012-08-29 10:34:
Yes, all series are not supporting XAML yet. Vote on http://oxyplot.codeplex.com/workitem/9999
Customer support service by UserEcho