Possible to rotate chart data label a custom angel?

Posted by Yesi under C# on 4/17/2015 | Points: 10 | Views : 1356 | Status : [Member] | Replies : 1
In Excel 2013, in a generated chart ,any possible way to set the label a custom angel? the label is too long ,I want to show it as a slant angel.
Any possible way? Thank U.




Responses

Posted by: Hitu on: 4/17/2015 [Member] Starter | Points: 25

Up
0
Down
You can set it through change the alignment of format data label. Download this XlS library http://www.e-iceblue.com/Introduce/excel-for-net-introduce.html and try the code below:
foreach (Spire.Xls.Charts.ChartSerie cs in chart.Series)
{
//Set vary color of the chart
cs.Format.Options.IsVaryColor = true;
//Set Gap Width
cs.Format.Options.GapWidth = 0;
//Set the value is visible on the chart
cs.DataPoints.DefaultDataPoint.DataLabels.HasCategoryName = true;
cs.DataPoints.DefaultDataPoint.DataLabels.TextRotationAngle = 270;// <------ Used to rotate the DataLabel Text
cs.DataPoints.DefaultDataPoint.DataFormat.BarType = BaseFormatType.Rectangle;
cs.DataPoints.DefaultDataPoint.DataLabels.VerticalAlignment = FontVertialAlignmentType.Baseline;
cs.DataPoints.DefaultDataPoint.DataLabels.Position = DataLabelPositionType.OutsideBase;
}


Yesi, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response