calculate min&max for series