PeriodicTableView: Do not hard code number of periods

The number of periods may increase in the future and therefore we should compute it rather than hard code it.