Display the last valid model, rather than the total, of the collection for line labels

This was particularly bad for lines showing totals for other lines in the
graph.

https://www.pivotaltracker.com/n/projects/911874/stories/74682680
I'd be tempted to make this whole section a little more like:

```javascript
var model;
if (selected.selectedModel) {
    model = selected.selectedModel;
} else {
    model = // the code to find the model
}
output = this.formatPeriod(model, period);
```

So move the calls to `this.formatPeriod` out of the if, and just use the different cases to find the appropriate model.