none
Spline Computation in Chart RRS feed

  • Question

  • Hello everyone,

    I am having a problem using the chart control. I want to allow the user to change the chart type, which works fine, except when I switch to Spline. Because there's a lot of data points in the series, the computation of the spline takes some time. During this time the application freezes and I don't know what I can do about it. I can't update the Chart in a different thread, because that would cause a cross threading error, right? Is there any way to access this spline computation process and put it into another thread or something? Or at least some workaround to show the waitcursor until the chart is updated?

    Thanks in advance
    Saturday, December 24, 2016 12:27 AM

All replies

  • Hi Thomas_Fr,

    >> I can't update the Chart in a different thread, because that would cause a cross threading error, right?

    Why you cannot update in a different thread? Based on your scenario, I wonder if you are developing a winfrom project or other desktop project. You are trying to modify the UI (main thread) via another thread. So you will meet this error.

    The answer is simply to use delegates to invoke methods that use cross-thread operations. Delegates are an elegant way to call methods that are from other threads.

    Here is a good thread, you can refer to Cross-thread operation not valid: Control 'textBox1' accessed from a thread other than the thread it was created on [duplicate]

    Best regards,

    Kristin


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, December 26, 2016 2:27 AM