What is the right algorithm to detect segmentations of a line chart?
Basically, it looks like you need to know some threshold to detect peaks:


detect bottom edge (Xbe)
calculate the moving average (until the last edge)
detect peak itself (current value - average value > threshold)
start of peak found: X1=Xbe
detect peak end (current value - average value &lt; threshold)
detect bottom age (Xbe)
end of peak found: X2=Xbe


Bottom edge detection in the simplest way is when you make moving subtract for two consecutive values and sign changes from negative to positive.