'Add sparklines to the worksheet.
Args:
row:     The cell row (zero indexed).
col:     The cell column (zero indexed).
options: Sparkline formatting options.
Returns:
0:  Success.
-1: Row or column is out of worksheet bounds.
-2: Incorrect parameter or option.'

@convert_cell_args
def add_sparkline(self, row, col, options):

    if self._check_dimensions(row, col, True, True):
        return (-1)
    sparkline = {'locations': [xl_rowcol_to_cell(row, col)]}
    valid_parameters = {'location': True, 'range': True, 'type': True, 'high_point': True, 'low_point': True, 'negative_points': True, 'first_point': True, 'last_point': True, 'markers': True, 'style': True, 'series_color': True, 'negative_color': True, 'markers_color': True, 'first_color': True, 'last_color': True, 'high_color': True, 'low_color': True, 'max': True, 'min': True, 'axis': True, 'reverse': True, 'empty_cells': True, 'show_hidden': True, 'plot_hidden': True, 'date_axis': True, 'weight': True}
    for param_key in options.keys():
        if (param_key not in valid_parameters):
            warn(("Unknown    parameter    '%s'    in    add_sparkline()" % param_key))
            return (-1)
    if ('range' not in options):
        warn("Parameter    'range'    is    required    in    add_sparkline()")
        return (-2)
    spark_type = options.get('type', 'line')
    if (spark_type not in ('line', 'column', 'win_loss')):
        warn("Parameter    'type'    must    be    'line',    'column'    or    'win_loss'    in    add_sparkline()")
        return (-2)
    if (spark_type == 'win_loss'):
        spark_type = 'stacked'
    sparkline['type'] = spark_type
    if ('location' in options):
        if (type(options['location']) is list):
            sparkline['locations'] = options['location']
        else:
            sparkline['locations'] = [options['location']]
    if (type(options['range']) is list):
        sparkline['ranges'] = options['range']
    else:
        sparkline['ranges'] = [options['range']]
    range_count = len(sparkline['ranges'])
    location_count = len(sparkline['locations'])
    if (range_count != location_count):
        warn('Must    have    the    same    number    of    location    and    range    parameters    in    add_sparkline()')
        return (-2)
    sparkline['count'] = len(sparkline['locations'])
    sheetname = quote_sheetname(self.name)
    new_ranges = []
    for spark_range in sparkline['ranges']:
        spark_range = spark_range.replace('$', '')
        spark_range = spark_range.lstrip('=')
        if ('!' not in spark_range):
            spark_range = ((sheetname + '!') + spark_range)
        new_ranges.append(spark_range)
    sparkline['ranges'] = new_ranges
    new_locations = []
    for location in sparkline['locations']:
        location = location.replace('$', '')
        new_locations.append(location)
    sparkline['locations'] = new_locations
    sparkline['high'] = options.get('high_point')
    sparkline['low'] = options.get('low_point')
    sparkline['negative'] = options.get('negative_points')
    sparkline['first'] = options.get('first_point')
    sparkline['last'] = options.get('last_point')
    sparkline['markers'] = options.get('markers')
    sparkline['min'] = options.get('min')
    sparkline['max'] = options.get('max')
    sparkline['axis'] = options.get('axis')
    sparkline['reverse'] = options.get('reverse')
    sparkline['hidden'] = options.get('show_hidden')
    sparkline['weight'] = options.get('weight')
    empty = options.get('empty_cells', '')
    if (empty == 'zero'):
        sparkline['empty'] = 0
    elif (empty == 'connect'):
        sparkline['empty'] = 'span'
    else:
        sparkline['empty'] = 'gap'
    date_range = options.get('date_axis')
    if (date_range and ('!' not in date_range)):
        date_range = ((sheetname + '!') + date_range)
    sparkline['date_axis'] = date_range
    style_id = options.get('style', 0)
    style = get_sparkline_style(style_id)
    sparkline['series_color'] = style['series']
    sparkline['negative_color'] = style['negative']
    sparkline['markers_color'] = style['markers']
    sparkline['first_color'] = style['first']
    sparkline['last_color'] = style['last']
    sparkline['high_color'] = style['high']
    sparkline['low_color'] = style['low']
    self._set_spark_color(sparkline, options, 'series_color')
    self._set_spark_color(sparkline, options, 'negative_color')
    self._set_spark_color(sparkline, options, 'markers_color')
    self._set_spark_color(sparkline, options, 'first_color')
    self._set_spark_color(sparkline, options, 'last_color')
    self._set_spark_color(sparkline, options, 'high_color')
    self._set_spark_color(sparkline, options, 'low_color')
    self.sparklines.append(sparkline)
