public XDiagram createDiagram(XComponent oDoc, String kind) {
XInterface oInterface = null;
XDiagram oDiagram = null;
//get LineDiagram
XMultiServiceFactory oDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface( XMultiServiceFactory.class, oDoc );
try{
oInterface = (XInterface) oDocMSF.createInstance("com.sun.star.chart."+kind);
oDiagram = (XDiagram) UnoRuntime.queryInterface(XDiagram.class, oInterface);
} catch ( Exception e ) {
// Some exception occures.FAILED
System.out.println( "Couldn't create "+kind+"-Diagram "+ e );
}