How to make a stacked Chart1, prepare data Source
Here we'll create a CSV file.
2, import/configuring a data source
(1) Open Eclipse Repository Explorer
Window->show view->other-> Repository Explorer->ok
(2) CSV file, data adapters, create data adapters
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 would be read from the first line)
Click button, Finish
3, create a Jasper file.
4, make stacked chart.
(1) Only keep Summary band, delete other band (Title, Page header, column header, Detail 1, column Footer, Page Footer) .
(2) Drag chart from Palette to Summary.
Choose-Stacked Bar, Next.
(3) Chart Data Configuration.
Series:
5, solutions of some problems:
(1) Document is Empty.
We already configuration The CSV data and use it, CSV file also has data, but error is document is Empty, this maybe did Not configuring the language.
(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 .
(3) Unable to get the value for CSV field.
This problem, we can check the data config again, sometimes our first time configuration has no effect. Need to check again.
Now, click on Preview, we can see the stacked chart.
How to change bar color?
We can use Chart Plot-Series Colors. ADD the color which we want to change.
How to change Legend position?
How to add a chart title?
Preview
Jasper Create a new stacked chart