We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Legen Hide is not Working

Hi,


When we set datapoint to some new color then Legend Hide is not working.
Can you help us to reach there ?
Following is the sample code…


IChart chart = presentation.getSlides().get_Item(0).getShapes().addChart(ChartType.Doughnut, 0, 0, 200, 200);
chart.getChartData().getSeries().clear();
chart.getChartData().getCategories().clear();
// Add new series
IChartDataWorkbook fact = chart.getChartData().getChartDataWorkbook();
chart.getChartData().getSeries().add(fact.getCell(0, 0, 1, “Series 1”), chart.getType());
chart.getChartData().getCategories().add(fact.getCell(0, 1, 0, “Quarter 1”));
chart.getChartData().getCategories().add(fact.getCell(0, 2, 0, “Quarter 2”));
chart.getChartData().getCategories().add(fact.getCell(0, 3, 0, “Quarter 3”));
IChartSeries series = chart.getChartData().getSeries().get_Item(0);
IChartDataPoint dataPoint=series.getDataPoints().addDataPointForDoughnutSeries(fact.getCell(0, 1, 1, 30));
dataPoint.getLabel().getDataLabelFormat().setShowValue(true);
dataPoint.getLabel().getDataLabelFormat().getTextFormat().getPortionFormat().setFontHeight(8f);
dataPoint.getFormat().getFill().setFillType(FillType.Solid);
dataPoint.getFormat().getFill().getSolidFillColor().setColor(Color.CYAN);
dataPoint.getRelatedLegendEntry().setHide(true);

dataPoint=series.getDataPoints().addDataPointForDoughnutSeries(fact.getCell(0, 2, 1, 50));
dataPoint.getLabel().getDataLabelFormat().setShowValue(true);
dataPoint.getLabel().getDataLabelFormat().getTextFormat().getPortionFormat().setFontHeight(8f);
dataPoint.getFormat().getFill().setFillType(FillType.Solid);
dataPoint.getFormat().getFill().getSolidFillColor().setColor(Color.BLUE);
dataPoint.getRelatedLegendEntry().setHide(true);
// dataPoint.getRelatedLegendEntry().setHide(true);
dataPoint=series.getDataPoints().addDataPointForDoughnutSeries(fact.getCell(0, 3, 1, 20));
dataPoint.getLabel().getDataLabelFormat().setShowValue(true);

dataPoint.getLabel().getDataLabelFormat().getTextFormat().getPortionFormat().setFontHeight(8f);
dataPoint.getFormat().getFill().setFillType(FillType.Solid);
dataPoint.getFormat().getFill().getSolidFillColor().setColor(Color.GREEN);
// dataPoint.getRelatedLegendEntry().setHide(true);
dataPoint.getRelatedLegendEntry().setHide(true);
series.getRelatedLegendEntry().setHide(true);
for (int i =0 ;i<chart.getLegend().getEntries().getCount();i++) {
chart.getLegend().getEntries().get_Item(i).setHide(true);
}

chart.getChartData().getSeriesGroups().get_Item(0).setDoughnutHoleSize((byte) 50);

Hi,


I have observed your comments. Can you please confirm that you are trying to hide chart legend. Please share feedback with us. Also check attachments and confirm is this your desired results.

Best Regards,

Hi Adnan,


Thanks for your reply.
Yes i am trying to get the same output.
Also i want to hide the title.
can you please provide me help for that also.



Thanks

Hi,

I have observed your requirements and suggest you to please add following lines in your sample code.

chart.setLegend(false);
chart.setTitle(false);

I hope this will work.

Many Thanks,

Hi Fayyaz,


Thank you for the reply.
It is working as i wanted to.


Thanks

Hi,


You are very welcome.

Best Regards,