1

I have lightning chart and we can find min max using following

const series = chart.addLineSeries()
series.add([
  {x: 0, y: 1},
  {x: 2, y: 3}
])

series.getXMin() // 0
series.getYMin() // 1
series.getXMax() // 2
series.getYMax() // 3

But is there a way to find mix max from the visible area of chart , for example i have 1000's of values in series , but i show last 100 datapoints using setinterval.. is there a way to get min max of series in that particular interval , or visible area of chart only.

Gracie williams
  • 1,287
  • 2
  • 16
  • 39
  • 1
    Does this answer your question? [Get visible points for a series in LightningChartJs](https://stackoverflow.com/questions/64373297/get-visible-points-for-a-series-in-lightningchartjs) – Snekw Aug 17 '21 at 20:44
  • In ur answer , we use user data , is there a way to get data from series itself and process the min max from visible area , Because i have 20+ series.. if it is via series it will be useful for me. – Gracie williams Aug 18 '21 at 03:52

1 Answers1

1

LightningChart JS unfortunately doesn't currently keep track of this information (series data points that are visible in active axis range), so there is no utility available which you are looking for.

Understandably not ideal, but the immediate solution I would suggest is to keep track of the data set you have in each of your series, monitor the active axis range and ultimately calculate the data points which are in the range of axis.

This implementation should be the same as this answer here How to get data from selected points in Lightning Chart even though the goal is slightly different.

I would be inclined to inquire what you are using this information for? Perhaps in future updates we might be able to work some utility for achieving this, if we can justify that it is useful for users in general.

Niilo Keinänen
  • 2,187
  • 1
  • 7
  • 12
  • Actually it is very important feature , because I have very lengthy chart like 1000's of points , but I want to show last 100 points as line charts at given time , so I want to setinterval Y axis with minX and MinY of last 100 points... not last 1000 points. – Gracie williams Aug 18 '21 at 16:07
  • Calculating Y boundaries of 100 data points is an immediate operation, so I don't expect that you'll have any performance issues with your application regarding this, just it's a bit of extra code. – Niilo Keinänen Aug 18 '21 at 18:40
  • yea I can understand , but i have 100 different series ... so API like getVisibleMax and getVisibleMin will be really appreciatable. – Gracie williams Aug 18 '21 at 18:58
  • 1
    We'll keep this in mind with further development. – Niilo Keinänen Aug 19 '21 at 07:02