diff options
| author | Jacob Palecki <[email protected]> | 2020-08-13 13:39:40 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-08-13 13:39:40 -0700 |
| commit | 6602649bd7f9a9849b25fe55a5e5e8a617f40b70 (patch) | |
| tree | 01360e218547270421b7ef91a7239b2702d1297e /grapher/Models/Charts/ChartXY.cs | |
| parent | Dot to show mouse move (diff) | |
| download | rawaccel-6602649bd7f9a9849b25fe55a5e5e8a617f40b70.tar.xz rawaccel-6602649bd7f9a9849b25fe55a5e5e8a617f40b70.zip | |
All works smoothly
Diffstat (limited to 'grapher/Models/Charts/ChartXY.cs')
| -rw-r--r-- | grapher/Models/Charts/ChartXY.cs | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/grapher/Models/Charts/ChartXY.cs b/grapher/Models/Charts/ChartXY.cs index 2c0ce2c..c0c8713 100644 --- a/grapher/Models/Charts/ChartXY.cs +++ b/grapher/Models/Charts/ChartXY.cs @@ -1,4 +1,6 @@ -using System; +using grapher.Models.Charts; +using grapher.Models.Mouse; +using System; using System.Collections; using System.Collections.Generic; using System.Drawing; @@ -80,6 +82,12 @@ namespace grapher public bool Combined { get; private set; } + private PointData CombinedPointData { get; set; } + + private PointData XPointData { get; set; } + + private PointData YPointData { get; set; } + #endregion Properties #region Methods @@ -109,26 +117,33 @@ namespace grapher chart.Series[1].Points.AddXY(0, 0); } - public static void DrawPoint(Chart chart, ChartPoint point) + public static void DrawPoint(Chart chart, PointData point) { - chart.Series[1].Points[0].XValue = point.X; - chart.Series[1].Points[0].YValues[0] = point.Y; + if (chart.Visible) + { + (var x, var y) = point.Get(); + chart.Series[1].Points.DataBindXY(x, y); + chart.Update(); + } } - public void DrawPoints(ChartPoint CombinedPoint, ChartPoint XPoint, ChartPoint YPoint) + public void SetPointBinds(PointData combined, PointData x, PointData y) { - if (Combined) + CombinedPointData = combined; + XPointData = x; + YPointData = y; + } + + public void DrawPoints() + { + if(Combined) { - DrawPoint(ChartX, CombinedPoint); + DrawPoint(ChartX, CombinedPointData); } else { - DrawPoint(ChartX, XPoint); - } - - if (ChartY.Visible) - { - DrawPoint(ChartY, YPoint); + DrawPoint(ChartX, XPointData); + DrawPoint(ChartY, YPointData); } } |