Move Chart"
From Documentation
m (correct highlight (via JWB)) |
|||
Line 11: | Line 11: | ||
===ZUML=== | ===ZUML=== | ||
− | <source lang="xml" | + | <source lang="xml" highlight="6"> |
<window vflex="1" width="100%" | <window vflex="1" width="100%" | ||
apply="org.zkoss.zssessentials.config.MoveChartComposer"> | apply="org.zkoss.zssessentials.config.MoveChartComposer"> | ||
Line 23: | Line 23: | ||
===Composer=== | ===Composer=== | ||
ZK Spreadsheet use <javadoc directory="zss" method="getCharts()">org.zkoss.zss.model.Worksheet</javadoc> to retrieve all charts in the sheet. | ZK Spreadsheet use <javadoc directory="zss" method="getCharts()">org.zkoss.zss.model.Worksheet</javadoc> to retrieve all charts in the sheet. | ||
− | <source lang="java" | + | <source lang="java" highlight="7"> |
private Spreadsheet myss; | private Spreadsheet myss; | ||
Latest revision as of 12:55, 19 January 2022
This article is out of date, please refer to http://books.zkoss.org/wiki/ZK_Spreadsheet_Essentials for more up to date information.
Available in ZK Spreadsheet EE only
Purpose
ZK Spreadsheet uses Range.moveChart (Chart, ClientAnchor) to move the position of the specified chart from the sheet.
ZUML
<window vflex="1" width="100%"
apply="org.zkoss.zssessentials.config.MoveChartComposer">
<spreadsheet id="myss" src="/WEB-INF/excel/config/MoveChart.xlsx" maxrows="200"
maxcolumns="40" vflex="1" width="100%">
</spreadsheet>
<button id="move" label="Move All Charts"/>
</window>
Composer
ZK Spreadsheet use Worksheet.getCharts() to retrieve all charts in the sheet.
private Spreadsheet myss;
public void onClick$move(MouseEvent evt) throws Exception {
//move chart
Worksheet sheet = myss.getSelectedSheet();
Range rng = Ranges.range(sheet);
for(Chart chart : sheet.getCharts()) { //move charts down two rows
ClientAnchor anchor = chart.getPreferredSize();
anchor.setRow1(anchor.getRow1()+2);
anchor.setRow2(anchor.getRow2()+2);
rng.moveChart(chart, anchor);
}
}
View the complete source of ZUML moveChart.zul
View the complete source of composer MoveChartComposer.java
Version History
Version | Date | Content |
---|---|---|
2.2.0 | Nov. 11, 2011 | API to move a chart |
All source code listed in this book is at Github.