beoleg
beoleg

Reputation: 23

How to get offset between last point of series and left corner of chart

I have a chart that is filled with content from HTTP requests. And data always come with this code

 chartComponent.chartInstance
      .getDefaultAxisX()
      .onAxisInteractionAreaMouseDragStop((axis: Axis, event: MouseEvent, button: number, startLocation: Point): void => {
        if (axis.getInterval().start / 2 < 10000) {
          this.chartService.loadHistorySeriesData(chartComponent.selectedTimeRangeMinutes).subscribe((data: SeriesMapResponse) => {
            this.chartService.addNewDataToTheSeriesInstances(chartComponent.chartId, chartComponent.seriesInstances);
          })
        }
      })

So I have to implement conditions like if the offset is less than some number load me new data... Like pagination on the Instagram feed but with carts. How can I get this offset, I tried a lot of approaches and nothing works.

Upvotes: 0

Views: 68

Answers (1)

Niilo Kein&#228;nen
Niilo Kein&#228;nen

Reputation: 2582

You can get the "left side of chart" information by referencing the X Axis interval start, like follows:

Axis.getInterval().start

You can probably get the needed information of "last old point" by LineSeries.getXMin() method.

Upvotes: 0

Related Questions