I have tried to come up with a workaround for this question from StackOverflow.

Link for the Question

Here the user has created a Report with CSV Datasource and wants to create a Pie Chart with only Top 10 Values from the same dataset and finding the problem.

I have used a sample report with CSV file created for this blog creating-a-datasource-using-excel-file-csv-format-in-jaspersoft-studio

1) I selected Columns “Task” and “Hours” as my Key and Value fields for the Pie Chart. Here one is a String and another is an Integer.

2) Then I created my First Variable called “Top3_Hour” as Follows


3) and next I created a Variable “Top3_Task” as Follows


4) When I use these two Variables in the report, The Report will Look like this


5) Now I have dragged the Chart palette and selected the Pie Chart and have used the new Variables as follows to create teh Pie Chart.


6) Now the Preview of the report would look like this.


Hence we have achieved the task of creating a Chart with only a subset of the complete dataset (CSV).