Custom Markers
cwford wrote at 2012-04-25 20:50:
I would very much appreciate anyone who could demonstrate in code how to create a custom marker for OxyPlot in Sliverlight. The browser example displays a "star" marker but there is not indication in the method that implements this example of how the custom marker is created.
Thank you.
objo wrote at 2012-04-25 21:28:
See Source\Examples\ExampleLibrary\Examples\LineSeriesExamples.cs
The custom markers are currently limited to a single, continuous outline.
[Example("Custom markers")] public static PlotModel CustomMarkers() { var model = new PlotModel("LineSeries with custom markers") { LegendSymbolLength = 30, PlotType = PlotType.Cartesian }; const int N = 6; var customMarkerOutline = new ScreenPoint[N]; for (int i = 0; i < N; i++) { double th = Math.PI * (4.0 * i / (N - 1) - 0.5); const double R = 1; customMarkerOutline[i] = new ScreenPoint(Math.Cos(th) * R, Math.Sin(th) * R); } var s1 = new LineSeries("Series 1") { Color = OxyColors.Red, StrokeThickness = 2, MarkerType = MarkerType.Custom, MarkerOutline = customMarkerOutline, MarkerFill = OxyColors.DarkRed, MarkerStroke = OxyColors.Black, MarkerStrokeThickness = 0, MarkerSize = 10 }; foreach (var pt in customMarkerOutline) { s1.Points.Add(new DataPoint(pt.X, -pt.Y)); } model.Series.Add(s1); return model; }
cwford wrote at 2012-04-26 00:59:
objo,
Wow! Thanks for being so responsive. Have played around with the code and understand now that you kept XAML to a minimum so it could follow MVVM pattern.
Thank you for the code for the custom markers.
Clyde
Customer support service by UserEcho
I tried to do the same thing with PointAnnotation. But I could not find any outline property to set the custom marker outline to. I was wondering if you could tell how custom marker could be done with PointAnnotation.
I have added issue #174