LiveCharts.SeriesAlgorithms.ScatterAlgorithm.Update C# (CSharp) Method

Update() public method

Updates this instance.
public Update ( ) : void
return void
        public override void Update()
        {
            var bubbleSeries = (IScatterSeriesView) View;

            var p1 = new CorePoint();
            var p2 = new CorePoint();

            p1.X = Chart.WLimit.Max;
            p1.Y = bubbleSeries.MaxPointShapeDiameter;

            p2.X = Chart.WLimit.Min;
            p2.Y = bubbleSeries.MinPointShapeDiameter;

            var deltaX = p2.X - p1.X;
            // ReSharper disable once CompareOfFloatsByEqualityOperator
            var m = (p2.Y - p1.Y) / (deltaX == 0 ? double.MinValue : deltaX);

            var uw = new CorePoint(
                    CurrentXAxis.EvaluatesUnitWidth
                        ? ChartFunctions.GetUnitWidth(AxisOrientation.X, Chart, View.ScalesXAt) / 2
                        : 0,
                    CurrentYAxis.EvaluatesUnitWidth
                        ? ChartFunctions.GetUnitWidth(AxisOrientation.Y, Chart, View.ScalesYAt) / 2
                        : 0);

            foreach (var chartPoint in View.ActualValues.GetPoints(View))
            {
                chartPoint.ChartLocation = ChartFunctions.ToDrawMargin(
                    chartPoint, View.ScalesXAt, View.ScalesYAt, Chart) + uw;

                chartPoint.SeriesView = View;

                chartPoint.View = View.GetPointView(chartPoint,
                    View.DataLabels ? View.GetLabelPointFormatter()(chartPoint) : null);

                var bubbleView = (IScatterPointView) chartPoint.View;

                bubbleView.Diameter = m*(chartPoint.Weight - p1.X) + p1.Y;

                chartPoint.View.DrawOrMove(null, chartPoint, 0, Chart);
            }
        }