From c6cc72badf507f13ef48e330efddb57fe3030a5d Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Tue, 8 Sep 2020 16:53:16 -0700 Subject: Clean up chart titles, axes, legends --- grapher/Models/Charts/ChartXY.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'grapher/Models/Charts/ChartXY.cs') diff --git a/grapher/Models/Charts/ChartXY.cs b/grapher/Models/Charts/ChartXY.cs index 30be229..1360409 100644 --- a/grapher/Models/Charts/ChartXY.cs +++ b/grapher/Models/Charts/ChartXY.cs @@ -8,10 +8,11 @@ namespace grapher { #region Constructors - public ChartXY(Chart chartX, Chart chartY) + public ChartXY(Chart chartX, Chart chartY, string title) { ChartX = chartX; ChartY = chartY; + Title = title; ChartY.Top = ChartX.Top; ChartY.Height = ChartX.Height; @@ -77,6 +78,8 @@ namespace grapher public bool Visible { get; private set; } + public string Title { get; } + private PointData CombinedPointData { get; set; } private PointData XPointData { get; set; } @@ -110,6 +113,8 @@ namespace grapher chart.Series[1].Points.Clear(); chart.Series[1].Points.AddXY(0, 0); + + chart.Titles[0].Font = new System.Drawing.Font(chart.Titles[0].Font.Name, 9.0f, System.Drawing.FontStyle.Italic); } public static void DrawPoint(Chart chart, PointData point) @@ -165,6 +170,7 @@ namespace grapher { ChartY.Hide(); Combined = true; + ChartX.Titles[0].Text = Title; } } @@ -177,6 +183,9 @@ namespace grapher ChartY.Show(); } + ChartX.Titles[0].Text = SetComponentTitle(Constants.XComponent); + ChartY.Titles[0].Text = SetComponentTitle(Constants.YComponent); + Combined = false; } } @@ -246,6 +255,10 @@ namespace grapher ChartY.Height = height; } + private string SetComponentTitle(string component) + { + return $"{Title} : {component}"; + } #endregion Methods } } -- cgit v1.2.3 From ba642cd8c8e63ec3778fa17ecbcd7964074aaba1 Mon Sep 17 00:00:00 2001 From: Jacob Palecki Date: Mon, 21 Sep 2020 00:08:19 -0700 Subject: separate x/y mostly works --- grapher/Models/Charts/ChartXY.cs | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'grapher/Models/Charts/ChartXY.cs') diff --git a/grapher/Models/Charts/ChartXY.cs b/grapher/Models/Charts/ChartXY.cs index 1360409..fdd0258 100644 --- a/grapher/Models/Charts/ChartXY.cs +++ b/grapher/Models/Charts/ChartXY.cs @@ -117,12 +117,17 @@ namespace grapher chart.Titles[0].Font = new System.Drawing.Font(chart.Titles[0].Font.Name, 9.0f, System.Drawing.FontStyle.Italic); } - public static void DrawPoint(Chart chart, PointData point) + public static void DrawPoint(Chart chart, PointData pointOne, PointData pointTwo = null) { if (chart.Visible) { - point.Get(out var x, out var y); + pointOne.Get(out var x, out var y); chart.Series[1].Points.DataBindXY(x, y); + if (pointTwo != null) + { + pointTwo.Get(out x, out y); + chart.Series[3].Points.DataBindXY(x, y); + } chart.Update(); } } @@ -134,11 +139,18 @@ namespace grapher YPointData = y; } - public void DrawLastMovementValue() + public void DrawLastMovementValue(bool twoDotsPerGraph = false) { if(Combined) { - DrawPoint(ChartX, CombinedPointData); + if (twoDotsPerGraph) + { + DrawPoint(ChartX, XPointData, YPointData); + } + else + { + DrawPoint(ChartX, CombinedPointData); + } } else { @@ -164,6 +176,12 @@ namespace grapher ChartY.Series[0].Points.DataBindXY(dataY.Keys, dataY.Values); } + public void BindXYCombined(IDictionary dataX, IDictionary dataY) + { + ChartX.Series[0].Points.DataBindXY(dataX.Keys, dataX.Values); + ChartX.Series[2].Points.DataBindXY(dataY.Keys, dataY.Values); + } + public void SetCombined() { if (!Combined) -- cgit v1.2.3