Graph Time Range Filter selection doesn't work with MYSQL

Hi all, i have implemented my graph based on mysql datasource. Actually everything good except for the time range selection.

If i select last month, last week, today or anything else time range interval my graph is not updated. Can you say me how do that? Maybe must be added some configuration into the query?

This is a printscreen of my graph and query

Thank you
Cosimo