my program is solves some statistics and displayng charts
there is no problem in the Calulating process
but when i try to save the main 3 listboxes in .txt file and loading it again all the process and results is going correctly except the second chart that has Stepline Paints
correctly but the x Axes in different scaling
and other two crossing line paints according to points in the Stepline paints in the past step they should where on the Step line
I will leave the images and the Code talk
this is the program before saving
Attachment 97453
this is the program after loading the listboxes from the .txt file
Attachment 97455
This is the code for the open button
Dim strFileName As String
With OpenFileDialog1
.Filter = "Text Files (*.txt)|*.txt"
.Title = "Open Table"
End With
If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
ClearAll()
strFileName = OpenFileDialog1.FileName
Dim myreader As New StreamReader(strFileName)
Dim line As String
line = myreader.ReadLine()
Do Until line = "*" ' This is seperator between listboxes
' This list will represent the X axes in the Corrupted Chart
lstFrom.Items.Add(line)
line = myreader.ReadLine()
Loop
Do Until line = "**" ' Another seperator
lstTo.Items.Add(line)
line = myreader.ReadLine()
Loop
Do Until line = "" ' the end
lstF.Items.Add(line)
line = myreader.ReadLine()
Loop
myreader.Close()
'That removes the "*" & "**" Seperators
lstTo.Items.Remove(lstTo.Items(0))
lstF.Items.Remove(lstF.Items(0))
'This is the method that does all calculating and displaying charts process
AllWork()
End If
This is All that code that redraws the Chart that corrupts
from AllWork() method
this is setting lstVariableFrequency List that represent the y axes in the corrupted chart
For i = 0 To lstFrom.Items.Count - 1
lstL.Items.Add(lstTo.Items(i) - lstFrom.Items(i))
lstVariableFrequency.Items.Add(lstF.Items(i) / lstL.Items(i))
Next
This is the code that Draws the chart
For i = 0 To lstVariableFrequency.Items.Count - 1
If lstVariableFrequency.Items(i) = dblHighestVariableFrequency Then
dblF1 = lstVariableFrequency.Items(i - 1)
dblF2 = lstVariableFrequency.Items(i + 1)
dblClassBoundry2 = lstTo.Items(i) - lstFrom.Items(i)
dblVersusF = lstFrom.Items(i)
' This is the Stepline
Chart2.Series(0).Points.AddXY(lstFrom.Items(i - 1), lstVariableFrequency.Items(i - 1))
Chart2.Series(0).Points.AddXY(lstFrom.Items(i), lstVariableFrequency.Items(i))
Chart2.Series(0).Points.AddXY(lstFrom.Items(i + 1), lstVariableFrequency.Items(i + 1))
'This is the first line
Chart2.Series(1).Points.AddXY(lstFrom.Items(i), lstVariableFrequency.Items(i - 1))
Chart2.Series(1).Points.AddXY(lstFrom.Items(i + 1), lstVariableFrequency.Items(i))
'This is the second line
Chart2.Series(2).Points.AddXY(lstFrom.Items(i), lstVariableFrequency.Items(i))
Chart2.Series(2).Points.AddXY(lstFrom.Items(i + 1), lstVariableFrequency.Items(i + 1))
dblMode = dblVersusF + (dblF2 / (dblF1 + dblF2)) * dblClassBoundry2
Exit For
End If
Next
the program Calulating the insection point in the two crossing lines but that include calculating the Slope and that drops Overflow exception after Reloading the chart
this is the first line slope calculting that Droping the Error
firstLineSlope = Math.Round((Chart2.Series(1).Points(0).YValues(0) - Chart2.Series(1).Points(1).YValues(0)) / (Chart2.Series(1).Points(0).XValue - Chart2.Series(1).Points(1).XValue), 2)
I hope that was clear, and i'm very grateful for any help
there is no problem in the Calulating process
but when i try to save the main 3 listboxes in .txt file and loading it again all the process and results is going correctly except the second chart that has Stepline Paints
correctly but the x Axes in different scaling
and other two crossing line paints according to points in the Stepline paints in the past step they should where on the Step line
I will leave the images and the Code talk
this is the program before saving
Attachment 97453
this is the program after loading the listboxes from the .txt file
Attachment 97455
This is the code for the open button
Dim strFileName As String
With OpenFileDialog1
.Filter = "Text Files (*.txt)|*.txt"
.Title = "Open Table"
End With
If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
ClearAll()
strFileName = OpenFileDialog1.FileName
Dim myreader As New StreamReader(strFileName)
Dim line As String
line = myreader.ReadLine()
Do Until line = "*" ' This is seperator between listboxes
' This list will represent the X axes in the Corrupted Chart
lstFrom.Items.Add(line)
line = myreader.ReadLine()
Loop
Do Until line = "**" ' Another seperator
lstTo.Items.Add(line)
line = myreader.ReadLine()
Loop
Do Until line = "" ' the end
lstF.Items.Add(line)
line = myreader.ReadLine()
Loop
myreader.Close()
'That removes the "*" & "**" Seperators
lstTo.Items.Remove(lstTo.Items(0))
lstF.Items.Remove(lstF.Items(0))
'This is the method that does all calculating and displaying charts process
AllWork()
End If
This is All that code that redraws the Chart that corrupts
from AllWork() method
this is setting lstVariableFrequency List that represent the y axes in the corrupted chart
For i = 0 To lstFrom.Items.Count - 1
lstL.Items.Add(lstTo.Items(i) - lstFrom.Items(i))
lstVariableFrequency.Items.Add(lstF.Items(i) / lstL.Items(i))
Next
This is the code that Draws the chart
For i = 0 To lstVariableFrequency.Items.Count - 1
If lstVariableFrequency.Items(i) = dblHighestVariableFrequency Then
dblF1 = lstVariableFrequency.Items(i - 1)
dblF2 = lstVariableFrequency.Items(i + 1)
dblClassBoundry2 = lstTo.Items(i) - lstFrom.Items(i)
dblVersusF = lstFrom.Items(i)
' This is the Stepline
Chart2.Series(0).Points.AddXY(lstFrom.Items(i - 1), lstVariableFrequency.Items(i - 1))
Chart2.Series(0).Points.AddXY(lstFrom.Items(i), lstVariableFrequency.Items(i))
Chart2.Series(0).Points.AddXY(lstFrom.Items(i + 1), lstVariableFrequency.Items(i + 1))
'This is the first line
Chart2.Series(1).Points.AddXY(lstFrom.Items(i), lstVariableFrequency.Items(i - 1))
Chart2.Series(1).Points.AddXY(lstFrom.Items(i + 1), lstVariableFrequency.Items(i))
'This is the second line
Chart2.Series(2).Points.AddXY(lstFrom.Items(i), lstVariableFrequency.Items(i))
Chart2.Series(2).Points.AddXY(lstFrom.Items(i + 1), lstVariableFrequency.Items(i + 1))
dblMode = dblVersusF + (dblF2 / (dblF1 + dblF2)) * dblClassBoundry2
Exit For
End If
Next
the program Calulating the insection point in the two crossing lines but that include calculating the Slope and that drops Overflow exception after Reloading the chart
this is the first line slope calculting that Droping the Error
firstLineSlope = Math.Round((Chart2.Series(1).Points(0).YValues(0) - Chart2.Series(1).Points(1).YValues(0)) / (Chart2.Series(1).Points(0).XValue - Chart2.Series(1).Points(1).XValue), 2)
I hope that was clear, and i'm very grateful for any help