Name

datatipInitStruct — initialize the datatip structure associated with the given polyline.

Calling Sequence

ok=datatipInitStruct(curve_handle,varargin)

Parameters

curve_handle

A handle on an entity compatible with datatips

varargin

A sequence of pairs (<field name>,<field value>) used to add or customize fields of the datatips data structure.

Description

This function is called by datatipCreateto create a data structure for tips stored in the polyline entity user_data field.

This function as to be called only is one want to customize the datatips data structure fields

Datatip data structure

The datatips data structure is a tlist of type "datatips" with at least the following fields.

interpolate

A boolean, indicating if the tips position can be interpolated between mesh points or not.

replace

A boolean, indicating if adding a new tip erases the others or not

formatfunction

A Scilab function, the function which is called to format the text that appears in the datatips. It as the following calling sequence: str=datatipDefaultDisplay(curve_handle,pt,index) where curve_handle is handle on the polyline or surface, pt is the coordinates of the point and index is the index of the point in the data or is empty in case of interpolated mode.

tips

An array of handles. Each of these points to a given tip on the curve.

Others fields can be added by the programmer to the datatips data structure throught the datatipInitStruct varargin optional arguments.

See Also

datatipCreate , datatips

Examples

    t=linspace(0,10,1000);
    clf();
    plot(t.*sin(t),t.*cos(t),1.5*t.*sin(t),1.5*t.*cos(1.5*t));
    e=gce();
    p1=e.children(1);//get the handle on the polyline
    p2=e.children(2);//get the handle on the polyline


    function str=mytipfmt(curve,pt,index)
      ds=datatipGetStruct(curve)
      if index<>[] then
        t=ds.param(index);
      else //interpolated
        [d,ptp,i,c]=orthProj(curve.data,pt);
        t=ds.param(i)+(ds.param(i+1)-ds.param(i))*c;
      end
      str=msprintf("%s\nt=%-0.3g",ds.name,t);
    endfunction

    ok=datatipInitStruct(p1,"formatfunction","mytipfmt","param",t,"name","spiral");
    ok=datatipInitStruct(p2,"formatfunction","mytipfmt","param",t,"name","curve");

    datatipCreate(p1,500);
    datatipCreate(p1,900);
    datatipCreate(p2,750);

    

Authors

Serge Steer, INRIA