public Chart createChart(String title, DataSet dataset, Rectangle rect) {
try {
String sName = mDocument.getDocumentPath() + "/" + title + "_" + System.currentTimeMillis();
// embed this chart document
ChartDocument newChartDocument = ChartDocument.newChartDocument();
mDocument.insertDocument(newChartDocument, sName);
OdfContentDom contentDom = newChartDocument.getContentDom();
ChartChartElement chartEle = (ChartChartElement) (contentDom.getXPath().evaluate("//chart:chart[1]",
contentDom, XPathConstants.NODE));
Chart chart = new Chart(chartEle, sName);
chart.setChartTitle(title);
chart.setChartType(ChartType.BAR);