Color transparency

Hi ,

i can’t find in aspose how to set a color transparency for the sector in the chart ( pie or bar).

for the pie i already tried to get a a slice and set the transparency like this :

chart.getNSeries().get(0).getPoints().get(0).getArea().setTransparency(0.7);
but it didn’t work.

in the attached file an example that i need to create with aspose.


i also need to know how to get the 3D format option (bevel , Material) i tried to this but it didn’t work.


com.aspose.cells.Format3D form = chart.getNSeries().get(0).getShapeProperties().getFormat3D();
form.setSurfaceMaterialType(PresetMaterialType.CLEAR);
Bevel bv = form.getTopBevel();
bv.setHeight(10);
bv.setType(BevelPresetType.CIRCLE);


Hi,

Please download and try the latest version:
Aspose.Cells
for Java v7.1.2.2

and see if it resolves your problem.

Please try saving it in xlsx format. I have check it, transparency issue does not occur when you save in xlsx format.

Please also see this thread for more help.
Neither FormatSetType.None nor Transparency Working

If the problem still occurs with xls or xlsx format, then provide me a sample application replicating the problem, we will look into it and fix the problems.

i tried to do the same code in the topic that u gave me but it didn’t work netheir when saving xlsx or xls.

i did exactly this :

//Create a new Workbook.

Workbook workbook = new Workbook();


//Get the first worksheet.

Worksheet sheet = workbook.getWorksheets().get(0);


//Set the name of worksheet

sheet.setName(“Data”);


//Get the cells collection in the sheet.

Cells cells = workbook.getWorksheets().get(0).getCells();


//Put some values into a cells of the Data sheet.

cells.get(“A1”).setValue(“Region”);

cells.get(“A2”).setValue(“France”);

cells.get(“A3”).setValue(“Germany”);

cells.get(“A4”).setValue(“England”);

cells.get(“A5”).setValue(“Sweden”);

cells.get(“A6”).setValue(“Italy”);

cells.get(“A7”).setValue(“Spain”);

cells.get(“A8”).setValue(“Portugal”);

cells.get(“B1”).setValue(“Sale”);

cells.get(“B2”).setValue(70000);

cells.get(“B3”).setValue(55000);

cells.get(“B4”).setValue(30000);

cells.get(“B5”).setValue(40000);

cells.get(“B6”).setValue(35000);

cells.get(“B7”).setValue(32000);

cells.get(“B8”).setValue(10000);


//Add a chart sheet.

int sheetIndex = workbook.getWorksheets().add(SheetType.CHART);

sheet = workbook.getWorksheets().get(sheetIndex);


//Set the name of worksheet

sheet.setName(“Chart”);


//Create chart

int chartIndex = sheet.getCharts().add(ChartType.PIE_3_D,1,1,25,10);

Chart chart = sheet.getCharts().get(chartIndex);


//Set some properties of chart plot area.

//to set the fill color and make the border invisible.

// chart.getPlotArea().getArea().setForegroundColor(Color.getCyan());
//
// chart.getPlotArea().getArea().getFillFormat().setTwoColorGradient(Color.getYellow(), Color.getWhite(), GradientStyleType.VERTICAL, 2);

chart.getPlotArea().getBorder().setVisible(false);
chart.getPlotArea().setHeight(3000);
chart.getPlotArea().setWidth(3000);
chart.setHeightPercent((short) 100);
// chart.setDepthPercent(500);


//Set properties of chart title

chart.getTitle().setText(“Sales By Region”);

chart.getTitle().getTextFont().setColor(Color.getBlue());

chart.getTitle().getTextFont().setBold(true);

chart.getTitle().getTextFont().setSize(12);


//Set properties of nseries

chart.getNSeries().add(“Data!B2:B8”, true);

chart.getNSeries().setCategoryData(“Data!A2:A8”);


//Set the DataLabels in the chart

DataLabels datalabels = null;

int i = 0;

for (i = 0; i < chart.getNSeries().getCount(); i++)

