Пример #1
0
	def align(self, interval, stepSize):
		print("plouf align")
		intv = self.log10(interval)

		x1 = QwtScaleArithmetic.floorEps(intv.minValue(), stepSize)
		x2 = QwtScaleArithmetic.ceilEps(intv.maxValue(), stepSize)

		return self.pow10(QwtDoubleInterval(x1, x2))
Пример #2
0
    def buildMinorTicks(self, majorTicks, maxMinSteps, stepSize):
        if stepSize < 1.1:  # major step width is one decade
            if maxMinSteps < 1:
                return QwtValueList()

            if maxMinSteps >= 8:
                k0 = 2
                kmax = 9
                kstep = 1
            elif maxMinSteps >= 4:
                k0 = 2
                kmax = 8
                kstep = 2
            elif maxMinSteps >= 2:
                k0 = 2
                kmax = 5
                kstep = 3
            else:
                k0 = 5
                kmax = 5
                kstep = 1

            minorTicks = []

            for i in range(0, len(majorTicks)):
                v = majorTicks[i]
                for k in range(k0, kmax, kstep):
                    minorTicks += [v * float(k)]

            return minorTicks

        else:  # major step > one decade
            minStep = self.divideInterval(stepSize, maxMinSteps)
            if minStep == 0.:
                return QwtValueList()

            minStep = max(minStep, 1.)

            # subticks per interval
            nMin = round(stepSize / minStep) - 1

            # Do the minor steps fit into the interval?
            if QwtScaleArithmetic.compareEps(
                (nMin + 1) * minStep, qwtAbs(stepSize), stepSize) > 0:
                nMin = 0

            if nMin < 1:
                return QwtValueList()  # no subticks

            # substep factor = 10^substeps
            minFactor = qwtMax(pow(10.0, minStep), 10.0)

            minorTicks = []
            for i in range(0, majorTicks.count()):
                val = majorTicks[i]
                for k in range(0, nMin):
                    val *= minFactor
                    minorTicks += [val]

            return minorTicks
Пример #3
0
	def buildMinorTicks(self, majorTicks, maxMinSteps, stepSize):
		if stepSize < 1.1: # major step width is one decade
			if maxMinSteps < 1:
				return QwtValueList()

			if maxMinSteps >= 8:
				k0 = 2
				kmax = 9
				kstep = 1
			elif maxMinSteps >= 4:
				k0 = 2
				kmax = 8
				kstep = 2
			elif maxMinSteps >= 2:
				k0 = 2
				kmax = 5
				kstep = 3
			else:
				k0 = 5
				kmax = 5
				kstep = 1

			minorTicks = []

			for i in range(0, len(majorTicks)):
				v = majorTicks[i]
				for k in range(k0, kmax, kstep):
					minorTicks += [v * float(k)]

			return minorTicks

		else: # major step > one decade
			minStep = self.divideInterval(stepSize, maxMinSteps)
			if minStep == 0.:
				return QwtValueList()

			minStep = max(minStep, 1.)

			# subticks per interval
			nMin = round(stepSize / minStep) - 1

			# Do the minor steps fit into the interval?
			if QwtScaleArithmetic.compareEps((nMin +  1) * minStep, qwtAbs(stepSize), stepSize) > 0:
				nMin = 0

			if nMin < 1:
				return QwtValueList() # no subticks

			# substep factor = 10^substeps
			minFactor = qwtMax(pow(10.0, minStep), 10.0)

			minorTicks = []
			for i in range(0, majorTicks.count()):
				val = majorTicks[i]
				for k in range(0, nMin):
					val *= minFactor
					minorTicks += [val]

			return minorTicks