Automatic change of timeseries colour in dashboard

In my custom datasource plugin,whenever i refresh or change the value in the panel all the timeseries convert to same colour.Here is the sample
Before changing the from and to values

After i change the from and to values to 24 hr range

What is the cause of this and how can i solve this issue?