/// <summary> /// Synchronizes the properties. /// </summary> /// <param name="series">The series.</param> protected override void SynchronizeProperties(OxyPlot.Series.Series series) { base.SynchronizeProperties(series); var s = (OxyPlot.Series.LineSeries)series; s.Color = Color.ToOxyColor(); s.StrokeThickness = StrokeThickness; s.LineStyle = LineStyle; s.MarkerResolution = MarkerResolution; s.MarkerSize = MarkerSize; s.MarkerStroke = MarkerStroke.ToOxyColor(); s.MarkerType = MarkerType; s.MarkerStrokeThickness = MarkerStrokeThickness; s.Dashes = Dashes; s.LineJoin = LineJoin; s.MarkerFill = MarkerFill.ToOxyColor(); s.MarkerOutline = (MarkerOutline ?? Enumerable.Empty <Point>()).Select(point => point.ToScreenPoint()).ToArray(); s.MinimumSegmentLength = MinimumSegmentLength; s.LabelFormatString = LabelFormatString; s.LabelMargin = LabelMargin; s.LineLegendPosition = LineLegendPosition; s.BrokenLineColor = BrokenLineColor.ToOxyColor(); s.BrokenLineStyle = BrokenLineStyle; s.BrokenLineThickness = BrokenLineThickness; s.Decimator = Decimator; s.InterpolationAlgorithm = this.InterpolationAlgorithm; }
/// <summary> /// Writes the content of the current row into a binary stream. /// May be used to compare instances of data rows. /// </summary> /// <param name="w">The binary stream to write to.</param> public override void Dump(BinaryWriter w) { base.Dump(w); w.Write(Longitude); w.Write(Latitude); w.Write(Caption ?? string.Empty); // font is not variable between rows now, so we skip it // write font... todo if font becomes variable // ditto ForeColor w.Write(MarkerSize); w.Write(MarkerFill.ToArgb()); w.Write(MarkerStroke.ToArgb()); w.Write((int)MarkerShape); }
/// <summary> /// Synchronizes the properties. /// </summary> /// <param name="series">The series.</param> protected override void SynchronizeProperties(OxyPlot.Series.Series series) { base.SynchronizeProperties(series); var s = (OxyPlot.Series.ScatterSeries <T>)series; s.MarkerFill = MarkerFill.ToOxyColor(); s.MarkerStroke = MarkerStroke.ToOxyColor(); s.MarkerStrokeThickness = MarkerStrokeThickness; s.MarkerType = MarkerType; s.MarkerSize = MarkerSize; s.DataFieldX = DataFieldX; s.DataFieldY = DataFieldY; s.DataFieldSize = DataFieldSize; s.DataFieldValue = DataFieldValue; s.DataFieldTag = DataFieldTag; s.ItemsSource = Items; s.BinSize = BinSize; s.Mapping = Mapping; s.MarkerOutline = MarkerOutline; s.ColorAxisKey = ColorAxisKey; }
/// <inheritdoc/> /// see https://github.com/oxyplot/oxyplot/blob/develop/Source/OxyPlot/Series/ScatterSeries%7BT%7D.cs#L322-L460 public override void Render(IRenderContext rc) { var actualPoints = ActualPointsList; if (actualPoints == null || actualPoints.Count == 0) { return; } var clippingRect = GetClippingRect(); var n = actualPoints.Count; var allPoints = new List <ScreenPoint>(n); var allMarkerSizes = new List <double>(n); var groupPoints = new Dictionary <int, IList <ScreenPoint> >(); var groupSizes = new Dictionary <int, IList <double> >(); // Transform all points to screen coordinates for (var i = 0; i < n; i++) { var dp = new DataPoint(actualPoints[i].X, actualPoints[i].Y); // Skip invalid points if (!IsValidPoint(dp)) { continue; } var size = double.NaN; var value = double.NaN; var scatterPoint = actualPoints[i]; if (scatterPoint != null) { size = scatterPoint.Size; value = scatterPoint.Value; } if (double.IsNaN(size)) { size = MarkerSize; } // Transform from data to screen coordinates var screenPoint = this.Transform(dp.X, dp.Y); if (ColorAxis != null) { if (double.IsNaN(value)) { continue; } var group = ColorAxis.GetPaletteIndex(value); if (!groupPoints.ContainsKey(group)) { groupPoints.Add(group, new List <ScreenPoint>()); groupSizes.Add(group, new List <double>()); } groupPoints[group].Add(screenPoint); groupSizes[group].Add(size); } else { allPoints.Add(screenPoint); allMarkerSizes.Add(size); } } // Offset of the bins var binOffset = this.Transform(MinX, MaxY); if (ColorAxis != null) { // Draw the grouped (by color defined in ColorAxis) markers var markerIsStrokedOnly = MarkerType == MarkerType.Plus || MarkerType == MarkerType.Star || MarkerType == MarkerType.Cross; foreach (var(key, value) in groupPoints) { var color = ColorAxis.GetColor(key); rc.DrawMarkers( value, MarkerType, MarkerOutline, groupSizes[key], OxyColor.FromAColor(Opacity, MarkerFill.GetActualColor(color)), markerIsStrokedOnly ? color : MarkerStroke, MarkerStrokeThickness, EdgeRenderingMode, BinSize, binOffset); } } rc.DrawMarkers( allPoints, MarkerType, MarkerOutline, allMarkerSizes, OxyColor.FromAColor(Opacity, ActualMarkerFillColor), MarkerStroke, MarkerStrokeThickness, EdgeRenderingMode, BinSize, binOffset); if (LabelFormatString != null) { RenderPointLabels(rc, clippingRect); } }