def set_plotarea(params = {})
    return if params.empty?

    area = @plotarea

    # Set the plotarea visibility.
    if params.has_key?(:visible)
      area[:visible] = params[:visible]
      return if area[:visible] == 0
    end

    # TODO. could move this out of if statement.
    area[:bg_color_index] = 0x08

    # Set the chart background colour.
    if params.has_key?(:color)
      index, rgb = get_color_indices(params[:color])
      if !index.nil?
        area[:fg_color_index] = index
        area[:fg_color_rgb]   = rgb
        area[:bg_color_index] = 0x08
        area[:bg_color_rgb]   = 0x000000
      end
    end

    # Set the border line colour.
    if params.has_key?(:line_color)
      index, rgb = get_color_indices(params[:line_color])
      if !index.nil?
        area[:line_color_index] = index
        area[:line_color_rgb]   = rgb
      end
    end

    # Set the border line pattern.
    if params.has_key?(:line_pattern)
        pattern = get_line_pattern(params[:line_pattern])
        area[:line_pattern] = pattern
    end

    # Set the border line weight.
    if params.has_key?(:line_weight)
        weight = get_line_weight(params[:line_weight])
        area[:line_weight] = weight
    end
  end
def set_plotarea(params = {})
    return if params.empty?

    area = @plotarea

    # Set the plotarea visibility.
    if params.has_key?(:visible)
      area[:visible] = params[:visible]
      return if area[:visible] == 0
    end

    # TODO. could move this out of if statement.
    area[:bg_color_index] = 0x08

    # Set the chart background colour.
    if params.has_key?(:color)
      index, rgb = get_color_indices(params[:color])
      if !index.nil?
        area[:fg_color_index] = index
        area[:fg_color_rgb]   = rgb
        area[:bg_color_index] = 0x08
        area[:bg_color_rgb]   = 0x000000
      end
    end

    # Set the border line colour.
    if params.has_key?(:line_color)
      index, rgb = get_color_indices(params[:line_color])
      if !index.nil?
        area[:line_color_index] = index
        area[:line_color_rgb]   = rgb
      end
    end

    # Set the border line pattern.
    if params.has_key?(:line_pattern)
        pattern = get_line_pattern(params[:line_pattern])
        area[:line_pattern] = pattern
    end

    # Set the border line weight.
    if params.has_key?(:line_weight)
        weight = get_line_weight(params[:line_weight])
        area[:line_weight] = weight
    end
  end
Set the properties of the chart plotarea.