{


datalabels = chart.getNSeries().get(i).getDataLabels();

datalabels.setPosition(LabelPositionType.OUTSIDE_END);

datalabels.setShowCategoryName(true);

datalabels.setShowValue(true);

datalabels.setShowPercentage(true);


}

chart.getNSeries().get(0).getArea().setFormatting(com.aspose.cells.FormattingType.CUSTOM);

chart.getNSeries().get(0).getArea().setTransparency(1.0);


//Set the ChartArea.

ChartArea chartarea = chart.getChartArea();

chartarea.getArea().getFillFormat().setTexture(TextureType.BLUE_TISSUE_PAPER);


//Set the Legend.

Legend legend = chart.getLegend();

legend.getTextFont().setBold(true);

legend.getBorder().setColor(Color.getBlue());
legend.getTextFont().setName(“ffffff”);

//Set FillFormat.

FillFormat fillformat = legend.getArea().getFillFormat();

fillformat.setTexture(TextureType.BOUQUET);

com.aspose.cells.Format3D form = chart.getNSeries().get(0).getShapeProperties().getFormat3D();
form.setSurfaceMaterialType(PresetMaterialType.CLEAR);
Bevel bv = form.getTopBevel();
bv.setHeight(10);
bv.setType(BevelPresetType.CIRCLE);

workbook.save(“C:\Users\ark\Desktop\ASPOSE CELL\tests_examples\” + “CELLSJAVA-HelloWorld.xls”);



although when i save with xlsx i can see that the PresetMaterialType and the Bevel works fine.


Hi,

Thanks for your feedback and using the latest version.

We have logged this issue in our database. We will look into and get back to you asap.

This issue has been logged as CELLSJAVA-40160.

Hi,


We have evaluated your feature/issue a bit. Since the Transparency and 3D fill are advanced features since the release of Office 2007 and at the moment, we only support them in XLSX file format, not support them in XLS file format, so it will take some time to support it in XLS file format for your needs.

We hope we can support them in XLS file format in Q3 2012.


Thanks for your understanding!

thanks for your quik response and for the great work that u do.


we will introduce the transparency for xls as soon as you do it in the next update although the transparency is not working even in xlsx 2007. i tried with this code but it didn’t work.if it’s possible to give me a simple code that works because when i try to do this :

chart.getNSeries().get(0).getArea().setForegroundColor(Color.getRed());

chart.getNSeries().get(0).getArea().setFormatting(com.aspose.cells.FormattingType.CUSTOM);

chart.getNSeries().get(0).getArea().setTransparency(1.0);

all i get from that the bar column is in black.

i also apply the the code that you advice me to see in this topic but it didn’t work

Neither FormatSetType.None nor Transparency Working


all i get is the black color

thanks

Hi,


Thanks for sharing the code and feedback.

Well, yes, we can see the series slices are in red but the transparency is not applied properly even in XLSX file format. I have tested your code. We need to analyze and look into it if this is an issue or something else. We will get back to you soon.

Thank you.

Hi,

Firstly, we cannot find the issue of black color. After running your code we can get the chart series filled with red color. Please see attached xlsx file generated with your code.

Secondly, the transparency also has been set to the chart series’ area. It is Ms Excel’s behavior that the area is not transparent even with transparency value 100% when format3D was set.

To get the transparency take effect, please do not set the format3d.

For your code, please remove the part:

form.setSurfaceMaterialType(PresetMaterialType.CLEAR);


Hi,


The output file attached to the previous post is the result of our latest fix (currently in the testing phase and is not published for the users). We will attach this fix before the end of this week for you after evaluating your issue thoroughly and other features and enhancements.

Thanks for your understanding and sorry for the confusion.


thanks for the big help that u give for your client that i’m one of them.

even if i remove the format3D part the COLOR transparency is not working but i want exactly the code for the output that u put in the attached file. i noticed that the transparency color take effect.
i will wait for the end of the week to get the fix that u described.
thanks

Hi,

Please download and use the latest fix: Aspose.Cells for Java v7.1.2.5

We have fixed the issue of transparency for saved xlsx file.