Free Support Forum - aspose.com

In bubble chart how to set label name of each bubble to category name


#1

Hi. While setting it by setValueFromCell it’s always showing y-values of each bubble.

private static void populateBrandPerfMeaningfulDifferentSailentData(IShapeCollection shapes, String chartNum,
List marketOverviewVOList,boolean isShareChgPresent,String timePeriod) {

          IChart chart =((IChart) shapes.get_Item(Integer.parseInt(standardReportProperties.getProperty(chartNum))));
          IChartDataWorkbook wb = chart.getChartData().getChartDataWorkbook();
          int rowIndex=1;
          
          Double horizontalMinValue=Double.MAX_VALUE;
          Double horizontalMaxValue=Double.MIN_VALUE;
          Double verticalMinValue=Double.MAX_VALUE;
          Double verticalMaxValue=Double.MIN_VALUE;
          
          String []time=geTFormmatedTimePriod(timePeriod);
          
          if(marketOverviewVOList!=null & !marketOverviewVOList.isEmpty()){

                 IChartData chartData = chart.getChartData();
                 IChartSeries series = chartData.getSeries().get_Item(0);
                 chartData.getCategories().clear();
          //series.getLabels().getDefaultDataLabelFormat().setShowValue(true);
                 wb.getCell(0, 0,0).setValue(time[0]);
                 for(MarketOverViewReportVO marketOverviewVO:marketOverviewVOList){
                       chartData.getCategories().add(wb.getCell(0, rowIndex, 0,marketOverviewVO.getCategory()));
                       List<BrandDataReportVO> brandData=marketOverviewVO.getBrandDatareportVO();                       
                       series.getDataPoints().get_Item(rowIndex-1).getXValue().setData(getFormattedValue(brandData.get(0).getWtShare(),1));
                       series.getDataPoints().get_Item(rowIndex-1).getYValue().setData(getFormattedValue(brandData.get(1).getWtShare(),1));
                       series.getDataPoints().get_Item(rowIndex-1).getBubbleSize().setData(getFormattedValue(brandData.get(2).getWtShare(),1));
                       
                       //series.getDataPoints().get_Item(rowIndex-1).getLabel().getDataLabelFormat().setShowValue(true);
                       
                       series.getDataPoints().get_Item(rowIndex-1).getLabel().setValueFromCell(wb.getCell(0,rowIndex,0));
                       series.getDataPoints().get_Item(rowIndex-1).getLabel().getDataLabelFormat().setShowLabelValueFromCell(true);
                       //series.getDataPoints().get_Item(rowIndex-1).getLabel().getDataLabelFormat().setShowLabelValueFromCell(true);
                       //series.getDataPoints().get_Item(rowIndex-1).getLabel().getDataLabelFormat().setShowValue(true);
                 /*     series.getLabels().get_Item(rowIndex-1).setValueFromCell(wb.getCell(0,rowIndex,0));
                       series.getLabels().get_Item(rowIndex-1).getDataLabelFormat().setShowValue(true);
                       series.getLabels().get_Item(rowIndex-1).getDataLabelFormat().setShowCategoryName(true);*/
                       rowIndex++;                              
                 }
          
                 for(MarketOverViewReportVO marketData:marketOverviewVOList){                           
                       Double meaningfulData= getFormattedValue(marketData.getBrandDatareportVO().get(0).getWtShare(),1);
                       Double differenceData= getFormattedValue(marketData.getBrandDatareportVO().get(1).getWtShare(),1);
                       if(meaningfulData<horizontalMinValue)
                              horizontalMinValue=meaningfulData;
                       if(meaningfulData>horizontalMaxValue)
                              horizontalMaxValue=meaningfulData;
                       if(differenceData<verticalMinValue)
                              verticalMinValue=differenceData;
                       if(differenceData>verticalMaxValue)
                              verticalMaxValue=differenceData;
                 }
                 
                 Double chartXmax=Math.round(((horizontalMaxValue*1.5)*10))/10.0;
                 Double chartXmin=Math.round(((horizontalMinValue/1.5)*10))/10.0;
                 Double chartYmax=Math.round(((verticalMaxValue*1.5)*10))/10.0;
                 Double chartYmin=Math.round(((verticalMinValue/1.5)*10))/10.0;
                       
          chart.getChartData().getSeries().get_Item(0).getChart().getAxes().getVerticalAxis().setMinValue(chartYmin);
          chart.getChartData().getSeries().get_Item(0).getChart().getAxes().getVerticalAxis().setMaxValue(chartYmax);
          chart.getChartData().getSeries().get_Item(0).getChart().getAxes().getHorizontalAxis().setMinValue(chartXmin);
          chart.getChartData().getSeries().get_Item(0).getChart().getAxes().getHorizontalAxis().setMaxValue(chartXmax);                     
          }
   }

bubble.zip (1.5 MB)


#2

@sagar465,

Can you please share expected result so that we may further investigate to help you out. Also please share your generated result.


#3
  1. Instead of y-value ie., different_column from associated excel with chart >
    Need to display category name ie ., A or B… present in first column of excel

  2. Also when I make some changes in excel it should reflect here on bubble label or size or co-ordinates

each time I made something only y-values got populatedStandardReport (2).zip (162.6 KB)


#4

@sagar465,

I have worked with source file shared by you using Aspose.Slides for Java 19.4 and have been able to observe issue. A ticket with ID SLIDESJAVA-37639 has been created in our issue tracking system to further investigate issue in detail. This thread has been linked with issue so that you may be automatically notified once issue will be fixed.