DataView.IsInstance

Prototypes

static boolean IsInstance( DataView view )

Return Value

If view is an object of the DataView-derived class from which the method IsInstance was called, the return value is true. Otherwise, the return value is false.

Parameters

DataView view
An object of a DataView-derived class.

Remarks

Use this method to determine whether an object is an instance of a particular DataView-derived class. The class from which this method is called determines how the method responds. If you call Histogram.IsInstance for a Histogram object, the method returns true. If you call Plot2D.IsInstance for a Histogram object, the method returns true. However, if you call ScatterPlot.IsInstance for a Histogram object, the method returns false.

Example
x = normal( j(100,1,12345) );
declare Histogram plot1;
plot1 = Histogram.Create( "Histogram", x );
plot1.ShowDensity();
plot1.AppendActionMenuItem( "Overlay Normal Curve",
    "run OverlayNormalCurve();" );

declare BoxPlot plot2;
plot2 = BoxPlot.Create( "BoxPlot", x );
plot2.AppendActionMenuItem( "Overlay Normal Curve",
    "run OverlayNormalCurve();" );

start OverlayNormalCurve();
    /* create data for standard normal curve */
    x = T( do(-3,3,0.1) );
    twoPI = 8*atan(1);
    y = exp( -x#x/2 ) / sqrt( twoPI );

    declare Plot2D plot;
    plot = DataView.GetInitiator();

    /* add curve depnding on plot class */
    if Histogram.IsInstance(plot) then do;
        plot.DrawUseDataCoordinates();
        plot.DrawLine( x, y );
        end;
    else if BoxPlot.IsInstance(plot) then do;
        plot.GetAxisViewRange( YAXIS, ymin, ymax );
        plot.DrawUseNormalizedCoordinates( 0, 3, ymin, ymax );
        plot.DrawLine( y, x );
        end;
finish;
/* Press F11 in each plot window and select the menu item. */
See Also

DataView.AppendActionMenuItem
DataView.GetInitiator
DataView.IsEquivalent