"use strict";
require("../../../../echarts@5.4.3/node_modules/echarts/lib/echarts.js");
const api = require("../../../../echarts@5.4.3/node_modules/echarts/lib/export/api.js");
const createDimensions = require("../../../../echarts@5.4.3/node_modules/echarts/lib/data/helper/createDimensions.js");
const SeriesData = require("../../../../echarts@5.4.3/node_modules/echarts/lib/data/SeriesData.js");
api.extendSeriesModel({
  type: "series.wordCloud",
  visualStyleAccessPath: "textStyle",
  visualStyleMapper: function(model) {
    return {
      fill: model.get("color")
    };
  },
  visualDrawType: "fill",
  optionUpdated: function() {
    var option = this.option;
    option.gridSize = Math.max(Math.floor(option.gridSize), 4);
  },
  getInitialData: function(option, ecModel) {
    var dimensions = createDimensions.createDimensions(option.data, {
      coordDimensions: ["value"]
    });
    var list = new SeriesData.default(dimensions, this);
    list.initData(option.data);
    return list;
  },
  // Most of options are from https://github.com/timdream/wordcloud2.js/blob/gh-pages/API.md
  defaultOption: {
    maskImage: null,
    // Shape can be 'circle', 'cardioid', 'diamond', 'triangle-forward', 'triangle', 'pentagon', 'star'
    shape: "circle",
    keepAspect: false,
    left: "center",
    top: "center",
    width: "70%",
    height: "80%",
    sizeRange: [12, 60],
    rotationRange: [-90, 90],
    rotationStep: 45,
    gridSize: 8,
    drawOutOfBound: false,
    shrinkToFit: false,
    textStyle: {
      fontWeight: "normal"
    }
  }
});
