Загрузка данных


public update(
  bar: SeriesDataItemTypeMap<Time>[TSeries],
  historicalUpdate = false,
): void {
  this.lwcSeries.update(bar, historicalUpdate);
}

protected updateRealtime(bar: SeriesDataItemTypeMap<Time>[TSeries]): void {
  this.update(bar, true);
}



protected dataSourceRealtimeSubscription = (dataToSet: Candle): void => {
  if (!this.validateData([dataToSet])) {
    console.error(`LightweightAPI: Invalid data format for ${this.getTypeName()} chart`);

    return;
  }

  const [formattedData] = this.formatData([dataToSet]);

  if (!formattedData) {
    return;
  }

  this.updateRealtime(formattedData);
};








public validateData(data: SourceData[]): boolean {
  return Array.isArray(data) && data.every((point) => typeof point.time === 'number');
}










protected dataSourceRealtimeSubscription = (dataToSet: Candle): void => {
  if (!this.validateData([dataToSet])) {
    console.error(`LightweightAPI: Invalid data format for ${this.getTypeName()} chart`);

    return;
  }

  const [formattedData] = this.formatData([dataToSet]);

  if (!formattedData) {
    return;
  }

  this.updateRealtime(formattedData);
};













protected dataSourceRealtimeSubscription = (dataToSet: Candle): void => {
  if (!this.validateData([dataToSet])) {
    console.error(`LightweightAPI: Invalid data format for ${this.getTypeName()} chart`);

    return;
  }

  const [formattedData] = this.formatData([dataToSet]);

  if (!formattedData) {
    return;
  }

  this.updateRealtime(formattedData);
};