Setting the callout data label shape to rectangle and remove line border

Hi,

I would like to change the shape of some callout data labels “Rectangle” as you do by right clicking on the data callout and selecting “change data label shapes”

I would also like to remove the line border of the rectangle shape

Is this possible in aspose java for slides?

Thanks,
Andy

@andysteady,

I have observed your requirements and request you to please share a sample presentation with actual callout shape and desired callout shape. I will be able to investigate your requirement further on my end on provision of requested information.

Hi,

Here is what I want it to look like:

image.png (86.3 KB)

Here is sample code:

IChart chart = donutChart = slide.getShapes().addChart(ChartType.Doughnut,
Utils.getPixelValue(6.23f),//x
Utils.getPixelValue(2.36f),//y
Utils.getPixelValue(17.96f),//width
Utils.getPixelValue(16.19f), false);//height

IChartDataWorkbook workBook = chart.getChartData().getChartDataWorkbook();
chart.getChartData().getSeries().clear();
chart.getChartData().getCategories().clear();
chart.setLegend(false);

ArrayList mySeries = new ArrayList();
int seriesIndex = 0;
while (seriesIndex < 15) {

  IChartSeries series = chart.getChartData().getSeries().add(workBook.getCell(0, 0, seriesIndex+1, "SERIES "+seriesIndex),chart.getType());
  series.setExplosion(0);
  series.getParentSeriesGroup().setDoughnutHoleSize((byte)20);
  series.getParentSeriesGroup().setFirstSliceAngle(351);
  seriesIndex++;

}

int categoryIndex = 0;
while (categoryIndex < 15) {
chart.getChartData().getCategories().add(workBook.getCell(0, categoryIndex+1, 0, "CATEGORY "+categoryIndex));
int i = 0;
while (i < chart.getChartData().getSeries().size()) {
IChartSeries iCS = chart.getChartData().getSeries().get_Item(i);
IChartDataPoint dataPoint = iCS.getDataPoints().addDataPointForDoughnutSeries(workBook.getCell(0, categoryIndex+1, i+1, 1));
dataPoint.getFormat().getFill().setFillType(FillType.Solid);
dataPoint.getFormat().getLine().getFillFormat().setFillType(FillType.Solid);
dataPoint.getFormat().getLine().getFillFormat().getSolidFillColor().setColor(Color.WHITE);
dataPoint.getFormat().getLine().setWidth(1);
dataPoint.getFormat().getLine().setStyle(LineStyle.Single);
dataPoint.getFormat().getLine().setDashStyle(LineDashStyle.Solid);

  		//call out labels just on the outer ring
  		if (i==chart.getChartData().getSeries().size()-1) {
  			IDataLabel lbl = dataPoint.getLabel();
  			lbl.getTextFormat().getTextBlockFormat().setAutofitType(TextAutofitType.Shape);
  			lbl.getDataLabelFormat().getTextFormat().getPortionFormat().setFontBold(NullableBool.True);
  			lbl.getDataLabelFormat().getTextFormat().getPortionFormat().setLatinFont (new FontData("DINPro-Bold"));
  			lbl.getDataLabelFormat().getTextFormat().getPortionFormat().setFontHeight(12); 
  			lbl.getDataLabelFormat().getTextFormat().getPortionFormat().getFillFormat().setFillType (FillType.Solid );
  			lbl.getDataLabelFormat().getTextFormat().getPortionFormat().getFillFormat().getSolidFillColor().setColor(Color.LIGHT_GRAY);
  			lbl.getDataLabelFormat().getFormat().getLine().getFillFormat().getSolidFillColor().setColor(Color.WHITE);
  			lbl.getDataLabelFormat().setShowValue(false);
  			lbl.getDataLabelFormat().setShowCategoryName(true);
  			lbl.getDataLabelFormat().setShowSeriesName(false);
  			lbl.getDataLabelFormat().setShowLabelAsDataCallout(true);
  			lbl.getDataLabelFormat().setShowLeaderLines(true);
  			//lbl.getDataLabelFormat().getPosition();
  		}
  		i++;
  	}
  categoryIndex++;

}

Generated chart looks like this:

image.png (36.7 KB)

Notice that I moved the label for category 13 so you can see the leader line.
Don’t worry about colours and fonts I can do that.

Challenges are:

  1. How can I change the data callout shape to rectangle
  2. How can I then get rid of the line that makes a border around the rectangle so all you see is the text
  3. How can I move the data callout outside the donut (I guess I can use the setPosition) for this but I haven’t tried yet

This is how to change the callout shape in PowerPoint:

change-data-callout-shape.png (45.8 KB)

Any help much appreciated

Thanks,
Andy

@andysteady,

I have observed your requirements and regret to share that at present the support for setting callout shape for chart data label is unavailable in API. An issue with ID SLIDESJAVA-37272 has been added in our issue tracking system as new feature request to provide requested support. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

The issues you have found earlier (filed as SLIDESJAVA-37272) have been fixed in this update.