How to use the leather.Lattice 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_lattice.py View on Github external
def test_add_many(self):
        lattice = leather.Lattice()
        lattice.add_many([self.data1, self.data2, self.data1])

        svg = self.render_chart(lattice)

        self.assertElementCount(svg, '.axis', 6)
        self.assertElementCount(svg, '.series', 3)
        self.assertElementCount(svg, '.lines', 3)
github wireservice / agate / agate / tableset / column_chart.py View on Github external
:param width:
        The width of the output SVG.
    :param height:
        The height of the output SVG.
    """
    if type(label) is int:
        label_name = self.column_names[label]
    else:
        label_name = label

    if type(value) is int:
        value_name = self.column_names[value]
    else:
        value_name = value

    chart = leather.Lattice(shape=leather.Columns())
    chart.add_x_axis(name=label_name)
    chart.add_y_axis(name=value_name)
    chart.add_many(self.values(), x=label, y=value, titles=self.keys())

    return chart.to_svg(path=path, width=width, height=height)
github wireservice / agate / agate / tableset / line_chart.py View on Github external
:param width:
        The width of the output SVG.
    :param height:
        The height of the output SVG.
    """
    if type(x) is int:
        x_name = self.column_names[x]
    else:
        x_name = x

    if type(y) is int:
        y_name = self.column_names[y]
    else:
        y_name = y

    chart = leather.Lattice(shape=leather.Line())
    chart.add_x_axis(name=x_name)
    chart.add_y_axis(name=y_name)
    chart.add_many(self.values(), x=x, y=y, titles=self.keys())

    return chart.to_svg(path=path, width=width, height=height)