We present a model of chemical evolution in disc galaxies, which extends our semi-analytical model for galaxy evolution. This semi-analytical framework has already been shown to reproduce the observed star formation histories. We take an open-box approach which tracks the metallicity of two phases, the hot coronal gas and the cold gas making up the disc. Gaseous infall at primordial metallicities is constrained by analytic fits to N-body simulations and the model includes supernova and active galactic nuclei feedback. We address the differences between observed metallicities obtained from H ii data and from damped Lyman α (DLA) absorbers and show that they may be explained by observational selection effects resulting from radial metallicity gradients, without having to resort to a separate population of galaxies. Within the framework describing these selection effects the cold disc gas of our chemical evolution model is shown to reproduce the metallicities of both the H ii regions and the DLA absorbers. DLA metallicities are shown to be largely determined by dwarf galaxies especially at high redshifts.