|
11 | 11 | from nvd3 import discreteBarChart |
12 | 12 | from nvd3 import pieChart |
13 | 13 | from nvd3 import multiBarChart |
| 14 | +from nvd3 import multiChart |
14 | 15 | from nvd3 import bulletChart |
15 | 16 | from nvd3.NVD3Chart import stab |
16 | 17 | from nvd3.translator import Function, AnonymousFunction, Assignment |
@@ -120,6 +121,30 @@ def test_MultiBarChart(self): |
120 | 121 | chart.add_serie(y=ydata, x=xdata, extra=extra) |
121 | 122 | chart.buildhtml() |
122 | 123 |
|
| 124 | + def test_multiChart(self): |
| 125 | + """Test Multi (line plus bar) Chart""" |
| 126 | + type = "multiChart" |
| 127 | + chart = multiChart( |
| 128 | + name=type, x_is_date=False, x_axis_format="AM_PM", |
| 129 | + no_data_message='custom message shows when there is no data', |
| 130 | + xAxis_staggerLabel=True |
| 131 | + ) |
| 132 | + |
| 133 | + xdata = [1,2,3,4,5,6] |
| 134 | + ydata = [115.5,160.5,108,145.5,84,70.5] |
| 135 | + ydata2 = [48624,42944,43439,24194,38440,31651] |
| 136 | + kwargs1 = {'color': 'brown'} |
| 137 | + kwargs2 = {'color': '#bada55'} |
| 138 | + extra_serie = {"tooltip": {"y_start": "There is ", "y_end": " calls"}} |
| 139 | + chart.add_serie(y=ydata, x=xdata, type='line', yaxis=1, name='visits', extra=extra_serie, **kwargs1) |
| 140 | + extra_serie = {"tooltip": {"y_start": "", "y_end": " at this point"}} |
| 141 | + chart.add_serie(y=ydata2, x=xdata, type='bar', yaxis=2,name='spend', extra=extra_serie, **kwargs2) |
| 142 | + chart.buildhtml() |
| 143 | + |
| 144 | + assert("chart.noData('custom message shows when there is no data')" in chart.htmlcontent) |
| 145 | + assert("function get_am_pm" in chart.htmlcontent) |
| 146 | + |
| 147 | + |
123 | 148 | def test_multiBarHorizontalChart(self): |
124 | 149 | """Test multi Bar Horizontal Chart""" |
125 | 150 | type = "multiBarHorizontalChart" |
|
0 commit comments