

const getSankeyChart = (data = [], links = []) => {
  const option = {
    tooltip: {
      trigger: 'item',
      triggerOn: 'mousemove'
    },
    series: {
      type: 'sankey',
      layout: 'none',
      left: '1%',
      right: '1%',
      top: '5%',
      bottom: '5%',
      emphasis: {
        focus: 'adjacency'
      },
      nodeWidth: 50,
      nodeGap: 2,
      layoutIterations: 32,
      lineStyle: {
        color: 'source',
        curveness: 0.5
      },
      label: {
        show: true,
        formatter: function (params) {
          return `${params.name} $${params.value.toLocaleString()}`;
        },
        position: 'right',
        fontSize: 16,
        color: '#555'
      },
      data: data,
      links: links
    }
  };

  return option
}

export default getSankeyChart