Lines 21-37
import org.apache.poi.ss.usermodel.charts.ChartAxis;
Link Here
|
21 |
import org.apache.poi.ss.usermodel.charts.AxisPosition; |
21 |
import org.apache.poi.ss.usermodel.charts.AxisPosition; |
22 |
import org.apache.poi.ss.usermodel.charts.AxisOrientation; |
22 |
import org.apache.poi.ss.usermodel.charts.AxisOrientation; |
23 |
import org.apache.poi.ss.usermodel.charts.AxisCrosses; |
23 |
import org.apache.poi.ss.usermodel.charts.AxisCrosses; |
|
|
24 |
import org.apache.poi.ss.usermodel.charts.AxisTickMark; |
24 |
import org.apache.poi.util.Beta; |
25 |
import org.apache.poi.util.Beta; |
25 |
import org.apache.poi.xssf.usermodel.XSSFChart; |
26 |
import org.apache.poi.xssf.usermodel.XSSFChart; |
26 |
import org.openxmlformats.schemas.drawingml.x2006.chart.CTAxPos; |
27 |
import org.openxmlformats.schemas.drawingml.x2006.chart.CTAxPos; |
|
|
28 |
import org.openxmlformats.schemas.drawingml.x2006.chart.CTBoolean; |
27 |
import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumFmt; |
29 |
import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumFmt; |
28 |
import org.openxmlformats.schemas.drawingml.x2006.chart.CTCrosses; |
30 |
import org.openxmlformats.schemas.drawingml.x2006.chart.CTCrosses; |
29 |
import org.openxmlformats.schemas.drawingml.x2006.chart.CTOrientation; |
31 |
import org.openxmlformats.schemas.drawingml.x2006.chart.CTOrientation; |
30 |
import org.openxmlformats.schemas.drawingml.x2006.chart.CTLogBase; |
32 |
import org.openxmlformats.schemas.drawingml.x2006.chart.CTLogBase; |
31 |
import org.openxmlformats.schemas.drawingml.x2006.chart.CTScaling; |
33 |
import org.openxmlformats.schemas.drawingml.x2006.chart.CTScaling; |
|
|
34 |
import org.openxmlformats.schemas.drawingml.x2006.chart.CTTickMark; |
32 |
import org.openxmlformats.schemas.drawingml.x2006.chart.STOrientation; |
35 |
import org.openxmlformats.schemas.drawingml.x2006.chart.STOrientation; |
33 |
import org.openxmlformats.schemas.drawingml.x2006.chart.STAxPos; |
36 |
import org.openxmlformats.schemas.drawingml.x2006.chart.STAxPos; |
34 |
import org.openxmlformats.schemas.drawingml.x2006.chart.STCrosses; |
37 |
import org.openxmlformats.schemas.drawingml.x2006.chart.STCrosses; |
|
|
38 |
import org.openxmlformats.schemas.drawingml.x2006.chart.STTickMark; |
35 |
|
39 |
|
36 |
/** |
40 |
/** |
37 |
* Base class for all axis types. |
41 |
* Base class for all axis types. |
Lines 158-167
public abstract class XSSFChartAxis implements ChartAxis {
Link Here
|
158 |
getCTCrosses().setVal(fromAxisCrosses(crosses)); |
162 |
getCTCrosses().setVal(fromAxisCrosses(crosses)); |
159 |
} |
163 |
} |
160 |
|
164 |
|
|
|
165 |
public boolean isVisible() { |
166 |
return !getDelete().getVal(); |
167 |
} |
168 |
|
169 |
public void setVisible(boolean value) { |
170 |
getDelete().setVal(!value); |
171 |
} |
172 |
|
173 |
public AxisTickMark getMajorTickMark() { |
174 |
return toAxisTickMark(getMajorCTTickMark()); |
175 |
} |
176 |
|
177 |
public void setMajorTickMark(AxisTickMark tickMark) { |
178 |
getMajorCTTickMark().setVal(fromAxisTickMark(tickMark)); |
179 |
} |
180 |
|
181 |
public AxisTickMark getMinorTickMark() { |
182 |
return toAxisTickMark(getMinorCTTickMark()); |
183 |
} |
184 |
|
185 |
public void setMinorTickMark(AxisTickMark tickMark) { |
186 |
getMinorCTTickMark().setVal(fromAxisTickMark(tickMark)); |
187 |
} |
188 |
|
161 |
protected abstract CTAxPos getCTAxPos(); |
189 |
protected abstract CTAxPos getCTAxPos(); |
162 |
protected abstract CTNumFmt getCTNumFmt(); |
190 |
protected abstract CTNumFmt getCTNumFmt(); |
163 |
protected abstract CTScaling getCTScaling(); |
191 |
protected abstract CTScaling getCTScaling(); |
164 |
protected abstract CTCrosses getCTCrosses(); |
192 |
protected abstract CTCrosses getCTCrosses(); |
|
|
193 |
protected abstract CTBoolean getDelete(); |
194 |
protected abstract CTTickMark getMajorCTTickMark(); |
195 |
protected abstract CTTickMark getMinorCTTickMark(); |
165 |
|
196 |
|
166 |
private static STOrientation.Enum fromAxisOrientation(AxisOrientation orientation) { |
197 |
private static STOrientation.Enum fromAxisOrientation(AxisOrientation orientation) { |
167 |
switch (orientation) { |
198 |
switch (orientation) { |
Lines 221-224
public abstract class XSSFChartAxis implements ChartAxis {
Link Here
|
221 |
default: return AxisPosition.BOTTOM; |
252 |
default: return AxisPosition.BOTTOM; |
222 |
} |
253 |
} |
223 |
} |
254 |
} |
|
|
255 |
|
256 |
private static STTickMark.Enum fromAxisTickMark(AxisTickMark tickMark) { |
257 |
switch (tickMark) { |
258 |
case NONE: return STTickMark.NONE; |
259 |
case IN: return STTickMark.IN; |
260 |
case OUT: return STTickMark.OUT; |
261 |
case CROSS: return STTickMark.CROSS; |
262 |
default: |
263 |
throw new IllegalArgumentException("Unknown AxisTickMark: " + tickMark); |
264 |
} |
265 |
} |
266 |
|
267 |
private static AxisTickMark toAxisTickMark(CTTickMark ctTickMark) { |
268 |
switch (ctTickMark.getVal().intValue()) { |
269 |
case STTickMark.INT_NONE: return AxisTickMark.NONE; |
270 |
case STTickMark.INT_IN: return AxisTickMark.IN; |
271 |
case STTickMark.INT_OUT: return AxisTickMark.OUT; |
272 |
case STTickMark.INT_CROSS: return AxisTickMark.CROSS; |
273 |
default: return AxisTickMark.CROSS; |
274 |
} |
275 |
} |
224 |
} |
276 |
} |