# File lib/chart-candy/builder/base.rb, line 2
  def initialize(id, options={})
    options.reverse_merge! from: nil, to: nil, step: nil

    @from = options[:from] ? Time.parse(options[:from]) : nil
    @to = options[:to] ? Time.parse(options[:to]) : Time.now

    @chart = { id: id }
    @chart[:step] = options[:step] if options[:step]
    @chart[:title] = t('title')

    # Subtitles are likely to be dynamic and thus cannot be defined in translation files.
    @chart[:subtitle] = options[:subtitle].presence

    @chart[:period] = ChartCandy::Builder.period(@from, @to, step: @chart[:step]) if @from
  end