{"size": 1068, "ext": "js", "max_stars_repo_path": "src/charts/plugin/zhAddSeriaToYAxis.js", "max_stars_repo_name": "ZhnZhn/ZhnZhn.github.io", "max_stars_repo_stars_event_min_datetime": "2016-07-25T06:51:32.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-21T13:42:45.000Z", "max_issues_repo_path": "src/charts/plugin/zhAddSeriaToYAxis.js", "max_issues_repo_name": "ZhnZhn/ZhnZhn.github.io", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/charts/plugin/zhAddSeriaToYAxis.js", "max_forks_repo_name": "ZhnZhn/ZhnZhn.github.io", "max_forks_repo_forks_event_min_datetime": "2020-07-18T12:47:04.000Z", "max_forks_repo_forks_event_max_datetime": "2020-07-18T12:47:04.000Z"}
{"max_stars_count": 8, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 23.2173913043, "max_line_length": 65, "alphanum_fraction": 0.6170411985}
import crDataMinMaxSlice from './crDataMinMaxSlice'
import crYAxisId from './crYAxisId'
import crYAxisSeria from './crYAxisSeria'

const _crAxis = (id, color) => ({
    id: id,
    opossite: true,
    title: {
      text: ''
    },
    lineColor: color,
    tickColor: color,
    gridLineWidth: 0,
    labels: {
      style: {
        color: color
      }
    },
    showEmpty: false
});

//options = {color, name, yIndex, data, userMax, userMin}
//yIndex =  void 0 | 0 | number
const zhAddSeriaToYAxis = function(options={}, seriaOptions={}) {
  try {
    const {color, yIndex, name} = options
    , [isNewAxis, yAxisId] = crYAxisId(this, yIndex, name);
    if (isNewAxis) {
      this.addAxis(_crAxis(yAxisId, color), false, true)
    }
    const _seria = crYAxisSeria(this, {
      color, name,
      ...seriaOptions,
      data: crDataMinMaxSlice(options),
      yAxis: yAxisId
    })
    , _seriaInst = this.addSeries(_seria, false);
    this.redraw();
    return _seriaInst;
  } catch(err) {
    console.log(err.message)
  }
};

export default zhAddSeriaToYAxis
