Add average line functionality

@darrenli