summaryrefslogtreecommitdiff
path: root/grapher/Models/Charts
diff options
context:
space:
mode:
authorJacobPalecki <[email protected]>2020-09-22 19:59:47 -0700
committerGitHub <[email protected]>2020-09-22 19:59:47 -0700
commit77f420cf45a1a0bee00602965e687097367e2a70 (patch)
treefa088af8f2feb54df5bcb6a036715fd32d0511e8 /grapher/Models/Charts
parentMerge pull request #21 from JacobPalecki/GUI (diff)
parentUpdate credits (diff)
downloadrawaccel-77f420cf45a1a0bee00602965e687097367e2a70.tar.xz
rawaccel-77f420cf45a1a0bee00602965e687097367e2a70.zip
Merge pull request #22 from JacobPalecki/GUI
Replace SigmoidGain with Motivity & Cleanup
Diffstat (limited to 'grapher/Models/Charts')
-rw-r--r--grapher/Models/Charts/AccelCharts.cs5
-rw-r--r--grapher/Models/Charts/ChartState/ChartState.cs24
-rw-r--r--grapher/Models/Charts/ChartState/CombinedState.cs2
-rw-r--r--grapher/Models/Charts/ChartState/XYOneGraphState.cs2
-rw-r--r--grapher/Models/Charts/ChartState/XYTwoGraphState.cs3
-rw-r--r--grapher/Models/Charts/ChartXY.cs53
6 files changed, 88 insertions, 1 deletions
diff --git a/grapher/Models/Charts/AccelCharts.cs b/grapher/Models/Charts/AccelCharts.cs
index d22ab78..a0e99c8 100644
--- a/grapher/Models/Charts/AccelCharts.cs
+++ b/grapher/Models/Charts/AccelCharts.cs
@@ -149,6 +149,11 @@ namespace grapher
ChartState.Calculate(accel, settings);
}
+ public void SetLogarithmic(bool x, bool y)
+ {
+ ChartState.SetLogarithmic(x, y);
+ }
+
private static void SetupCharts(
ChartXY sensitivityChart,
ChartXY velocityChart,
diff --git a/grapher/Models/Charts/ChartState/ChartState.cs b/grapher/Models/Charts/ChartState/ChartState.cs
index ea67e83..e1c7d01 100644
--- a/grapher/Models/Charts/ChartState/ChartState.cs
+++ b/grapher/Models/Charts/ChartState/ChartState.cs
@@ -100,5 +100,29 @@ namespace grapher.Models.Charts.ChartState
GainChart.Hide();
form.Height = SensitivityChart.Height + borderHeight;
}
+
+ public void SetLogarithmic(bool x, bool y)
+ {
+ if (x)
+ {
+ ChartXY.SetLogarithmic(SensitivityChart.ChartX);
+ ChartXY.SetLogarithmic(GainChart.ChartX);
+ }
+ else
+ {
+ ChartXY.SetStandard(SensitivityChart.ChartX);
+ ChartXY.SetStandard(GainChart.ChartX);
+ }
+
+ if (y)
+ {
+ ChartXY.SetLogarithmic(SensitivityChart.ChartY);
+ ChartXY.SetLogarithmic(GainChart.ChartY);
+ }
+ {
+ ChartXY.SetStandard(SensitivityChart.ChartY);
+ ChartXY.SetStandard(GainChart.ChartY);
+ }
+ }
}
}
diff --git a/grapher/Models/Charts/ChartState/CombinedState.cs b/grapher/Models/Charts/ChartState/CombinedState.cs
index 17cd68a..f4b6b8f 100644
--- a/grapher/Models/Charts/ChartState/CombinedState.cs
+++ b/grapher/Models/Charts/ChartState/CombinedState.cs
@@ -36,6 +36,8 @@ namespace grapher.Models.Charts.ChartState
SensitivityChart.Bind(Data.Combined.AccelPoints);
VelocityChart.Bind(Data.Combined.VelocityPoints);
GainChart.Bind(Data.Combined.GainPoints);
+ SensitivityChart.SetMinMax(Data.Combined.MinAccel, Data.Combined.MaxAccel);
+ GainChart.SetMinMax(Data.Combined.MinGain, Data.Combined.MaxGain);
}
public override void Calculate(ManagedAccel accel, DriverSettings settings)
diff --git a/grapher/Models/Charts/ChartState/XYOneGraphState.cs b/grapher/Models/Charts/ChartState/XYOneGraphState.cs
index bbc0c28..6bfaac5 100644
--- a/grapher/Models/Charts/ChartState/XYOneGraphState.cs
+++ b/grapher/Models/Charts/ChartState/XYOneGraphState.cs
@@ -38,6 +38,8 @@ namespace grapher.Models.Charts.ChartState
SensitivityChart.BindXYCombined(Data.X.AccelPoints, Data.Y.AccelPoints);
VelocityChart.BindXYCombined(Data.X.VelocityPoints, Data.Y.VelocityPoints);
GainChart.BindXYCombined(Data.X.GainPoints, Data.Y.GainPoints);
+ SensitivityChart.SetMinMax(Data.Combined.MinAccel, Data.Combined.MaxAccel);
+ GainChart.SetMinMax(Data.Combined.MinGain, Data.Combined.MaxGain);
}
public override void Calculate(ManagedAccel accel, DriverSettings settings)
diff --git a/grapher/Models/Charts/ChartState/XYTwoGraphState.cs b/grapher/Models/Charts/ChartState/XYTwoGraphState.cs
index 69dc335..b775853 100644
--- a/grapher/Models/Charts/ChartState/XYTwoGraphState.cs
+++ b/grapher/Models/Charts/ChartState/XYTwoGraphState.cs
@@ -65,6 +65,9 @@ namespace grapher.Models.Charts.ChartState
SensitivityChart.BindXY(Data.X.AccelPoints, Data.Y.AccelPoints);
VelocityChart.BindXY(Data.X.VelocityPoints, Data.Y.VelocityPoints);
GainChart.BindXY(Data.X.GainPoints, Data.Y.GainPoints);
+
+ SensitivityChart.SetMinMaxXY(Data.X.MinAccel, Data.X.MaxAccel, Data.Y.MinAccel, Data.Y.MaxAccel);
+ GainChart.SetMinMaxXY(Data.X.MinGain, Data.X.MaxGain, Data.Y.MinGain, Data.Y.MaxGain);
}
public override void Calculate(ManagedAccel accel, DriverSettings settings)
diff --git a/grapher/Models/Charts/ChartXY.cs b/grapher/Models/Charts/ChartXY.cs
index fdd0258..c30c993 100644
--- a/grapher/Models/Charts/ChartXY.cs
+++ b/grapher/Models/Charts/ChartXY.cs
@@ -100,6 +100,9 @@ namespace grapher
chart.ChartAreas[0].AxisY.ScaleView.MinSize = 0.01;
chart.ChartAreas[0].AxisY.ScaleView.SmallScrollSize = 0.001;
+ chart.ChartAreas[0].AxisX.LabelStyle.Format = "0.##";
+ chart.ChartAreas[0].AxisY.LabelStyle.Format = "0.##";
+
chart.ChartAreas[0].CursorY.Interval = 0.001;
chart.ChartAreas[0].CursorX.AutoScroll = true;
@@ -128,10 +131,29 @@ namespace grapher
pointTwo.Get(out x, out y);
chart.Series[3].Points.DataBindXY(x, y);
}
- chart.Update();
}
}
+ public static void SetLogarithmic(Chart chart)
+ {
+ /*
+ chart.ChartAreas[0].AxisX.Minimum = 0.001;
+ chart.ChartAreas[0].AxisX.Maximum = 3500;
+ chart.ChartAreas[0].AxisY.Minimum = 0.001;
+ chart.ChartAreas[0].AxisY.Maximum = 10;
+ chart.ChartAreas[0].AxisX.IsLogarithmic = true;
+ chart.ChartAreas[0].AxisY.IsLogarithmic = true;
+ */
+ }
+
+ public static void SetStandard(Chart chart)
+ {
+ /*
+ chart.ChartAreas[0].AxisX.IsLogarithmic = false;
+ chart.ChartAreas[0].AxisY.IsLogarithmic = false;
+ */
+ }
+
public void SetPointBinds(PointData combined, PointData x, PointData y)
{
CombinedPointData = combined;
@@ -168,18 +190,47 @@ namespace grapher
public void Bind(IDictionary data)
{
ChartX.Series[0].Points.DataBindXY(data.Keys, data.Values);
+ ChartX.Series[2].IsVisibleInLegend = false;
+ ChartX.Series[2].Points.Clear();
}
public void BindXY(IDictionary dataX, IDictionary dataY)
{
ChartX.Series[0].Points.DataBindXY(dataX.Keys, dataX.Values);
ChartY.Series[0].Points.DataBindXY(dataY.Keys, dataY.Values);
+ ChartX.Series[2].IsVisibleInLegend = false;
+ ChartX.Series[2].Points.Clear();
}
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);
+ ChartX.Series[2].IsVisibleInLegend = true;
+ }
+
+ public void SetMinMax(double min, double max)
+ {
+ if (min < max)
+ {
+ ChartX.ChartAreas[0].AxisY.Minimum = min;
+ ChartX.ChartAreas[0].AxisY.Maximum = max;
+ }
+ }
+
+ public void SetMinMaxXY(double minX, double maxX, double minY, double maxY)
+ {
+ if (minX < maxX)
+ {
+ ChartX.ChartAreas[0].AxisY.Minimum = minX;
+ ChartX.ChartAreas[0].AxisY.Maximum = maxX;
+ }
+
+ if (minY < maxY)
+ {
+ ChartY.ChartAreas[0].AxisY.Minimum = minY;
+ ChartY.ChartAreas[0].AxisY.Maximum = maxY;
+ }
}
public void SetCombined()