Custom Markers: Half filled circles

Here is the code to create a custom marker hook function that makes half-filled circles. I used the example provided in the help

Function CirclesMarkerProc(s)
    STRUCT WMMarkerHookStruct &s
    if( s.marker > 3 )
            return 0
    endif
 
    Variable size= s.size-s.penThick/2
 
    if( s.opaque )
        SetDrawEnv linethick=0,fillpat=-1
        DrawRect s.x-size,s.y-size,s.x+size,s.y+size
        SetDrawEnv linethick=s.penThick
    endif
 
    switch(s.marker)
    case 0:             // Up
        SetDrawEnv linethick=s.penThick, fillpat=1,fillfgc= (s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue), linefgc=(s.penRGB.red,s.penRGB.green,s.penRGB.blue)
        DrawOval s.x-size,s.y-size,s.x+size,s.y+size
        SetDrawEnv fillfgc= (65535,65535,65535),linefgc=(s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue)
        DrawArc s.x,s.y,size-s.penThick,0,180
        Break
    case 1:         //Right
        SetDrawEnv linethick=s.penThick, fillpat=1,fillfgc= (s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue), linefgc=(s.penRGB.red,s.penRGB.green,s.penRGB.blue)
        DrawOval s.x-size,s.y-size,s.x+size,s.y+size
        SetDrawEnv fillfgc= (65535,65535,65535),linefgc=(s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue)
        DrawArc s.x,s.y,size-s.penThick,-90,90
        Break
    case 2:             // Bottom
        SetDrawEnv linethick=s.penThick, fillpat=1,fillfgc= (s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue), linefgc=(s.penRGB.red,s.penRGB.green,s.penRGB.blue)
        DrawOval s.x-size,s.y-size,s.x+size,s.y+size
        SetDrawEnv fillfgc= (65535,65535,65535),linefgc=(s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue)
        DrawArc s.x,s.y,size-s.penThick,180,0
        Break
    case 3:         //left
        SetDrawEnv linethick=s.penThick, fillpat=1,fillfgc= (s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue), linefgc=(s.penRGB.red,s.penRGB.green,s.penRGB.blue)
        DrawOval s.x-size,s.y-size,s.x+size,s.y+size
        SetDrawEnv fillfgc= (65535,65535,65535),linefgc=(s.mrkRGB.red,s.mrkRGB.green,s.mrkRGB.blue)
        DrawArc s.x,s.y,size-s.penThick,90,-90
        Break
    endswitch
    return 1
End


The graph procedure is exactly the same as the one provided in the Advanced topics section

Window Graph1() : Graph
    PauseUpdate; Silent 1       // building window...
    Make/O/N=10 testw=sin(x)
    Display /W=(35,44,430,252) testw,testw,testw,testw
    ModifyGraph offset(testw#1)={0,-0.2},offset(testw#2)={0,-0.4},offset(testw#3)={0,-0.6}
    ModifyGraph mode=3,marker(testw)=100,marker(testw#1)=101,marker(testw#2)=102,marker(testw#3)=103
    SetWindow kwTopWin,markerHook={CirclesMarkerProc,100,103}
EndMacro


Forum

Support

Gallery

Igor Pro 9

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More