Results 1 to 3 of 3

Thread: Heatmap refresh problem

  1. #1
    Junior Member
    Join Date
    Sep 2010

    Heatmap refresh problem


    I need to write a code in C# where the IMSL heatmap should be refreshed every 1 second.

    I successfully create a heatmap using:

    Heatmap heatmap2 = new Heatmap(axis, xmin, xmax, ymin, ymax, zmin, zmax, data, cm);

    where data is a matrix of numbers, but when I change data after one second, the heatmap does not refresh itself.

    I also tried to use:


    each second and than create a new heatmap, but it doesn't work eather.

    All new ideas are welcome. Thank you.


  2. #2
    Senior Member ed's Avatar
    Join Date
    Aug 2005
    The Remove() method is the correct thing to be looking at, but there are a few gotchas in this case.

    First, you may actually need to remove the axis that is the Heatmap's parent. If you just remove the heatmap, the axis will stay and get overdrawn. If the limits are the same with the new data, there's a subtle over-draw issue that could make the text look fuzzy. If the limits change, things will get very messy quickly.

    Next, you will need to call Refresh() on the form to get any changes to update in the GUI. Your Remove might actually be working, but not displaying, if there's no Refresh done.

    Finally, be aware of the scope. If you'll be doing things in a callback separate from a method that initializes/creates the chart you want the axis/heatmap object to have a larger scope so that you're reusing the same object each time.

    For example, in a test case I wrote where a button click updates data in the heatmap, the key pieces are:
    private void button1_Click(object sender, EventArgs e)
        if (axis != null) axis.Remove();
        /* new random color data created in here */
        axis = new AxisXY(chart);
        Heatmap heatmap = new Heatmap(axis, xmin, xmax, ymin, ymax, color);

    The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.

  3. #3
    Junior Member
    Join Date
    Sep 2010
    Thank you Ed,

    Your advice helped me a lot.
    I removed all I had in mind: axis, labels, heatmap, and important - chart.
    Then adding new ones really worked.

    Thanks again.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts