Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27400

Updating a charts points during runtime

$
0
0
Hi guys,

Big thanks to everyone who has helped me over the past couple of weeks.

I am currently creating a line graph in one form using an array that I have stored in a module, the array is configured in another form. As a value is added to the array I would like the graph to recognize this and plot the new point.

To make this clearer, on a click event a number is stored in the array, that array is then used by the chart. The chart then plots the new point in front of the user.
Below is my code and in bold is how I am using my array with the chart.


Code:

        With RChart.ChartAreas(0)
            .AxisX.Minimum = 1

            .AxisX.Maximum = 10

            .AxisY.Minimum = 0

            .AxisY.Maximum = 30

            .AxisY.Interval = 10

            .AxisX.Title = "Samples"

            .AxisY.Title = "Range"

        End With

        RChart.Series("Range").MarkerStyle = MarkerStyle.Circle
        RChart.Series("Range").MarkerColor = Color.Black
        RChart.Series("Range").MarkerSize = 5
        RChart.Series("Range").ChartType = DataVisualization.Charting.SeriesChartType.Line
      RChart.Series("Range").Points.DataBindXY(pNumofSamples, pRange2)

So far I have tried:

Looping through the above code until the form is closed with application.doEvents() - this didn't work.
Calling a procedure that did the same as above, Setting a timer to iterate through the above code. For these I get the error "Enumeration already finished." Pointing to ----> RChart.Series("Range").Points.DataBindXY(pNumofSamples, pRange2)

I have also tried multi-threading, using Me.CheckForIllegalCrossThreadCalls = False.. This also failed. I have had a search across the forum and can't seem to find a solution. I have read a bit about delegates and this could be a possible solution, however I'm wondering if anyone knows where I am going wrong or a way to solve my problem?

Again, appreciate the help.

Cheers.

Viewing all articles
Browse latest Browse all 27400


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>