Added Granularity Button for Graphs. This modifies the sql query.