Returns the percentage where the given value lies between this rulers
        minimum and maximum values.  If the value equals the minimum, then the
        percent is 0, if it equals the maximum, then the percent is 1 - any
        value between will be a floating point.  If the ruler is a custom type,
        then only if the value matches a notch will be successful.
        
        :param      value | <variant>
        
        :return     <float>

def percentAt( self, value ):
        """
        Returns the percentage where the given value lies between this rulers
        minimum and maximum values.  If the value equals the minimum, then the
        percent is 0, if it equals the maximum, then the percent is 1 - any
        value between will be a floating point.  If the ruler is a custom type,
        then only if the value matches a notch will be successful.
        
        :param      value | <variant>
        
        :return     <float>
        """
        if ( value is None ):
            return 0.0
        
        minim = self.minimum()
        maxim = self.maximum()
        rtype = self.rulerType()
        
        # simple minimum
        if ( value == minim and not self.padStart() ):
            perc = 0.0
        
        # simple maximum
        elif ( value == maxim and not self.padEnd() ):
            perc = 1.0
        
        # calculate a numeric percentage value
        elif ( rtype == XChartRuler.Type.Number ):
            perc  = float(value - minim) / float(maxim - minim)
        
        # calculate a time percentage value
        elif ( rtype in (XChartRuler.Type.Datetime, XChartRuler.Type.Time) ):
            maxsecs = minim.secsTo(maxim)
            valsecs = minim.secsTo(value)
            
            perc    = float(valsecs) / maxsecs
        
        # calculate a date percentage value
        elif ( rtype == XChartRuler.Type.Date ):
            maxdays = minim.daysTo(maxim)
            valdays = minim.daysTo(value)
            
            perc    = float(valdays) / maxdays
        
        # otherwise, compare against the notches
        else:
            perc    = 0.0
            notches = self.notches()
            count   = len(notches)
            count  += self.padStart() + self.padEnd()
            count   = max(1, count - 1)
            
            perc    = float(self.padStart()) / count
            
            for i, notch in enumerate(notches):
                if ( notch == value ):
                    perc += float(i) / count
                    break
        
        # normalize the percentage
        perc    = min(perc, 1.0)
        perc    = max(0, perc)
        
        return perc