Use line chart in UI and write the supporting functions