Jasper_chart_create a new stacked chart How to make a stacked chart

1, prepare data Source

here we will create a csv file.

2, import/configuring a data source

(1)    open eclipse Repository Explorer

Window->Show View->Other-> Repository Explorer->OK

 Jasper_chart_create a new stacked chart
How to make a stacked chart

(2)    Data Adapters -> create Data Adapters  -> CSV file

Name -> char_stacked. (your chart name )

File -> choose your local stacked.csv file.

Click button -> Get column names from the first row of the file

Choose -> Use query executor mode (the report must use the CSV query language)

Choose -> Skip the first line (the column names will be read from the first line )

Click button -> Finish

 Jasper_chart_create a new stacked chart
How to make a stacked chart

3, create a jasper file.

 Jasper_chart_create a new stacked chart
How to make a stacked chart Jasper_chart_create a new stacked chart
How to make a stacked chart Jasper_chart_create a new stacked chart
How to make a stacked chart  

Jasper_chart_create a new stacked chart
How to make a stacked chart Jasper_chart_create a new stacked chart
How to make a stacked chart Jasper_chart_create a new stacked chart
How to make a stacked chart

4, make stacked chart.

(1)    Only keep Summary band, delete other band (Title, Page Header, Column Header, Detail 1, Column Footer, Page Footer).

Jasper_chart_create a new stacked chart
How to make a stacked chart

(2)    drag chart from Palette to Summary.

Choose -> Stacked Bar, Next.

(3)    Chart Data Configuration.

 Series:

 Jasper_chart_create a new stacked chart
How to make a stacked chart

Jasper_chart_create a new stacked chart
How to make a stacked chart

5, solutions of some problems:

(1)    Document is Empty.  

We already configuration the csv data and use it, csv file also have data, but error is document is Empty, this maybe did not configuring the language.

Jasper_chart_create a new stacked chart
How to make a stacked chart

(2)    Cast problem. 

this mostly caused by field class config error, we can change the field class style from string to double, float and so on.

Jasper_chart_create a new stacked chart
How to make a stacked chart Jasper_chart_create a new stacked chart
How to make a stacked chart

     

(3)    Unable to get value for CSV field.

This problem, we can check data config again, sometimes our first time configuration has no effect. Need to check again.

 Jasper_chart_create a new stacked chart
How to make a stacked chart Jasper_chart_create a new stacked chart
How to make a stacked chart 

Now, click preview, we can see the stacked chart.

 Jasper_chart_create a new stacked chart
How to make a stacked chart

How to change bar color?

We can use Chart Plot -> Series Colors. Add the color which we want to change.

 Jasper_chart_create a new stacked chart
How to make a stacked chart

How to change Legend position?

 Jasper_chart_create a new stacked chart
How to make a stacked chart

How to add a chart title?

Jasper_chart_create a new stacked chart
How to make a stacked chart

Preview

Jasper_chart_create a new stacked chart
How to make a stacked chart