If datasetId is a graph, you can find a graph with id 3. If datasetId is a graph with id 3, you can find a graph with id 3.

function updateChartProps(id: undefined, option: { series: any[]; },charts: any[], changeCharts: { (charts: object[]): void; (arg0: any): void; (arg0: any): void; }){
  charts.map(chart= > {
    if (chart.id === id) {
      chart.option = option;
    }
    return chart;
  });
  changeCharts(charts)
}
function updateChart(chartData: string | any[], option: { series: any[]; } | undefined, id: undefined,charts: any[], changeCharts: { (charts: object[]): void; (arg0: any): void; }){

  if(! chartData)return;

  if (option && option.series && option.series.length > 0) {
    //console.log('getProps',type,this.props, chartData);
    option.series = option.series.map((serie, index) = > {
      if(!!!!! chartData && chartData.length >0) {
        if (chartData.length < index) {
          index = chartData.length;
        }
        const newSer = Object.assign({}, serie, chartData[index]);

        return newSer;
      } else {
        return serie; //seriesItemTemplate}});if(!!!!! updateChartProps) { updateChartProps(id, option,charts,changeCharts); }}}function loadWebsocket(markPreview:boolean,charts: any[], changeCharts: { (charts: object[]): void; (arg0: any): void; },) {
  let hasDataSetIdCharts: any[] = [];
  charts.map((obj) = > {
    if (obj.hasOwnProperty('dataSetId') && obj.dataSetId) { hasDataSetIdCharts.push(obj.dataSetId); }}); markPreview&&changeCharts(charts);const socket = new WebSocket("ws://" + 'ip' + ": 9080");
  // Receive the message
  socket.onmessage = function (event) {
    if (event && event.data) {
      const socketData = JSON.parse(event.data);
        charts.map((item) = > {
          if (item.hasOwnProperty('dataSetId') && item.dataSetId == socketData.dataSetId) {
            updateChart(JSON.parse(socketData.data),item.option, item.id, charts, changeCharts)
          }
        })
    }
  }
    // The connection setup callback function
    socket.onopen = function (event) {
 // console.log(event)
      socket.send(
        hasDataSetIdCharts.join(', '))}// connect the broken callback function
    socket.onclose = function (event) {
      console.log(event); }}Copy the code