@sm350
Yes. Using Python via Java will also achieve the same results. The underlying layer is also called Aspose.Cells for Java library.
@John.He
Thanks
And are the same functions valid in python as well for creating charts, as the ones you sent for java?
@John.He
For this part of the code?
Series firstSeries = chart.getNSeries().get(0);
// Set the chart type
firstSeries.setType(ChartType.LINE);
// Set style for the border of first series
firstSeries.getBorder().setStyle(LineType.MEDIUM_GRAY);
// Set Color for the first series
firstSeries.getBorder().setColor(Color.fromArgb(165, 165, 165));
//get the second Series
Series secondSeries = chart.getNSeries().get(1);
// Set the chart type
secondSeries.setType(ChartType.LINE);
// Set style for the border of first series
secondSeries.getBorder().setStyle(LineType.SOLID);
// Set Color for the first series
secondSeries.getBorder().setColor(Color.fromArgb(255, 192, 0));
//get the third Series
Series thirdSeries = chart.getNSeries().get(2);
thirdSeries.getArea().setForegroundColor(Color.fromArgb(91, 155, 213));
//get the fourth Series
Series fourthSeries = chart.getNSeries().get(3);
fourthSeries.getArea().setForegroundColor(Color.fromArgb(237, 125, 49));
chart.getPlotArea().getArea().setFormatting(FormattingType.NONE);
chart.getPlotArea().getBorder().setVisible(false);
chart.getSeriesAxis().getAxisLine().setVisible(false);
chart.getValueAxis().getAxisLine().setVisible(false);
chart.getCategoryAxis().getAxisLine().setVisible(false);
chart.getChartArea().getBorder().setColor(Color.fromArgb(217, 217, 217));
chart.getValueAxis().getMajorGridLines().setColor(Color.fromArgb(217, 217, 217));
@sm350
Yes. All functions and features supported by the Aspese.Cells for Java library are also supported in Aspese.Cells for Python via Java. Because the underlying Python via Java library is also the jar library.
@sm350
You can use the following Python sample code to achieve your goals.
import jpype
from jpype import java
import asposecells
jpype.startJVM()
from asposecells.api import Workbook, ChartType, LegendPositionType, LineType, Color, FormattingType
# Create the workbook
workbook = Workbook("New Microsoft Excel Worksheet.xlsx")
# Access the first worksheet
worksheet = workbook.getWorksheets().get(0);
# Add a Column chart
columnIndex = worksheet.getCharts().add(ChartType.COLUMN, 18, 5, 34, 12)
# Retrieve the Chart object
chart = worksheet.getCharts().get(columnIndex)
# Set the legend can be showed
chart.setShowLegend(True)
# Set the chart title name
chart.getTitle().setText("Combo Chart")
# Set the Legend at the bottom of the chart area
chart.getLegend().setPosition(LegendPositionType.BOTTOM)
# Set data range
chart.setChartDataRange("A2:E11", True)
# Set category data
chart.getNSeries().setCategoryData("A2:A11")
#get the first Series
firstSeries = chart.getNSeries().get(0)
# Set the chart type
firstSeries.setType(ChartType.LINE)
# Set style for the border of first series
firstSeries.getBorder().setStyle(LineType.SOLID)
# Set Color for the first series
firstSeries.getBorder().setColor(Color.fromArgb(165, 165, 165))
#get the second Series
secondSeries = chart.getNSeries().get(1);
# Set the chart type
secondSeries.setType(ChartType.LINE)
# Set style for the border of first series
secondSeries.getBorder().setStyle(LineType.SOLID)
# Set Color for the first series
secondSeries.getBorder().setColor(Color.fromArgb(255, 192, 0))
#get the third Series
thirdSeries = chart.getNSeries().get(2)
thirdSeries.getArea().setForegroundColor(Color.fromArgb(91, 155, 213))
#get the fourth Series
fourthSeries = chart.getNSeries().get(3)
fourthSeries.getArea().setForegroundColor(Color.fromArgb(237, 125, 49))
chart.getPlotArea().getArea().setFormatting(FormattingType.NONE)
chart.getPlotArea().getBorder().setVisible(False)
chart.getSeriesAxis().getAxisLine().setVisible(False)
chart.getValueAxis().getAxisLine().setVisible(False)
chart.getCategoryAxis().getAxisLine().setVisible(False)
chart.getChartArea().getBorder().setColor(Color.fromArgb(217, 217, 217))
chart.getValueAxis().getMajorGridLines().setColor(Color.fromArgb(217, 217, 217))
# Save the Excel file
workbook.save("out_python_via_java.xlsx")
jpype.shutdownJVM()
Hope helps a bit.