Highcharts - 指标的数据未显示在折线图中

Highcharts - Indicator's data not showing in line chart

  1. 我正在从端点获取数据

  2. 我把数据显示在highchart

  3. 有几个指标可以 selected。对于它们中的每一个,另一个 yAxis 添加在主要 yAxis 的下方。

  4. 我的系列数据是这样的格式:

     series: [
      {
        data: [],
        id: 'prices',
        step: this.hasStep,
        name: this.$props.title,
        fillColor: 'rgba(127,183,240,0.2)',
      },
      {
        visible: false,
        type: 'column',
        id: 'volume',
        name: 'Volume_hardcoded',
        //linkedTo: 'prices',
        data: this.volumeSeries,
      },
    ],
    
  5. 我是这样保存数据的(不用注意逻辑,没问题):

       if (this.selectedTimeSpan.tickInterval === 1) {
        for (let i = 0; i < prices.length; i++) {
          let xData = null;
          this.selectedTimeSpan.getIntradayData
            ? (xData = Math.floor(new Date(prices[i].time).getTime()))
            : (xData = Math.floor(new Date(prices[i].date).getTime()));
          priceSeries[i] = {
            x: xData,
            open: prices[i].first,
            high: prices[i].high,
            low: prices[i].low,
            close: prices[i].last,
            y: prices[i].last,
            volume: prices[i].tradingVolume,
          };
          this.volumeSeries[i] = {
            x: xData,
            y: prices[i].tradingVolume,
          };
        }
      } else {
        let j = 0;
        for (
          let i = 4;
          i < prices.length;
          i += this.selectedTimeSpan.tickInterval
        ) {
          priceSeries[j] = {
            x: Math.floor(new Date(prices[i].date).getTime()),
            open: prices[i].first,
            high: prices[i].high,
            low: prices[i].low,
            close: prices[i].last,
            y: prices[i].last,
            volume: prices[i].tradingVolume,
          };
          this.volumeSeries[j] = {
            x: Math.floor(new Date(prices[i].date).getTime()),
            y: prices[i].tradingVolume,
          };
          j++;
        }
      }
    
  6. 当我selectthese indicators (they are based on the volume), I am getting this result.(You can see a blank space below the main chart.) Instead when i swap to OHLC or candlestick my main series (series[0]) it looks works fine and it looks like this。知道为什么会这样吗?我根本没有触及工具提示设置(以防出现问题)。我现在正在苦苦挣扎 2 天,无法真正弄明白。任何帮助将不胜感激。如果您需要更多信息,请随时发表评论,以便我提供。提前致谢。克里斯

已修复,在系列对象中有一个名为 usedOhlcData 的标志可以使用。 (在我的例子中是系列 [0])。我们只是将它设置为 true。

series:[{
    data:[],
    useOhlcData:true,
    ...}
    ,{
    ...
    }]