How to use the leather.Bars 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_bars_different(self):
        data1 = [
            (3, 'foo'),
            (5, 'bar'),
            (9, 'bing')
        ]

        data2 = [
            (3, 'foo'),
            (5, 'bar'),
            (9, 'baz')
        ]

        lattice = leather.Lattice(shape=leather.Bars())
        lattice.add_many([data1, data2])

        svg = self.render_chart(lattice)

        self.assertElementCount(svg, '.axis', 4)
        self.assertElementCount(svg, '.series', 2)
        self.assertElementCount(svg, '.bars', 2)
github wireservice / leather / tests / test_lattice.py View on Github external
def test_bars(self):
        data1 = [
            (2, 'foo'),
            (6, 'bar'),
            (9, 'bing')
        ]

        data2 = [
            (3, 'foo'),
            (5, 'bar'),
            (7, 'bing')
        ]

        lattice = leather.Lattice(shape=leather.Bars())
        lattice.add_many([data1, data2])

        svg = self.render_chart(lattice)

        self.assertElementCount(svg, '.axis', 4)
        self.assertElementCount(svg, '.series', 2)
        self.assertElementCount(svg, '.bars', 2)
github wireservice / leather / tests / test_shapes.py View on Github external
def setUp(self):
        self.shape = leather.Bars('red')
        self.linear = leather.Linear(0, 10)
        self.ordinal = leather.Ordinal(['foo', 'bar', 'bing'])
        self.palette = (color for color in ['red', 'white', 'blue'])
github wireservice / agate / agate / tableset / bar_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.Bars())
    chart.add_x_axis(name=value_name)
    chart.add_y_axis(name=label_name)
    chart.add_many(self.values(), x=value, y=label, titles=self.keys())

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