public override void OnParentSurfaceRendered(SciChartRenderedMessage e) { base.OnParentSurfaceRendered(e); // TODO here: Modify which RenderableSeries are passed in to GetSeriesInfo to alter output var seriesInfos = this.GetSeriesInfo(ParentSurface.RenderableSeries); // TODO here: if you experience flicker, it is a .NET4.5 bug. This occurs when updating an ObservableCollection // the solution believe it or not is to do a differential update, e.g. only change the SeriesInfo instance if a series was added or removed LegendData.SeriesInfo = new ObservableCollection <SeriesInfo>(seriesInfos); }
/// <summary> /// Called when the parent <see cref="SciChartSurface" /> is rendered. Here is where we draw selected points /// </summary> /// <param name="e">The <see cref="SciChartRenderedMessage" /> which contains the event arg data</param> public override void OnParentSurfaceRendered(SciChartRenderedMessage e) { base.OnParentSurfaceRendered(e); var selectedPoints = this.SelectedPoints; if (selectedPoints == null) { return; } double size = SelectedPointSize; // Create Fill brush for the point marker using (var fill = e.RenderContext.CreateBrush(SelectedPointColor)) { // Iterating over renderable series foreach (var renderSeries in selectedPoints.Keys) { // Create stroke pen based on r-series color using (var stroke = e.RenderContext.CreatePen(renderSeries.Stroke, true, 1.0f)) { // We need XAxis/YAxis.GetCurrentCoordinateCalculator() from the current series (as they can be per-series) // to convert data points to pixel coords var xAxis = renderSeries.XAxis; var yAxis = renderSeries.YAxis; var xCalc = xAxis.GetCurrentCoordinateCalculator(); var yCalc = yAxis.GetCurrentCoordinateCalculator(); var pointList = selectedPoints[renderSeries]; // Iterate over the selected points foreach (var point in pointList) { // Draw the selected point marker e.RenderContext.DrawEllipse( stroke, fill, new Point(xCalc.GetCoordinate(point.XValue), yCalc.GetCoordinate(point.YValue)), size, size); } } } } }
public override void OnParentSurfaceRendered(SciChartRenderedMessage e) { base.OnParentSurfaceRendered(e); // TODO HERE: You could perform a hit-test again and update your ellipse positions on the rendered event }