aniplot/graph_renderer.py
def _render_grid_hortext(self, w, h, x2, y2, w2, h2, channel, left=False, min_div_hpix=50.):
        """
        render text for the horizontal lines. value legend.
        min_div_hpix : minimum division height (grid line distance) in pixels
        """
        assert  h > 1.
        ch = channel
        if abs(h2) < 0.000001:
            return

        v1 = y2
        v2 = y2 + h2
        # swap begin/end if necessary to make following calculations much more convenient
        if v2 < v1:
            v1, v2 = v2, v1

        volts_per_min_div = (v2 - v1) / (h - 1.) * min_div_hpix
        pixels_per_volt = (h - 1.) / (v2 - v1)
        v_step = math.pow(2, math.ceil(math.log(volts_per_min_div, 2)))
        v_font_height = 1. / pixels_per_volt * self.font.height
        v_begin = math.floor((v1 - v_font_height / 2.) / v_step) * v_step + v_step
        v_end   = v2 + v_font_height / 2.
        v_num   = math.floor((v_end - v_begin) / v_step)

        c = 0.2
        v = v_begin
        while v < v_end:
            px = self._sample_to_pixel(v, y2, h2, h)
            #if ch == self.temperature_channel:
            #    txt = "%.1f%s" % (tempc.convertTemp(ch.value_for_volt(v)), ch.si_unit)
            txt = "%.2f%s" % (v, ch.si_unit)
            if left:
                xcoord = w - self.font.width(txt) - 1
            else:
                xcoord = 1
            self.font.drawtl(txt, xcoord, px - self.font.height / 2., bgcolor = (c, c, c, .8), fgcolor = (1.9, 1.9, 1.9, .8))

            v += v_step

        render text for the horizontal lines. value legend.
        min_div_hpix : minimum division height (grid line distance) in pixels
        
render text for the horizontal lines. value legend.
min_div_hpix : minimum division height (grid line distance) in pixels
render text for the horizontal lines . value legend . min_div_hpix : minimum division height ( grid line distance ) in pixels
def _render_grid_hortext(self, w, h, x2, y2, w2, h2, channel, left=False, min_div_hpix=50.):
        assert  h > 1.
        ch = channel
        if abs(h2) < 0.000001:
            return
        v1 = y2
        v2 = y2 + h2
        if v2 < v1:
            v1, v2 = v2, v1
        volts_per_min_div = (v2 - v1) / (h - 1.) * min_div_hpix
        pixels_per_volt = (h - 1.) / (v2 - v1)
        v_step = math.pow(2, math.ceil(math.log(volts_per_min_div, 2)))
        v_font_height = 1. / pixels_per_volt * self.font.height
        v_begin = math.floor((v1 - v_font_height / 2.) / v_step) * v_step + v_step
        v_end   = v2 + v_font_height / 2.
        v_num   = math.floor((v_end - v_begin) / v_step)
        c = 0.2
        v = v_begin
        while v < v_end:
            px = self._sample_to_pixel(v, y2, h2, h)
            txt = "%.2f%s" % (v, ch.si_unit)
            if left:
                xcoord = w - self.font.width(txt) - 1
            else:
                xcoord = 1
            self.font.drawtl(txt, xcoord, px - self.font.height / 2., bgcolor = (c, c, c, .8), fgcolor = (1.9, 1.9, 1.9, .8))
            v += v_step
def _render_grid_hortext ( self , w , h , x2 , y2 , w2 , h2 , channel , left = False , min_div_hpix = 50. ) : assert h > 1. ch = channel if abs ( h2 ) < 0.000001 : return v1 = y2 v2 = y2 + h2 if v2 < v1 : v1 , v2 = v2 , v1 volts_per_min_div = ( v2 - v1 ) / ( h - 1. ) * min_div_hpix pixels_per_volt = ( h - 1. ) / ( v2 - v1 ) v_step = math . pow ( 2 , math . ceil ( math . log ( volts_per_min_div , 2 ) ) ) v_font_height = 1. / pixels_per_volt * self . font . height v_begin = math . floor ( ( v1 - v_font_height / 2. ) / v_step ) * v_step + v_step v_end = v2 + v_font_height / 2. v_num = math . floor ( ( v_end - v_begin ) / v_step ) c = 0.2 v = v_begin while v < v_end : px = self . _sample_to_pixel ( v , y2 , h2 , h ) txt = "%.2f%s" % ( v , ch . si_unit ) if left : xcoord = w - self . font . width ( txt ) - 1 else : xcoord = 1 self . font . drawtl ( txt , xcoord , px - self . font . height / 2. , bgcolor = ( c , c , c , .8 ) , fgcolor = ( 1.9 , 1.9 , 1.9 , .8 ) ) v += v_step
render text for the horizontal lines.
render text for the horizontal lines .
"""
        render text for the horizontal lines. value legend.
        min_div_hpix : minimum division height (grid line distance) in pixels
        """ # swap begin/end if necessary to make following calculations much more convenient #if ch == self.temperature_channel: #    txt = "%.1f%s" % (tempc.convertTemp(ch.value_for_volt(v)), ch.si_unit)
self
w
h
x2
y2
w2
h2
channel
left
min_div_hpix