How to use the leather.Grid function in leather

To help you get started, we’ve selected a few leather examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wireservice / leather / tests / test_grid.py View on Github external
def test_to_svg_file_handle(self):
        chart1 = leather.Chart()
        chart1.add_dots(self.data1)

        chart2 = leather.Chart()
        chart2.add_dots(self.data2)

        grid = leather.Grid()
        grid.add_many([chart1, chart2, chart1])

        with open('.test.svg', 'w') as f:
            grid.to_svg(f)

        self.assertTrue(os.path.exists(TEST_SVG))
github wireservice / leather / tests / test_grid.py View on Github external
def test_to_svg_file_name(self):
        chart1 = leather.Chart()
        chart1.add_dots(self.data1)

        chart2 = leather.Chart()
        chart2.add_dots(self.data2)

        grid = leather.Grid()
        grid.add_many([chart1, chart2, chart1])

        grid.to_svg('.test.svg')

        self.assertTrue(os.path.exists(TEST_SVG))
github wireservice / leather / tests / test_grid.py View on Github external
def test_add_many(self):
        chart1 = leather.Chart()
        chart1.add_dots(self.data1)

        chart2 = leather.Chart()
        chart2.add_dots(self.data2)

        grid = leather.Grid()
        grid.add_many([chart1, chart2, chart1])

        svg = self.render_chart(grid)

        self.assertElementCount(svg, '.axis', 6)
        self.assertElementCount(svg, '.series', 3)
        self.assertElementCount(svg, '.dots', 3)
        self.assertElementCount(svg, 'circle', 13)
github wireservice / leather / tests / test_grid.py View on Github external
def test_add_one(self):
        chart1 = leather.Chart()
        chart1.add_dots(self.data1)

        chart2 = leather.Chart()
        chart2.add_dots(self.data2)

        grid = leather.Grid()
        grid.add_one(chart1)
        grid.add_one(chart2)

        svg = self.render_chart(grid)

        self.assertElementCount(svg, '.axis', 4)
        self.assertElementCount(svg, '.series', 2)
        self.assertElementCount(svg, '.dots', 2)
        self.assertElementCount(svg, 'circle', 9)
github wireservice / leather / examples / grid.py View on Github external
]

data2 = [
    (3, 4),
    (5, 6),
    (7, 10),
    (8, 2)
]

chart1 = leather.Chart('Dots')
chart1.add_dots(data1)

chart2 = leather.Chart('Lines')
chart2.add_line(data2)

grid = leather.Grid()
grid.add_one(chart1)
grid.add_one(chart2)
grid.to_svg('examples/charts/grid.svg')