A systematic approach is developed to identify the bivariate relation of two fundamental traffic variables, traffic volume and density, from single-loop detector data. The approach is motivated by the observation of a peculiar feature of traffic fluctuations. That is, in a short time, traffic usually experiences fluctuations without a significant change in speed. This fact is used to define equilibrium in a new manner, and a mixed integer programming approach is proposed for constructing a piecewise linear fundamental diagram (FD) accordingly. By construction, the proposed method is data adaptive and optimal in the sense of least absolute deviation. This method is used to perform a case study with data from one section of a multilane freeway. The results indicate that both capacity drop and concave-convex FD shapes abound in practice. Differences in traffic behavior across freeway lanes and along freeway sections revealed through the FD are discussed.