protected JFreeChart createChart(
      DSLAMSource source,
      String LID,
      Timeinterval time,
      Properties properties,
      GraphRenderingInput input,
      Map<String, Object> colorScheme,
      Properties outputProperties)
      throws IOException {
    JFreeChart res = null;

    {
      JFreeChart chart = null;

      Timeinterval domainAxisTime = null;

      // Set 'chart':
      {
        String domainAxisTitle = null;

        // Set 'domainAxisTime':
        {
          DateFormat format = (DateFormat) colorScheme.get("date.format");

          domainAxisTitle = "Time (" + time.toString(format) + ")";
        }

        chart =
            ChartFactory.createTimeSeriesChart(
                null, // chart-title
                domainAxisTitle, // domain-axis label
                null, // value-axis label
                null, // dataset
                true, // legends required
                true, // generate tooltips
                false // generate URLs
                );
      }

      XYPlot plot = chart.getXYPlot();

      plot.setOrientation(PlotOrientation.VERTICAL);
      plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
      plot.getRangeAxis().setFixedDimension(15.0);

      // Fix the domain axis:
      {
        fixDateAxisToTimeinterval(plot, time);
        domainAxisTime = time;
      }

      // Set the y-axis:
      {
        String axisTitle = "Count (/900s)";

        ValueAxis a = new LogarithmicAxis(axisTitle);
        a.setLowerBound(0);
        a.setUpperBound(1000); // TODO: '1000' is '900' rounded up to nearest power of 10!
        // TODO: Get unit from data-model!
        // TODO: Get upper bound from data-model!

        plot.setRangeAxis(a);
      }

      String title = getTitle();
      setDefaults(chart, colorScheme);
      setTitle(chart, LID, colorScheme, title, source, time);

      String filter = ""; // an empty string implies the default filter!

      // Set 'filter':
      {
        if (input != null) {
          Properties p = input.getProperties();
          if (p != null) {
            String v = p.getProperty("data.filter");
            if (v != null) {
              filter = v;
            }
          }
        }
      }

      addData(chart, source, time, filter, properties, colorScheme, outputProperties);

      if (outputProperties != null) {
        if (domainAxisTime != null) {
          outputProperties.setProperty("axis.domain.time", time.toString());
        }
      }

      res = chart;
    }

    return res;
  }