aboutsummaryrefslogtreecommitdiffstats
path: root/src/examples
diff options
context:
space:
mode:
authorAlain Béarez <abearez@apache.org>2019-05-21 00:13:28 +0000
committerAlain Béarez <abearez@apache.org>2019-05-21 00:13:28 +0000
commitaf1dacfe2c5ccfb8bee0c1e7517cce5d698f6833 (patch)
tree99d5c3962e1b993706bf9fa2e1fb962431d176b4 /src/examples
parent217a7caae6dcb0b02debe3a187d637f155f9ae65 (diff)
downloadpoi-af1dacfe2c5ccfb8bee0c1e7517cce5d698f6833.tar.gz
poi-af1dacfe2c5ccfb8bee0c1e7517cce5d698f6833.zip
Added more chart supports.
fixed bug while creating chart with bar and line series. git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1859589 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/examples')
-rw-r--r--src/examples/src/org/apache/poi/xssf/usermodel/examples/BarAndLineChart.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/examples/src/org/apache/poi/xssf/usermodel/examples/BarAndLineChart.java b/src/examples/src/org/apache/poi/xssf/usermodel/examples/BarAndLineChart.java
index 1de43cb974..f674a37a38 100644
--- a/src/examples/src/org/apache/poi/xssf/usermodel/examples/BarAndLineChart.java
+++ b/src/examples/src/org/apache/poi/xssf/usermodel/examples/BarAndLineChart.java
@@ -134,17 +134,26 @@ public class BarAndLineChart {
lineCategories.crossAxis(rightValues);
// the bar chart
- XDDFBarChartData bar = (XDDFBarChartData) chart.createData(ChartTypes.BAR, lineCategories, rightValues);
+ XDDFBarChartData bar = (XDDFBarChartData) chart.createData(ChartTypes.BAR, barCategories, leftValues);
XDDFBarChartData.Series series1 = (XDDFBarChartData.Series) bar.addSeries(xs, ys1);
series1.setTitle("Bars", new CellReference("Sheet1!$B$1"));
bar.setVaryColors(true);
bar.setBarDirection(BarDirection.COL);
chart.plot(bar);
- // the line chart
+ // the line chart on secondary axis
XDDFLineChartData lines = (XDDFLineChartData) chart.createData(ChartTypes.LINE, lineCategories,
rightValues);
+
+ //uncomment below line if only primary axis required and comment above line
+ // the line chart on primary axis
+ /*XDDFLineChartData lines = (XDDFLineChartData) chart.createData(ChartTypes.LINE, lineCategories,
+ leftValues);*/
+
+
XDDFLineChartData.Series series2 = (XDDFLineChartData.Series) lines.addSeries(xs, ys2);
+ series2.updateIdXVal(1);
+ series2.updateOrderVal(1);
series2.setTitle("Lines", new CellReference("Sheet1!$C$1"));
lines.setVaryColors(true);
chart.plot(lines);