<template>
  <div>
    <div id="chart">
      <apexchart
        type="dumbbell"
        height="380"
        :options="chartOptions"
        :series="series"
      ></apexchart>
    </div>
  </div>
</template>

<script>
import VueApexCharts from 'vue-apexcharts'

export default {
  components: {
    apexchart: VueApexCharts,
  },
  data: function () {
    return {
      series: [
        {
          name: '2020',
          data: [
            {
              x: 'Data engineer',
              y: 96,
            },
            {
              x: 'Backend',
              y: 92,
            },
            {
              x: 'Mobile',
              y: 88,
            },
            {
              x: 'Frontend',
              y: 84,
            },
            {
              x: 'QA',
              y: 71,
            },
          ],
        },
        {
          name: '2025',
          data: [
            {
              x: 'Data engineer',
              y: 148,
            },
            {
              x: 'Backend',
              y: 137,
            },
            {
              x: 'Mobile',
              y: 121,
            },
            {
              x: 'Frontend',
              y: 126,
            },
            {
              x: 'QA',
              y: 99,
            },
          ],
        },
      ],
      chartOptions: {
        chart: {
          type: 'dumbbell',
          height: 380,
        },
        colors: ['#3B82F6', '#EF4444'],
        title: {
          text: 'Median base salary by role',
          align: 'left',
        },
        subtitle: {
          text: 'Illustrative data. The dot is the year, the bar is the gap.',
          align: 'left',
        },
        xaxis: {
          labels: {
            formatter: function (val) {
              return '$' + Math.round(val) + 'k'
            },
          },
        },
        grid: {
          xaxis: {
            lines: {
              show: true,
            },
          },
        },
      },
    }
  },
}
</script>

<style>
#chart {
  max-width: 650px;
  margin: 35px auto;
}
</style>