删除线图切片的命令

the command to delete a slice of a line plot

在帮助文档中搜索,没有找到。

类似于:LinePlotImageDisplayDeleteSlices(LinePlotImageDisplay lpid)

Delete.LinePlotImageDisplayGetSlice ?

谢谢,

you are seeking

Boolean ImageDisplayDeleteSliceWithId( ImageDisplay id, ScriptObject slice_id )

used in combination with

ScriptObject ImageDisplayGetSliceIdByIndex( ImageDisplay id, Number slice_index )

从 GMS 3.3 的 F1 帮助文档中复制的示例:

image CreateRandomSpectrum( number sx )
{
 image img := RealImage( "Spectrum", 4, sx )
 number fac =  Random() * 3
 number off =  Random() * 10
 number mag =  Random() * 3
 img = mag * sin( ( off + fac * icol / iwidth ) * Pi() )
 return img
}   

imageDisplay CreateAndShowMultiSlice( number nSlice, number sx )
{
 image firstImg := CreateRandomSpectrum(100)
 firstImg.ShowImage()
 imageDisplay disp = firstImg.ImageGetImageDisplay(0)
 for( number i = 1; i<nSlice; i++ )
         disp.ImageDisplayAddImage( CreateRandomSpectrum(100), "" )

 disp.LinePlotImageDisplaySetLegendShown( 1 )
 return disp
}

void DemoRemoveSlice()
{
 imageDisplay disp = CreateAndShowMultiSlice(5,100)
 OKDialog( "Now remove 2nd slice" )
 object id = disp.ImageDisplayGetSliceIDByIndex( 2 )
 disp.ImageDisplayDeleteSliceWithId( id )
}

DemoRemoveSlice()