add more options for Overlap
@@ -7,29 +7,35 @@ class Overlap(object):
def __init__(self):
self._chart = None
- def add(self, chart):
+ def add(self, chart, xaxis_index=0, yaxis_index=0, is_add_xaxis=False, is_add_yaxis=False):
"""
:param chart:
chart instance
+ :param xaxis_index:
+ xAxis index
+ :param yaxis_index:
+ yAxis index
+ :param is_add_xaxis:
+ whether to add a new xaxis
+ :param is_add_yaxis:
+ whether to add a new yaxis
:return:
"""
if self._chart is None:
self._chart = chart
else:
- self.__custom(self.__get_series(chart))
-
- def __get_series(self, chart):
- """ Get chart series data
-
- :param chart:
- chart instance
- :return:
- """
- return (
+ _series = (
chart._option.get('legend')[0].get('data'),
chart._option.get('series'),
+ chart._option.get('xAxis')[0],
+ chart._option.get('yAxis')[0],
+ is_add_xaxis,
+ is_add_yaxis,
+ xaxis_index,
+ yaxis_index
)
+ self.__custom(_series)
def __custom(self, series):
""" Appends the data for the series of the chart type
@@ -37,12 +43,18 @@ class Overlap(object):
:param series:
series data
"""
- _name, _series = series
+ _name, _series, _xaxis, _yaxis, is_add_xaxis, is_add_yaxis, _xaxis_index, _yaxis_index = series
for n in _name:
self._chart._option.get('legend')[0].get('data').append(n)
for s in _series:
+ s.update(xAxisIndex=_xaxis_index, yAxisIndex=_yaxis_index)
self._chart._option.get('series').append(s)
+ if is_add_xaxis:
+ self._chart._option.get('xAxis').append(_xaxis)
+ if is_add_yaxis:
+ self._chart._option.get('yAxis').append(_yaxis)
+
def render(self, path="render.html"):
"""
