Как я утопил гистограмму из этих данных
у меня есть данные из диаграмм serial port.contais в виде точек, таких как bleow
WBC graph Scale(fl): 400 Channels: 256 WMarker1: 11 WMarker2 40 WMarker3: 70 Points: 0 0 0 0 0 0 0 0 0 0 0 5 7 9 12 17 22 29 37 48 61 78 97 119 141 163 183 200 216 229 239 248 253 254 252 247 237 225 211 197 182 168 154 142 131 119 108 97 87 77 69 62 57 52 47 43 39 36 32 30 29 28 27 27 26 26 26 26 25 25 25 25 25 26 26 27 27 28 28 29 30 30 31 32 34 35 37 38 39 40 41 41 42 43 45 46 46 47 46 45 44 43 42 41 41 40 40 40 41 42 44 45 47 47 48 48 47 46 45 44 43 42 41 40 39 39 39 39 39 38 37 37 36 36 35 35 34 34 34 34 34 34 33 32 31 29 28 27 25 24 23 22 21 21 21 21 21 21 21 20 20 19 18 18 17 16 16 15 15 14 14 13 12 11 10 9 9 9 9 9 9 8 7 7 6 6 6 6 6 5 5 5 5 5 5 5 5 5 4 4 3 3 3 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 What I have tried: i tried to convert it to listbox items and passiing them to y axis but it wasnt giviing me the expected graph.below is my code <pre> Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click BaiscPlotSettings("WBCs") 'invoke basic plot settings 'Dim y As Double 'dependent variabe 'Dim x As Double = 0 'initialize value of x 'Dim noOfPts As Integer = 256 'number of data points in data 'For i As Double = 0 To noOfPts ' y = x * x ' function to plot ' Chart1.Series("WBCs").Points.AddXY(x, y) ' x += 1 'Next Dim st As String = "4 8 13 21 29 37 44 48 50 49 48 44 41 37 33 29 24 21 18 16 13 12 10 8 7 6 5 5 4 4 4 3 3 3 2 2 2 2 2 2 2 2 2 2 3 4 4 4 5 5 6 7 9 11 12 15 19 22 27 31 36 41 47 53 60 67 76 85 94 104 115 126 137 149 162 174 185 196 206 216 225 233 241 246 250 252 253 254 254 254 253 250 245 239 231 223 214 206 199 191 182 173 164 155 146 138 131 123 116 108 102 95 90 84 79 74 69 65 61 58 55 52 48 45 43 40 38 37 36 34 33 32 31 30 30 29 28 27 26 26 24 24 23 22 22 21 20 20 20 20 19 19 18 17 15 14 13 12 12 11 11 11 11 11 11 11 10 10 9 9 8 8 7 7 7 6 6 6 6 5 5 4 4 4 4 3 3 3 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0" For i As Integer = 0 To st.Length - 1 st = st.Replace(" ", vbCrLf) Next ComReadWrite.ReadBox.Text = st ListBox1.Items.AddRange(ComReadWrite.ReadBox.Lines) For itm As Integer = 0 To ListBox1.Items.Count - 1 Chart1.Series(0).Points.AddY(itm) Next End Sub
Private Sub BaiscPlotSettings(ChartLegend As String) Chart1.Titles.Add("") ' specify chart name Chart1.ChartAreas.Clear() Chart1.ChartAreas.Add("Default") With Chart1.ChartAreas("Default") .AxisX.Title = "fl" ' x label .AxisY.Title = "" .AxisY.MajorGrid.Enabled = False .AxisX.MajorGrid.Enabled = False .AxisX.ScaleView.Size = 300 .AxisY.ScaleView.Size = 300 .AxisX.Interval = 100 .AxisY.Enabled = DataVisualization.Charting.AxisEnabled.False ' .AxisX.LabelStyle.Interval = 400/4 End With 'specify series plot lines Chart1.Series.Clear() Chart1.Series.Add(ChartLegend) Chart1.Series(ChartLegend).Color = Color.Red Chart1.Series(ChartLegend).ChartType = DataVisualization.Charting.SeriesChartType.Area End Sub
Gerry Schmitz
Вам нужно будет немного более четко понимать, что происходит "вдоль оси x" и то же самое для оси Y. Любая диаграмма имеет по крайней мере "2 измерения".