I am not sure which programming language you are using, so I will just C# as an example is:
for (int i = 0; i < myData.Length; ++i)
// Display labels if they are not zero and within 3 bars from the end points
if ((myData[i] != 0) || (i >= 3) || (i < myData.Length - 3))
myBarLayer.addCustomAggregateLabel(i, "" + myData[i], "Arial", 10, 0x333333);
The "if" is the condition under which the labels should be displayed. You can modify it to fit you need.
Thanks for the great forum and your fast answers. Always to the point!
PS: I am using the COM-based edition and looking forward to get the coming 7.0 edition. Great news these CDML enhancements (rounded borders and grammar available for legend items)! I also definitely appreciate that fonts can be called by names.