public static ChartData initChartDataFromXSSFChart(final String chartId,
            final XSSFChart chart, final XSSFWorkbook wb) {

        ThemesTable themeTable = wb.getStylesSource().getTheme();

        ChartData chartData = new ChartData();
        XSSFRichTextString chartTitle = chart.getTitle();
        if (chartTitle != null) {
            chartData.setTitle(chartTitle.toString());
        }
        CTChart ctChart = chart.getCTChart();
        ChartType chartType = ChartUtility.getChartType(ctChart);
        if (chartType == null) {
            throw new IllegalChartException("Unknown chart type");
        }

        chartData.setBgColor(
                ColorUtility.getBgColor(ctChart.getPlotArea(), themeTable));

        chartData.setId(chartId);
        chartData.setType(chartType);

        List<CTCatAx> ctCatAxList = ctChart.getPlotArea().getCatAxList();
        if ((ctCatAxList != null) && (!ctCatAxList.isEmpty())) {
            chartData.setCatAx(new ChartAxis(ctCatAxList.get(0)));
        }
        List<CTValAx> ctValAxList = ctChart.getPlotArea().getValAxList();
        if ((ctValAxList != null) && (!ctValAxList.isEmpty())) {
            chartData.setValAx(new ChartAxis(ctValAxList.get(0)));
        }

        ChartObject ctObj = chartType.createChartObject();

        if (ctObj == null) {
            throw new IllegalChartException("Cannot create chart object.");
        }

        setUpChartData(chartData, ctChart, themeTable, ctObj);

        return chartData;
    }
public static ChartData initChartDataFromXSSFChart ( final String chartId , final XSSFChart chart , final XSSFWorkbook wb ) { ThemesTable themeTable = wb . getStylesSource ( ) . getTheme ( ) ; ChartData chartData = new ChartData ( ) ; XSSFRichTextString chartTitle = chart . getTitle ( ) ; if ( chartTitle != null ) { chartData . setTitle ( chartTitle . toString ( ) ) ; } CTChart ctChart = chart . getCTChart ( ) ; ChartType chartType = ChartUtility . getChartType ( ctChart ) ; if ( chartType == null ) { throw new IllegalChartException ( "Unknown chart type" ) ; } chartData . setBgColor ( ColorUtility . getBgColor ( ctChart . getPlotArea ( ) , themeTable ) ) ; chartData . setId ( chartId ) ; chartData . setType ( chartType ) ; List < CTCatAx > ctCatAxList = ctChart . getPlotArea ( ) . getCatAxList ( ) ; if ( ( ctCatAxList != null ) && ( ! ctCatAxList . isEmpty ( ) ) ) { chartData . setCatAx ( new ChartAxis ( ctCatAxList . get ( 0 ) ) ) ; } List < CTValAx > ctValAxList = ctChart . getPlotArea ( ) . getValAxList ( ) ; if ( ( ctValAxList != null ) && ( ! ctValAxList . isEmpty ( ) ) ) { chartData . setValAx ( new ChartAxis ( ctValAxList . get ( 0 ) ) ) ; } ChartObject ctObj = chartType . createChartObject ( ) ; if ( ctObj == null ) { throw new IllegalChartException ( "Cannot create chart object." ) ; } setUpChartData ( chartData , ctChart , themeTable , ctObj ) ; return chartData ; }
init chart data.

@param chartId
chartId.
@param chart
chart.
@param wb
wb.
@return chartdata.