IMSL C# Programmer’s Guide
2D Drawing Elements >> Tool Tips  Previous Page  Contents  Next Page

Tool Tips

Windows Forms supports tool tips, small help boxes that pop up when the mouse hovers over some element. The ToolTip node allows tool tips to be associated with chart elements. The text displayed in the tool tip is the Title attribute of the ToolTip’s parent node.

Example

In this example two Data nodes are created. Each Data node has a Title defined and a ToolTip node added as a child. Note that the ToolTip node just has to be created, no methods using it are normally required.

(Download Code)
using Imsl.Chart2D;
using System.Drawing;

public class SampleToolTip : FrameChart {

    public SampleToolTip() {
        Chart chart = this.Chart;
        AxisXY axis = new AxisXY(chart);

        double[] y1 = new double[] {4, 6, 2, 1, 8};
        Data data1 = new Data(axis,  y1);
        data1.DataType = Data.DATA_TYPE_MARKER;
        data1.MarkerColor = Color.Red;
        data1.MarkerType = Data.MARKER_TYPE_FILLED_CIRCLE;
        data1.SetTitle(“Set A”);
        new ToolTip(data1);

        double[] y2 = new double[] {7, 3, 4, 5, 2};
        Data data2 = new Data(axis,  y2);
        data2.DataType = Data.DATA_TYPE_MARKER;
        data2.MarkerColor = Color.Blue;
        data2.MarkerType = Data.MARKER_TYPE_FILLED_SQUARE;
        data2.SetTitle(“Set B”);
        new ToolTip(data2);
    }

    public static void Main(string[] argv) {
        System.Windows.Forms.Application.Run(new SampleToolTip());
    }
}



©  Visual Numerics, Inc.  All rights reserved.  Previous Page  Contents  Next Page