How to create grouping a report in scripting ?

How to create grouping a report in scripting ?

Hello Guys, Is there any possibility to group the records in the report by scripting. 
Scenario : If the user click the panel in the page .the report will shown as popup . I am also set a criteria by using Query parameter. Is there any option to group the records.(I know that we can group the record in report properties by creating separate Report but i am looking for alternatives )