TOC : Script API > JavaScript > JavaScript API > ChartObject > ChartLabel > Method >

 

GetPreferedWidth

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

TOC : Script API > JavaScript > JavaScript API > ChartObject > ChartLabel > Method >

 

GetPreferedWidth

 

 

Get the preferred width (the minimum width needed to accommodate the displayed text) for the ChartLabel.

 

 

 

Prototype :

 

float GetPreferedWidth

(

       No Arguments

)

 

 

 

Reference :

 

GetPreferedWidth() function can be used only for a data label got by GetLabel function of ChartPiece.

 

 

 

Example :

 

var ChartRootUnit = This.GetChartRootUnit();

var ChartShapeCnt = ChartRootUnit.GetShapeCount();

for(i = 0; i < ChartShapeCnt; i++) {

  var ChartShape = ChartRootUnit.GetShape(i);

  var ChartPieceCnt = ChartShape.GetPieceCount();

  for(j = 0; j < ChartPieceCnt; j++) {

     var ChartPiece = ChartShape.GetPiece(j);

     var ChartPieceLabel = ChartPiece.GetLabel();

     if(ChartPieceLabel != null) {

        _TraceLn(ChartPieceLabel.GetPreferedWidth());

     }

  }

}

 

 

 

Available Events :

 

OnPostChartBuild