From f5bcbf91164a12a9fbad889869a8d4c3aa286eb4 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Tue, 27 May 2008 11:44:49 +0000 Subject: [PATCH] X, Y, Width and Height getters/setters on HSSFChart git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@660474 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/poi/hssf/usermodel/HSSFChart.java | 17 +++++++++++++++++ .../poi/hssf/usermodel/TestHSSFChart.java | 6 ++++++ 2 files changed, 23 insertions(+) diff --git a/src/scratchpad/src/org/apache/poi/hssf/usermodel/HSSFChart.java b/src/scratchpad/src/org/apache/poi/hssf/usermodel/HSSFChart.java index 5b48501938..e3f5bb23e9 100644 --- a/src/scratchpad/src/org/apache/poi/hssf/usermodel/HSSFChart.java +++ b/src/scratchpad/src/org/apache/poi/hssf/usermodel/HSSFChart.java @@ -213,6 +213,23 @@ public class HSSFChart charts.toArray( new HSSFChart[charts.size()] ); } + /** Get the X offset of the chart */ + public int getChartX() { return chartRecord.getX(); } + /** Get the Y offset of the chart */ + public int getChartY() { return chartRecord.getY(); } + /** Get the width of the chart. {@link ChartRecord} */ + public int getChartWidth() { return chartRecord.getWidth(); } + /** Get the height of the chart. {@link ChartRecord} */ + public int getChartHeight() { return chartRecord.getHeight(); } + + /** Sets the X offset of the chart */ + public void setChartX(int x) { chartRecord.setX(x); } + /** Sets the Y offset of the chart */ + public void setChartY(int y) { chartRecord.setY(y); } + /** Sets the width of the chart. {@link ChartRecord} */ + public void setChartWidth(int width) { chartRecord.setWidth(width); } + /** Sets the height of the chart. {@link ChartRecord} */ + public void setChartHeight(int height) { chartRecord.setHeight(height); } /** * Returns the series of the chart diff --git a/src/scratchpad/testcases/org/apache/poi/hssf/usermodel/TestHSSFChart.java b/src/scratchpad/testcases/org/apache/poi/hssf/usermodel/TestHSSFChart.java index 184d46d2fe..d28b8a8777 100644 --- a/src/scratchpad/testcases/org/apache/poi/hssf/usermodel/TestHSSFChart.java +++ b/src/scratchpad/testcases/org/apache/poi/hssf/usermodel/TestHSSFChart.java @@ -53,6 +53,12 @@ public class TestHSSFChart extends TestCase { assertEquals("1st Column", charts[0].getSeries()[0].getSeriesTitle()); assertEquals("2nd Column", charts[0].getSeries()[1].getSeriesTitle()); assertEquals(null, charts[0].getChartTitle()); + + // Check x, y, width, height + assertEquals(0, charts[0].getChartX()); + assertEquals(0, charts[0].getChartY()); + assertEquals(26492928, charts[0].getChartWidth()); + assertEquals(15040512, charts[0].getChartHeight()); } public void testTwoCharts() throws Exception { -- 2.39.5