-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tick formatter option. Closes #13.
- Loading branch information
Showing
5 changed files
with
66 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env python | ||
|
||
try: | ||
import unittest2 as unittest | ||
except ImportError: | ||
import unittest | ||
|
||
import leather | ||
from tests.utils import XMLTest | ||
|
||
|
||
class TestChart(XMLTest): | ||
def setUp(self): | ||
self.data = [ | ||
(0, 3), | ||
(4, 5), | ||
(7, 9), | ||
(10, 4) | ||
] | ||
|
||
def test_tick_formatter(self): | ||
chart = leather.Chart() | ||
chart.add_dots(self.data) | ||
|
||
def test_formatter(value, i, count): | ||
return '%i+' % (value * 10) | ||
|
||
axis = leather.Axis(tick_formatter=test_formatter) | ||
chart.set_x_axis(axis) | ||
|
||
svg = self.render_chart(chart) | ||
|
||
self.assertTickLabels(svg, 'bottom', ['0+', '25+', '50+', '75+', '100+']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ | |
import unittest | ||
|
||
from lxml import etree | ||
import six | ||
|
||
|
||
class XMLTest(unittest.TestCase): | ||
|