<< Click to Display Table of Contents >> Navigation: »No topics above this level« TOC : Script API > JavaScript > JavaScript API > ChartObject > ChartLabel > Method >ApplyFormat |
Apply format to a component.
Prototype :
void ApplyFormat
(
No Arguments
)
Reference :
Use ApplyFormat() to apply your format to a bound component. Get a component object and set your format by SetFormat() and then apply the format using ApplyFormat().
If a format has already been set by the display format or script of the component, this function can result in pattern error according to the previously set format.
And if call ApplyFormat() after setting the format of unbound component or it self by the display format or SetFormat(), it applies the format twice after all and pattern error can occurs according to the previously set format.
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) {
ChartPieceLabel.SetFormat("#,###;-#,###");
ChartPieceLabel.ApplyFormat();
}
}
}
Available Events :
OnPostChartBuild
For the object returned by GetLabel function of a ChartPiece, the function can be called only in OnPostChartBuild event.
See also :