'use strict';

var LineSeries = require('./LineSeries.js');
var LineView = require('./LineView.js');
var points = require('../../layout/points.js');
var dataSample = require('../../processor/dataSample.js');

function install(registers) {
  registers.registerChartView(LineView.default);
  registers.registerSeriesModel(LineSeries.default);
  registers.registerLayout(points.default('line', true));
  registers.registerVisual({
    seriesType: 'line',
    reset: function (seriesModel) {
      var data = seriesModel.getData();
      // Visual coding for legend
      var lineStyle = seriesModel.getModel('lineStyle').getLineStyle();
      if (lineStyle && !lineStyle.stroke) {
        // Fill in visual should be palette color if
        // has color callback
        lineStyle.stroke = data.getVisual('style').fill;
      }
      data.setVisual('legendLineStyle', lineStyle);
    }
  });
  // Down sample after filter
  registers.registerProcessor(registers.PRIORITY.PROCESSOR.STATISTIC, dataSample.default('line'));
}

exports.install = install;
