Adding Stock Chart with Line Chart Using Aspose cells

Hello,
Can we add stock chart with line as combo chart using Aspose cells Java API?

@SrideviG,
Thank you for posting the question. Could you please share a presentation file with the sample chart that you want to create using Aspose.Slides? Then we will do our best to help you achieve your requirements.

I couldn’t create a combo chart manually ie, a line chart on top of candle stick.
But Im able to change the series representation.
Adding the sample file
Sample-Stock+line.zip (12.6 KB)

@SrideviG,

Thanks for the sample Excel file containing your desired chart.

You may specify/change the first series chart (which is by default clustered column) type to “Line”. See the following sample code especially the line in bold for your reference. I used your template Excel file (“sample-stock-excel.xlsx”) you previously shared in other thread for source data and created the combo chart accordingly.
e.g.
Sample code:

    Workbook workbook = new Workbook("f:\\files\\sample-stock-excel.xlsx");
    Worksheet worksheet = workbook.getWorksheets().get(0);
    int i  = worksheet.getCharts().add(ChartType.STOCK_VOLUME_HIGH_LOW_CLOSE,20, 6, 38, 21);
    Chart chart = worksheet.getCharts().get(i);
    chart.setShowLegend(true);
    chart.getTitle().setText("Chart Title");
    chart.getTitle().setVisible(true);
    chart.getLegend().setPosition(LegendPositionType.BOTTOM);
    chart.setChartDataRange("A1:E12",true);
    chart.getNSeries().setCategoryData("A2:A12");
    for(int j = 0;j<chart.getNSeries().getCount();j++)
    {
        switch (j) {
            case 1:
                chart.getNSeries().get(j).getMarker().setMarkerStyle(ChartMarkerType.CIRCLE);
                chart.getNSeries().get(j).getMarker().setMarkerSize(15);
                chart.getNSeries().get(j).getMarker().getArea().setFormatting(FormattingType.CUSTOM);
                chart.getNSeries().get(j).getMarker().getArea().setForegroundColor(com.aspose.cells.Color.getPink());
                chart.getNSeries().get(j).getBorder().setVisible(false);
                break;
            case 2:
                chart.getNSeries().get(j).getMarker().setMarkerStyle(ChartMarkerType.DASH);
                chart.getNSeries().get(j).getMarker().setMarkerSize(15);
                chart.getNSeries().get(j).getMarker().getArea().setFormatting(FormattingType.CUSTOM);
                chart.getNSeries().get(j).getMarker().getArea().setForegroundColor(com.aspose.cells.Color.getOrange());
                chart.getNSeries().get(j).getBorder().setVisible(false);
                break;
            case 3:
                chart.getNSeries().get(j).getMarker().setMarkerStyle(ChartMarkerType.SQUARE);
                chart.getNSeries().get(j).getMarker().setMarkerSize(15);
                chart.getNSeries().get(j).getMarker().getArea().setFormatting(FormattingType.CUSTOM);
                chart.getNSeries().get(j).getMarker().getArea().setForegroundColor(com.aspose.cells.Color.getLightBlue());
                chart.getNSeries().get(j).getBorder().setVisible(false);
                break;
        }
    }

chart.getNSeries().get(0).setType(ChartType.LINE);

     chart.getPlotArea().getArea().setFormatting(FormattingType.NONE);

     workbook.save("f:\\files\\out1.xlsx");

Hope, this helps a bit.