for (Map.Entry<Range, Document.ChartWrapper> entry : result.getChartSpaces().entrySet()) {
for (Range templateRange : rangeDependencies.keySet()) {
if (templateRange.contains(entry.getKey())) {
List<Range> chartBandResultRanges = rangeDependencies.get(templateRange);
if (chartBandResultRanges.size() > 0) {
Range firstResultRange = getFirst(chartBandResultRanges);
shiftChart(entry.getValue(), templateRange, firstResultRange);
CTChart chart = entry.getValue().getChartSpace().getChart();
CTPlotArea plotArea = chart.getPlotArea();
List<Object> areaChartOrArea3DChartOrLineChart = plotArea.getAreaChartOrArea3DChartOrLineChart();
for (Object o : areaChartOrArea3DChartOrLineChart) {
if (o instanceof ListSer) {
ListSer series = (ListSer) o;
List<SerContent> ser = series.getSer();
for (SerContent ctBarSer : ser) {
CTAxDataSource captions = ctBarSer.getCat();
if (captions != null && captions.getStrRef() != null) {
Range temlpateCaptionsRange = Range.fromFormula(captions.getStrRef().getF());
for (Range bandRange : rangeDependencies.keySet()) {
if (bandRange.contains(temlpateCaptionsRange)) {
List<Range> seriesResultRanges = rangeDependencies.get(bandRange);
Range seriesFirstRange = getFirst(seriesResultRanges);
Range seriesLastRange = getLast(seriesResultRanges);
Offset offset = calculateOffset(temlpateCaptionsRange, seriesFirstRange);
Offset initialOffset = calculateOffset(temlpateCaptionsRange, bandRange);
temlpateCaptionsRange = temlpateCaptionsRange.shift(
offset.downOffset - initialOffset.downOffset,
offset.rightOffset - initialOffset.rightOffset);
Offset grow = calculateOffset(seriesFirstRange, seriesLastRange);
temlpateCaptionsRange.grow(grow.downOffset, grow.rightOffset);
captions.getStrRef().setF(temlpateCaptionsRange.toFormula());
break;
}
}
}
CTNumDataSource data = ctBarSer.getVal();
if (data != null && data.getNumRef() != null) {
Range templateDataRange = Range.fromFormula(data.getNumRef().getF());
for (Range bandRange : rangeDependencies.keySet()) {
if (bandRange.contains(templateDataRange)) {
List<Range> seriesResultRanges = rangeDependencies.get(bandRange);
Range seriesFirstRange = getFirst(seriesResultRanges);
Range seriesLastRange = getLast(seriesResultRanges);
Offset offset = calculateOffset(templateDataRange, seriesFirstRange);
Offset initialOffset = calculateOffset(templateDataRange, bandRange);
templateDataRange = templateDataRange.shift(
offset.downOffset - initialOffset.downOffset,