首页 > 解决方案 > 获取 e.timeScale(...).unsubscribeVisibleTimeRangeChange 不是函数

问题描述

我正在使用kaktana-react-lightweight-charts,一切正常,直到我得到e.timeScale(...).unsubscribeVisibleTimeRangeChange 不是函数错误,因为我没有在我的代码中实现它。我不知道我为什么需要这个?.. 场景是,起初我的图表会按照我的意愿很好地显示,然后当我点击其他数据时,它应该显示具有相同图表的新数据,但我得到了这个错误。所以我想我会实现unsubscribeVisibleTimeRangeChange功能,但不知道如何..

<Chart

        lineSeries={this.getChartData1("line", mainData)}
        options={optionMaster}
        autoWidth
        height={indexMode ? 320 : 240}
        onCrosshairMove={(e) => this.createLineChart(e, mainData)}
        onClick={(e) => this.openWindow(e, mainData)} 
        ( ....unsubscriberVisibleTimeRangeChange..how to call from here?...)

      />

这是我的选择

    optionMaster: {
  alignLabels: true,
  localization: {
    dateFormat: "dd MMM 'yy",
  },
  handleScroll: {
    mouseWheel: false,
    pressedMouseMove: false,
    horzTouchDrag: false,
    vertTouchDrag: false,
  },
  handleScale: {
    axisPressedMouseMove: false,
    mouseWheel: false,
    pinch: false,
  },
  priceScale: {
    position: "left",
    autoScale: true,
    invertScale: true,
    alignLabels: false,
    borderVisible: false,
    borderColor: "#555ffd",
    scaleMargins: {
      top: 0.3,
      bottom: 0.25,
    },
  },
  timeScale: {
    fixLeftEdge: true,
    lockVisibleTimeRangeOnResize: true,
  },
},

标签: reactjsfunctionunsubscribelightweight-charts

解决方案


推荐阅读