diff options
| author | Jacob Palecki <[email protected]> | 2020-08-13 01:52:49 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-08-13 01:52:49 -0700 |
| commit | 93a22c08b3223b040c3a3644fc3c4ef82fc576f0 (patch) | |
| tree | 336d99789e3dac52466c00fb5e07fc82a73c3bc8 /grapher/Models/Charts/ChartXY.cs | |
| parent | Almost working (diff) | |
| download | rawaccel-93a22c08b3223b040c3a3644fc3c4ef82fc576f0.tar.xz rawaccel-93a22c08b3223b040c3a3644fc3c4ef82fc576f0.zip | |
Dot to show mouse move
Diffstat (limited to 'grapher/Models/Charts/ChartXY.cs')
| -rw-r--r-- | grapher/Models/Charts/ChartXY.cs | 90 |
1 files changed, 67 insertions, 23 deletions
diff --git a/grapher/Models/Charts/ChartXY.cs b/grapher/Models/Charts/ChartXY.cs index 7bb7ac8..2c0ce2c 100644 --- a/grapher/Models/Charts/ChartXY.cs +++ b/grapher/Models/Charts/ChartXY.cs @@ -1,18 +1,26 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Windows.Forms.DataVisualization.Charting; +using static grapher.AccelCharts; namespace grapher { public class ChartXY { + #region Consts + public const int ChartSeparationHorizontal = 10; + #endregion Consts + + #region Constructors + public ChartXY(Chart chartX, Chart chartY) { ChartX = chartX; @@ -27,31 +35,13 @@ namespace grapher SetupChart(ChartY); } - public Chart ChartX { get; } - - public Chart ChartY { get; } - - public static void SetupChart(Chart chart) - { - chart.ChartAreas[0].AxisX.RoundAxisValues(); - - chart.ChartAreas[0].AxisX.ScaleView.Zoomable = true; - chart.ChartAreas[0].AxisY.ScaleView.Zoomable = true; - - chart.ChartAreas[0].AxisY.ScaleView.MinSize = 0.01; - chart.ChartAreas[0].AxisY.ScaleView.SmallScrollSize = 0.001; - - chart.ChartAreas[0].CursorY.Interval = 0.001; + #endregion Constructors - chart.ChartAreas[0].CursorX.AutoScroll = true; - chart.ChartAreas[0].CursorY.AutoScroll = true; + #region Properties - chart.ChartAreas[0].CursorX.IsUserSelectionEnabled = true; - chart.ChartAreas[0].CursorY.IsUserSelectionEnabled = true; + public Chart ChartX { get; } - chart.ChartAreas[0].CursorX.IsUserEnabled = true; - chart.ChartAreas[0].CursorY.IsUserEnabled = true; - } + public Chart ChartY { get; } public int Height { get @@ -77,7 +67,7 @@ namespace grapher public int Top { get { - return ChartX.Height; + return ChartX.Top; } } @@ -90,6 +80,58 @@ namespace grapher public bool Combined { get; private set; } + #endregion Properties + + #region Methods + + public static void SetupChart(Chart chart) + { + chart.ChartAreas[0].AxisX.RoundAxisValues(); + + chart.ChartAreas[0].AxisX.ScaleView.Zoomable = true; + chart.ChartAreas[0].AxisY.ScaleView.Zoomable = true; + + chart.ChartAreas[0].AxisY.ScaleView.MinSize = 0.01; + chart.ChartAreas[0].AxisY.ScaleView.SmallScrollSize = 0.001; + + chart.ChartAreas[0].CursorY.Interval = 0.001; + + chart.ChartAreas[0].CursorX.AutoScroll = true; + chart.ChartAreas[0].CursorY.AutoScroll = true; + + chart.ChartAreas[0].CursorX.IsUserSelectionEnabled = true; + chart.ChartAreas[0].CursorY.IsUserSelectionEnabled = true; + + chart.ChartAreas[0].CursorX.IsUserEnabled = true; + chart.ChartAreas[0].CursorY.IsUserEnabled = true; + + chart.Series[1].Points.Clear(); + chart.Series[1].Points.AddXY(0, 0); + } + + public static void DrawPoint(Chart chart, ChartPoint point) + { + chart.Series[1].Points[0].XValue = point.X; + chart.Series[1].Points[0].YValues[0] = point.Y; + } + + public void DrawPoints(ChartPoint CombinedPoint, ChartPoint XPoint, ChartPoint YPoint) + { + if (Combined) + { + DrawPoint(ChartX, CombinedPoint); + } + else + { + DrawPoint(ChartX, XPoint); + } + + if (ChartY.Visible) + { + DrawPoint(ChartY, YPoint); + } + } + public void Bind(IDictionary data) { ChartX.Series[0].Points.DataBindXY(data.Keys, data.Values); @@ -150,5 +192,7 @@ namespace grapher ChartX.Height = height; ChartY.Height = height; } + + #endregion Methods } } |