Skip to content

lib.plot: Potential code duplication in plotcanvas.PlotCanvas - opportunity for refactoring #516

Open
@dougthor42

Description

@dougthor42

(This issue was created because PR #117 could not be finished in its entirety)

Some code in PlotCanvas._drawAxesValues, PlotCanvas._drawGrid, and PlotCanvas._drawTicks look awfully similar to each other.

This could be a good thing to abstract out into a dedicated function.

The code in question:

if self._xSpec != 'none':
    if self.enableGrid[0]:
        for x, _ in xticks:
            pt = scale_and_shift_point(x, p1[1], scale, shift)
            dc.DrawLine(pt[0], pt[1], pt[0], pt[1] - height)

if self._ySpec != 'none':
    if self.enableGrid[1]:
        for y, label in yticks:
            pt = scale_and_shift_point(p1[0], y, scale, shift)
            dc.DrawLine(pt[0], pt[1], pt[0] + width, pt[1])

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions