EDN Admin
Well-known member
<span style="font-family:Verdana,sans-serif; font-size:9pt Hi there,
<span style="font-family:Verdana,sans-serif; font-size:9pt I have been programming a little bit in Visual Basic in 2010 but currently I have run into a problem. I am trying to plot data from a loaded file, however, I am trying to give the
user to determine whether they would like a linear graph or a log graph. Since I do not think you can change the chart at runtime, I have been trying to use two charts. If Linear is selected then the data would be plotted on chart 1 in a linear manner. If
Log is selected then it would plot the data on chart2 with a log scale x-axis. However, when I select islogarithmic to true in the chart controls and isstartedfromzero to false, I get an area saying that "Chart Area Axes - A logarithmic scale cannot be used
for this axis". I am not sure why. I have tried setting my own bounds and I have tried log scales with just one graph and it still comes up with the same error. My code works fine if its two linear graphs but if I set one to Logarithmic it errors out. The
error comes when the programs begins, not when the button is pushed and the data I am loading contains no zeroes or negative numbers.
<span style="font-family:Verdana,sans-serif; font-size:9pt
<span style="font-family:Verdana,sans-serif; font-size:9pt Here is my Code though :
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; color:blue; font-size:9.5pt Private<span style="font-family:Consolas; font-size:9.5pt
<span style="color:blue Sub Plot_Button(<span style="color:blue ByVal sender
<span style="color:blue As System.<span style="color:#2b91af Object,
<span style="color:blue ByVal e <span style="color:blue As System.<span style="color:#2b91af EventArgs)
<span style="color:blue Handles Button14.Click
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue Dim z <span style="color:blue As <span style="color:blue
Integer
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue Dim X_axis_array() <span style="color:blue
As <span style="color:blue Double = <span style="color:blue Nothing, Y_axis_array()
<span style="color:blue As <span style="color:blue Double = <span style="color:blue
Nothing
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue Dim Plot_File_Data_Name_Selection <span style="color:blue
As <span style="color:blue String = <span style="color:blue Me.ComboBox8.GetItemText(<span style="color:blue Me.ComboBox8.SelectedItem)<span>
<span style="color:green // Retrieves Selection Made in ComboBox8
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue Dim DtTest <span style="color:blue As
<span style="color:blue New <span style="color:#2b91af DataTable <span style="color:green
//Sets Dtest as a one new table of in-memory data; here so that it is refreshed everytime the Add_Data_Files_For_Plotting_Button is pushed.
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue Dim Plot_Data_File_Name <span style="color:blue
As <span style="color:blue String = <span style="color:blue Nothing
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green // Once a selection is made from ComboBox8, the file is opened and read
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
FileOpen(1, Plot_File_Data_Name_Selection, <span style="color:#2b91af OpenMode.Input)<span>
<span style="color:green //Note that the first parameter assigns a file number, the second parameter specifies the file to open and the third specifies the File Open Mode - ie Input = read mode
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue If TextBox57.Text = <span style="color:#a31515
"Linear" <span style="color:blue Then
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //Start the counter at zero
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span> <span>
z = 0
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //Gets the collection of data that belongs to these tables??
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
DtTest.Columns.Add(<span style="color:#a31515 "X_Array", <span style="color:blue
GetType(<span style="color:blue Double))
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
DtTest.Columns.Add(<span style="color:#a31515 "Y_Array", <span style="color:blue
GetType(<span style="color:blue Double))
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //Redimension Increment
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span> <span style="color:blue Dim dN
<span style="color:blue As <span style="color:blue Integer = 1
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //Now read the line(s) of text from the file until End of File (EOF) is reached
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue Do <span style="color:blue Until EOF(1)
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //The Values are read as a string from the selected file, the string is seperated by using tab in the selected file.
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue Dim dummy_string = LineInput(1).Split(vbTab)
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //Redimensioning the array in particular increments.
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue If (dummy_string.Length = 0) <span style="color:blue
Then
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
EOF(1)
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue ElseIf (z <span style="color:blue Mod dN = 0)
<span style="color:blue Then
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:#2b91af Array.Resize(X_axis_array, z + dN)
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:#2b91af Array.Resize(Y_axis_array, z + dN)
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue End <span style="color:blue If
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //The String in Dummy String is converted to Double and passed to the x and y arrays
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
X_axis_array(z) = <span style="color:blue CDbl(dummy_string(0))
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
Y_axis_array(z) = <span style="color:blue CDbl(dummy_string(1))
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //The x array is plotted as the x-coordinate and the Y array is plotted as the Y-coordinate
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
DtTest.Rows.Add(X_axis_array(z), Y_axis_array(z))
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //Counter is incremented
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
z = z + 1
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue Loop
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //Once the file is read the x and y arrays are redimensioned.
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:#2b91af Array.Resize(X_axis_array, z)
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:#2b91af Array.Resize(Y_axis_array, z)
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
FileClose(1)
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue With Chart1.Series(0)
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
.ChartType = DataVisualization.Charting.<span style="color:#2b91af SeriesChartType.Line
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
.Points.DataBind(DtTest.DefaultView, <span style="color:#a31515 "X_Array",
<span style="color:#a31515 "Y_Array", <span style="color:blue Nothing)
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
.BorderWidth = 2
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue End <span style="color:blue With
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue ElseIf TextBox57.Text = <span style="color:#a31515
"Log" <span style="color:blue Then
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //Start the counter at zero
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
z = 0
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //Gets the collection of data that belongs to these tables??
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
DtTest.Columns.Add(<span style="color:#a31515 "X_Array", <span style="color:blue
GetType(<span style="color:blue Double))
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
DtTest.Columns.Add(<span style="color:#a31515 "Y_Array", <span style="color:blue
GetType(<span style="color:blue Double))
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //Redimension Increment
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue Dim dN <span style="color:blue As <span style="color:blue
Integer = 1
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //Now read the line(s) of text from the file until End of File (EOF) is reached
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue Do <span style="color:blue Until EOF(1)
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //The Values are read as a string from the selected file, the string is seperated by using tab in the selected file.
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue Dim dummy_string = LineInput(1).Split(vbTab)
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //Redimensioning the array in particular increments.
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue If (dummy_string.Length = 0) <span style="color:blue
Then
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
EOF(1)
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue ElseIf (z <span style="color:blue Mod dN = 0)
<span style="color:blue Then
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:#2b91af Array.Resize(X_axis_array, z + dN)
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:#2b91af Array.Resize(Y_axis_array, z + dN)
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue End <span style="color:blue If
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //The String in Dummy String is converted to Double and passed to the x and y arrays
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
X_axis_array(z) = <span style="color:blue CDbl(dummy_string(0))
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
Y_axis_array(z) = <span style="color:blue CDbl(dummy_string(1))
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //The x array is plotted as the x-coordinate and the Y array is plotted as the Y-coordinate
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
DtTest.Rows.Add(X_axis_array(z), Y_axis_array(z))
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //Counter is incremented
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
z = z + 1
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue Loop
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //Once the file is read the x and y arrays are redimensioned.
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:#2b91af Array.Resize(X_axis_array, z)
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:#2b91af Array.Resize(Y_axis_array, z)
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
FileClose(1)
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue With Chart2.Series(0)
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
.ChartType = DataVisualization.Charting.<span style="color:#2b91af SeriesChartType.Line
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
.Points.DataBind(DtTest.DefaultView, <span style="color:#a31515 "X_Array",
<span style="color:#a31515 "Y_Array", <span style="color:blue Nothing)
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
.BorderWidth = 2
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue End <span style="color:blue With
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue Else
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
MsgBox(<span style="color:#a31515 "Plot Type is Invalid")
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
FileClose()
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue Exit Sub
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue End <span style="color:blue If
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue End <span style="color:blue Sub
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span style="color:blue
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span style="color:blue Thanks!
View the full article
<span style="font-family:Verdana,sans-serif; font-size:9pt I have been programming a little bit in Visual Basic in 2010 but currently I have run into a problem. I am trying to plot data from a loaded file, however, I am trying to give the
user to determine whether they would like a linear graph or a log graph. Since I do not think you can change the chart at runtime, I have been trying to use two charts. If Linear is selected then the data would be plotted on chart 1 in a linear manner. If
Log is selected then it would plot the data on chart2 with a log scale x-axis. However, when I select islogarithmic to true in the chart controls and isstartedfromzero to false, I get an area saying that "Chart Area Axes - A logarithmic scale cannot be used
for this axis". I am not sure why. I have tried setting my own bounds and I have tried log scales with just one graph and it still comes up with the same error. My code works fine if its two linear graphs but if I set one to Logarithmic it errors out. The
error comes when the programs begins, not when the button is pushed and the data I am loading contains no zeroes or negative numbers.
<span style="font-family:Verdana,sans-serif; font-size:9pt
<span style="font-family:Verdana,sans-serif; font-size:9pt Here is my Code though :
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; color:blue; font-size:9.5pt Private<span style="font-family:Consolas; font-size:9.5pt
<span style="color:blue Sub Plot_Button(<span style="color:blue ByVal sender
<span style="color:blue As System.<span style="color:#2b91af Object,
<span style="color:blue ByVal e <span style="color:blue As System.<span style="color:#2b91af EventArgs)
<span style="color:blue Handles Button14.Click
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue Dim z <span style="color:blue As <span style="color:blue
Integer
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue Dim X_axis_array() <span style="color:blue
As <span style="color:blue Double = <span style="color:blue Nothing, Y_axis_array()
<span style="color:blue As <span style="color:blue Double = <span style="color:blue
Nothing
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue Dim Plot_File_Data_Name_Selection <span style="color:blue
As <span style="color:blue String = <span style="color:blue Me.ComboBox8.GetItemText(<span style="color:blue Me.ComboBox8.SelectedItem)<span>
<span style="color:green // Retrieves Selection Made in ComboBox8
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue Dim DtTest <span style="color:blue As
<span style="color:blue New <span style="color:#2b91af DataTable <span style="color:green
//Sets Dtest as a one new table of in-memory data; here so that it is refreshed everytime the Add_Data_Files_For_Plotting_Button is pushed.
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue Dim Plot_Data_File_Name <span style="color:blue
As <span style="color:blue String = <span style="color:blue Nothing
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green // Once a selection is made from ComboBox8, the file is opened and read
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
FileOpen(1, Plot_File_Data_Name_Selection, <span style="color:#2b91af OpenMode.Input)<span>
<span style="color:green //Note that the first parameter assigns a file number, the second parameter specifies the file to open and the third specifies the File Open Mode - ie Input = read mode
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue If TextBox57.Text = <span style="color:#a31515
"Linear" <span style="color:blue Then
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //Start the counter at zero
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span> <span>
z = 0
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //Gets the collection of data that belongs to these tables??
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
DtTest.Columns.Add(<span style="color:#a31515 "X_Array", <span style="color:blue
GetType(<span style="color:blue Double))
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
DtTest.Columns.Add(<span style="color:#a31515 "Y_Array", <span style="color:blue
GetType(<span style="color:blue Double))
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //Redimension Increment
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span> <span style="color:blue Dim dN
<span style="color:blue As <span style="color:blue Integer = 1
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //Now read the line(s) of text from the file until End of File (EOF) is reached
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue Do <span style="color:blue Until EOF(1)
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //The Values are read as a string from the selected file, the string is seperated by using tab in the selected file.
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue Dim dummy_string = LineInput(1).Split(vbTab)
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //Redimensioning the array in particular increments.
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue If (dummy_string.Length = 0) <span style="color:blue
Then
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
EOF(1)
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue ElseIf (z <span style="color:blue Mod dN = 0)
<span style="color:blue Then
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:#2b91af Array.Resize(X_axis_array, z + dN)
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:#2b91af Array.Resize(Y_axis_array, z + dN)
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue End <span style="color:blue If
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //The String in Dummy String is converted to Double and passed to the x and y arrays
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
X_axis_array(z) = <span style="color:blue CDbl(dummy_string(0))
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
Y_axis_array(z) = <span style="color:blue CDbl(dummy_string(1))
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //The x array is plotted as the x-coordinate and the Y array is plotted as the Y-coordinate
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
DtTest.Rows.Add(X_axis_array(z), Y_axis_array(z))
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //Counter is incremented
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
z = z + 1
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue Loop
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //Once the file is read the x and y arrays are redimensioned.
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:#2b91af Array.Resize(X_axis_array, z)
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:#2b91af Array.Resize(Y_axis_array, z)
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
FileClose(1)
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue With Chart1.Series(0)
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
.ChartType = DataVisualization.Charting.<span style="color:#2b91af SeriesChartType.Line
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
.Points.DataBind(DtTest.DefaultView, <span style="color:#a31515 "X_Array",
<span style="color:#a31515 "Y_Array", <span style="color:blue Nothing)
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
.BorderWidth = 2
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue End <span style="color:blue With
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue ElseIf TextBox57.Text = <span style="color:#a31515
"Log" <span style="color:blue Then
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //Start the counter at zero
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
z = 0
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //Gets the collection of data that belongs to these tables??
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
DtTest.Columns.Add(<span style="color:#a31515 "X_Array", <span style="color:blue
GetType(<span style="color:blue Double))
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
DtTest.Columns.Add(<span style="color:#a31515 "Y_Array", <span style="color:blue
GetType(<span style="color:blue Double))
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //Redimension Increment
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue Dim dN <span style="color:blue As <span style="color:blue
Integer = 1
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //Now read the line(s) of text from the file until End of File (EOF) is reached
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue Do <span style="color:blue Until EOF(1)
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //The Values are read as a string from the selected file, the string is seperated by using tab in the selected file.
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue Dim dummy_string = LineInput(1).Split(vbTab)
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //Redimensioning the array in particular increments.
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue If (dummy_string.Length = 0) <span style="color:blue
Then
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
EOF(1)
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue ElseIf (z <span style="color:blue Mod dN = 0)
<span style="color:blue Then
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:#2b91af Array.Resize(X_axis_array, z + dN)
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:#2b91af Array.Resize(Y_axis_array, z + dN)
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue End <span style="color:blue If
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //The String in Dummy String is converted to Double and passed to the x and y arrays
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
X_axis_array(z) = <span style="color:blue CDbl(dummy_string(0))
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
Y_axis_array(z) = <span style="color:blue CDbl(dummy_string(1))
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //The x array is plotted as the x-coordinate and the Y array is plotted as the Y-coordinate
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
DtTest.Rows.Add(X_axis_array(z), Y_axis_array(z))
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //Counter is incremented
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
z = z + 1
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue Loop
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:green //Once the file is read the x and y arrays are redimensioned.
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:#2b91af Array.Resize(X_axis_array, z)
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:#2b91af Array.Resize(Y_axis_array, z)
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
FileClose(1)
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue With Chart2.Series(0)
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
.ChartType = DataVisualization.Charting.<span style="color:#2b91af SeriesChartType.Line
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
.Points.DataBind(DtTest.DefaultView, <span style="color:#a31515 "X_Array",
<span style="color:#a31515 "Y_Array", <span style="color:blue Nothing)
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
.BorderWidth = 2
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue End <span style="color:blue With
<p style="line-height:normal; margin-bottom:0pt
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue Else
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
MsgBox(<span style="color:#a31515 "Plot Type is Invalid")
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
FileClose()
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue Exit Sub
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue End <span style="color:blue If
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span>
<span style="color:blue End <span style="color:blue Sub
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span style="color:blue
<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Consolas; font-size:9.5pt <span style="color:blue Thanks!
View the full article