Update Points issue

by lhall17

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/3.5.43/vue.global.js"></script>
 <script src="https://code.highcharts.com/gantt/highcharts-gantt.js"></script>
<script src="https://code.highcharts.com/modules/draggable-points.js"></script>
<script src="https://code.highcharts.com/modules/drag-drop.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>

<div id="container"></div>
<button id="cancel">Cancel</button>

TypeScript

const { ref } = Vue;

const categories = ["Stand 1", "Stand 2", "Stand 3"];

let chart;

const originalFlights = [
  {
    id: "1",
    name: "6E304",
    stand: 1,
    start: Date.UTC(2025, 0, 1, 22, 20),
    end: Date.UTC(2025, 0, 1, 23, 10),
  },
  {
    id: "7",
    name: "AI2560",
    stand: 3,
    start: Date.UTC(2025, 0, 1, 23, 30),
    end: Date.UTC(2025, 0, 2, 0, 30),
  },
  {
    id: "8",
    name: "AI417",
    stand: 3,
    start: Date.UTC(2025, 0, 2, 0, 40),
    end: Date.UTC(2025, 0, 2, 1, 10),
  },
  {
    id: "9",
    name: "6E814",
    stand: 3,
    start: Date.UTC(2025, 0, 2, 1, 20),
    end: Date.UTC(2025, 0, 2, 2, 0),
  },
];

const pendingFlights = ref(
  structuredClone(originalFlights)
);

function getChartData() {
  return pendingFlights.value.map((flight) => ({
    id: flight.id,
    flightId: flight.id,
    name: flight.name,
    start: flight.start,
    end: flight.end,
    y: flight.stand - 1,
    color: "#4ca7ff",
  }));
}

function updateChart(){
  chart.series[0].setData(
    getChartData(),
    true,
    true,
    true
  );
}

function deleteFlight(id) {
  pendingFlights.value = pendingFlights.value.filter(
    (flight) => flight.id !== id
  );
  updateChart();
}

function cancelChanges() {
  pendingFlights.value = structuredClone(originalFlights)
  updateChart();
}

chart = Highcharts.ganttChart("container", {
  yAxis: {
    categories,
  },

  xAxis: {
    type: "datetime",
  },

  plotOptions: {
    series: {
      animation: false,

      dataLabels: {
        enabled: true,
      },

      dragDrop: {
        draggableX: true,
        draggableY: true,
      },

      point: {
        events: {
          click() {
            deleteFlight(this.id);
          },
        },
      },
    },
    gantt: {
        opacity: 0.7
    }
  },

  series: [
    {
      type: "gantt",
      data: getChartData(),
    },
 ...