import * as Highcharts from 'highcharts';
import { BaseHighChartsRender } from "../types/BaseHighChartsRender";
export class DonutChartStrategy extends BaseHighChartsRender {
  buildOptions(series, options) {
    const dataLabels = [
      {
        enabled: true,
        distance: 10,
        format: '{point.name}',
      },
      {
        enabled: true,
        distance: -20,
        format: '{point.y}',
        style: {
          fontSize: '0.9em'
        }
      }
    ];
    return Object.assign(Object.assign(Object.assign(Object.assign({ chart: Object.assign(Object.assign({ type: 'pie' }, (options.width && { width: options.width })), (options.height && { height: options.height })), title: this.parseTitle(options.title) }, (options.subTitle && { subtitle: this.parseSubTitle(options.subTitle) })), { series: this.parseSerie(series), tooltip: this.buildFormatterTooltip(series), legend: {
        enabled: options.legendEnabled,
      }, plotOptions: {
        series: {
          dataLabels
        },
        pie: Object.assign({ cursor: 'pointer', innerSize: '70%' }, (options.onClickSerie && {
          point: {
            events: {
              click: this.buildOnClickCallBack(options.onClickSerie),
            }
          }
        }))
      } }), this.buildResposiveConfig()), this.buildDefaultChartOptions());
  }
  render(container, series, _xAxis, _yAxis, options) {
    this.chart = Highcharts.chart(container, this.buildOptions(series, options));
  }
  destroy() {
    var _a;
    (_a = this.chart) === null || _a === void 0 ? void 0 : _a.destroy();
  }
}
