Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
GREMIAR committed Jul 10, 2021
1 parent da47626 commit 70e58e4
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 59 deletions.
57 changes: 29 additions & 28 deletions Charts/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 37 additions & 31 deletions Charts/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,23 +227,6 @@ private void radioButton_CheckedChanged(object sender, EventArgs e)
AreaPaint.Refresh();
tableupdate = true;
}
else
{
tableA.Rows.Clear();
for (int i = 0; i < nowTable.Rows.Count - 1; i++)
{
tableA.Rows.Add(nowTable.Rows[i].Cells[0].Value, nowTable.Rows[i].Cells[1].Value); ;
}
dopPoints = new PointF[tableA.Rows.Count - 1];
for (int i = 0; i < tableA.Rows.Count - 1; i++)
{
dopPoints[i].X = float.Parse(tableA.Rows[i].Cells[0].Value.ToString());
dopPoints[i].Y = -float.Parse(tableA.Rows[i].Cells[1].Value.ToString());
}
tableupdate = false;
AreaPaint.Refresh();
tableupdate = true;
}
}

private void SlowDrawing_CheckedChanged(object sender, EventArgs e)
Expand Down Expand Up @@ -419,8 +402,9 @@ void PaintChart(Graphics graphics)
{
int minY = -((AreaPaint.Height) / 2 / plusM + GeneralRestrictions(CentralY)) - 1;
int limitationDownY;
if (LimitationUpY.Text != "" && Int32.TryParse(LimitationUpY.Text, out limitationDownY))
if (LimitationDownY.Text != "" && Int32.TryParse(LimitationDownY.Text, out limitationDownY))
{
limitationDownY = -limitationDownY;
if (limitationDownY < minY)
{
limitationDownY = minY;
Expand All @@ -432,9 +416,9 @@ void PaintChart(Graphics graphics)
}
int limitationUpY = 0;
int maxY = (AreaPaint.Height) / plusM + minY + 1;
if (LimitationDownY.Text != "" && Int32.TryParse(LimitationDownY.Text, out limitationUpY))
if (LimitationUpY.Text != "" && Int32.TryParse(LimitationUpY.Text, out limitationUpY))
{
if (limitationUpY > maxY)
if (-limitationUpY > maxY)
{
limitationUpY = maxY;
}
Expand Down Expand Up @@ -523,21 +507,21 @@ void PaintChart(Graphics graphics)
void RemoveUnnecessary(PointF point, ref PointF[] allPoints, ref int countAllPoint, int limitationDownY, int limitationUpY, List<PointF[]> segments, float x)
{
float checkedNumber = (point.Y);
if (checkedNumber <= -limitationDownY && checkedNumber >= -limitationUpY)
if (checkedNumber <= limitationUpY && checkedNumber >= limitationDownY)
{
if(countAllPoint==0)
if (countAllPoint == 0)
{
Charts.TranslatingExpression translating = new Charts.TranslatingExpression();
PointF pointF = new PointF(point.X-1/(float)plusM, translating.Translating(functionMain.Text, point.X - 1/(float)plusM));
if(!float.IsNaN(pointF.X) && !float.IsNaN(pointF.Y) && !float.IsInfinity(pointF.Y))
PointF pointF = new PointF(point.X - (float)1 / (float)plusM, translating.Translating(functionMain.Text, point.X - (float)1 / (float)plusM));
if (!float.IsNaN(pointF.X) && !float.IsNaN(pointF.Y) && !float.IsInfinity(pointF.Y))
{
allPoints[countAllPoint] = pointF;
allPoints[countAllPoint].X = allPoints[countAllPoint].X * plusM + centralX;
allPoints[countAllPoint].Y = allPoints[countAllPoint].Y * plusM + centralY;
countAllPoint++;
}
}
if(countAllPoint< allPoints.Length)
if (countAllPoint < allPoints.Length)
{
if (!float.IsNaN(point.X) && !float.IsNaN(point.Y) && !float.IsInfinity(point.Y))
{
Expand All @@ -550,10 +534,10 @@ void RemoveUnnecessary(PointF point, ref PointF[] allPoints, ref int countAllPoi
}
else
{
if (allPoints.Length > 1)
if (countAllPoint > 1)
{
Charts.TranslatingExpression translating = new Charts.TranslatingExpression();
PointF pointF = new PointF(x, translating.Translating(functionMain.Text, x));
PointF pointF = new PointF(x , translating.Translating(functionMain.Text, x));
if (!float.IsNaN(pointF.X) && !float.IsNaN(pointF.Y) && !float.IsInfinity(pointF.Y))
{
if (countAllPoint < allPoints.Length)
Expand All @@ -567,11 +551,11 @@ void RemoveUnnecessary(PointF point, ref PointF[] allPoints, ref int countAllPoi
Array.Resize(ref allPoints, countAllPoint);
segments.Add(allPoints);
}
allPoints = new PointF[AreaPaint.Width + +plusM+2];
allPoints = new PointF[AreaPaint.Width + +plusM + 2];
countAllPoint = 0;
}
}

async void SpeedDrawing(Graphics graphics, List<PointF[]> segments)
{
if (segments.Count > 0)
Expand Down Expand Up @@ -677,6 +661,24 @@ private void CountPoints_TextChanged(object sender, EventArgs e)
AreaPaint.Refresh();
}

private void button3_Click(object sender, EventArgs e)
{
tableA.Rows.Clear();
for (int i = 0; i < nowTable.Rows.Count - 1; i++)
{
tableA.Rows.Add(nowTable.Rows[i].Cells[0].Value, nowTable.Rows[i].Cells[1].Value); ;
}
dopPoints = new PointF[tableA.Rows.Count - 1];
for (int i = 0; i < tableA.Rows.Count - 1; i++)
{
dopPoints[i].X = float.Parse(tableA.Rows[i].Cells[0].Value.ToString());
dopPoints[i].Y = -float.Parse(tableA.Rows[i].Cells[1].Value.ToString());
}
tableupdate = false;
AreaPaint.Refresh();
tableupdate = true;
}

void tableCompletion()
{
List<PointF> nowPoints = new List<PointF>();
Expand Down Expand Up @@ -734,6 +736,10 @@ void tableCompletion()
Charts.TranslatingExpression translating = new Charts.TranslatingExpression();
for (int i = 0; x1<=e1; i++)
{
if(x1==-13)
{

}
temporaryPoint[i] = new PointF(x1, translating.Translating(functionMain.Text, x1));
float checkedNumber = (temporaryPoint[i].Y);
if (checkedNumber <= -limitationDownY && checkedNumber >= -limitationUpY)
Expand All @@ -750,7 +756,7 @@ void tableCompletion()
}
else
{
if (allPoints.Length > 1)
if (countAllPoint > 1)
{
Array.Resize(ref allPoints, countAllPoint);
segments.Add(allPoints);
Expand All @@ -765,7 +771,7 @@ void tableCompletion()
}
}
Array.Resize(ref allPoints, countAllPoint);
if (allPoints.Length > 1)
if (countAllPoint > 1)
{
segments.Add(allPoints);
}
Expand Down

0 comments on commit 70e58e4

Please sign in to comment.