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

TopN_Img1

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

TopN_Img2

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

TopN_Img3

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.

TopN_Img4

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

TopN_Img5

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