You will have to use the underlying CT* classes, there is no good way to do
it with the POI API directly. This is partly because Excel determines the
axis label from either a formula or static text, each stored as different
properties in the underlying XML, and mutually exclusive.
Your best option is to open a sample file in Excel, edit the title you want
to change, save it as a new file, then unzip both files and compare their
contents. This will show you where in the XML your new value is stored.
From that, you can deduce the CT object path you will need to use to set
your value.
When I get the axis title, I have to go from the chart axis object lists:
XSSFChart.getCTChart().getPlotArea().getCatAxList()
XSSFChart.getCTChart().getPlotArea().getValAxList()
XSSFChart.getCTChart().getPlotArea().getDateAxList()
XSSFChart.getCTChart().getPlotArea().getSerAxList()
then for each axis element in each list:
CT*Ax.getTitle()
Then, with each axis CTTitle, you can either set a reference formula
expression or RichText static text.
You will need to check for existing objects and update them, remove them,
or add new instances if missing using the standard XMLBeans manipulation
methods.
If you are switching from one type of title to the other, i.e. from a
formula to static text, don't forget to remove the object nodes for the
title property you are replacing.
Post by ranzhang35can someone give some hints?
--
Sent from: http://apache-poi.1045710.n5.nabble.com/POI-User-f2280730.html
---------------------------------------------------------------------