We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to set chart.series.dataLables.TextDirection to vertical?

I want to set the the textDirection to vertical with my chart series datalables,but i can only find TextDirection property to set ,which only have Context、LeftToRight、RightToLeft 3 enum can be choose.
Is there any way to set the datalable’s TextDirection to vertical or top to bottom?
just like this attached image:dire.png (32.2 KB)

@standheo,
We have logged the issue as “CELLSNET-47229” in our database for investigations. Once, we will have some news for you, we will update you in this topic.

@standheo,
Please set TickLabels.RotationAngle to achieve this requirement as follows:

Chart chart = workbook.Worksheets[0].Charts[0];
chart.CategoryAxis.TickLabels.RotationAngle = 90;

We will look into adding a new TickLabels.Direction enum which is same as MS Excel .

No,RotationAngle can’t achieve my requirement,as you can see:image.png (29.8 KB)
,what i want is like this:
image.png (26.9 KB)
as you can see,the datables text id difference.

@standheo,
Thank you for providing more information. We will investigate the enum same as MS Excel.

Wating for your new enum topToBottom.besides,my requirement is to set series datalables textdirection,not TickLabels,and i need to export this chart to picture.
I have find that i can insert textbox in the chart,which i can set textbox.TextOrientationType = TextOrientationType.TopToBottom,it seems achieved my requirement,but there is also some problem.when i set textbox.TextOrientationType = TextOrientationType,and textbox.Font.Name = “宋体”,the textbox’s text in the exported picture looks like bold and is not like my font setting.you can have a try to do this. i assume if there is some font you are not support when export to picture? or is there anything i can do to specify the font resource location?

And please refresh the status about this topic,in my opinion it should not be resolved.
image.png (1.5 KB)

@standheo,
The status of issue is resolved because we have supported the vertical property like MS Excel. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes. About font difference, you can set font with FontConfigs.SetFontFolder API. You can also see the document with example code for your reference:
https://docs.aspose.com/display/cellsnet/Configuring+Fonts+for+Rendering+Spreadsheets

I’m so suprised that you should add this feture so quickly! thank you! wating for your fixed version.

The issues you have found earlier (filed as CELLSNET-47229) have been fixed in Aspose.Cells for .NET v20.3. This message was posted using Bugs notification tool by Amjad_Sahi

@aspose.notifier @ahsaniqbalsidiqui I have download the latest Aspose.Cells for .NET v20.3,but as you can see,the TextDirectionType is still have these three enum,not include vertical you mentioned:TextDirectionType .png (9.1 KB) ,are you missing something?

@standheo,
We are gathering details. We will write back here soon to share our feedback.

@standheo,

We added DirectionType attribute to select from ChartTextDirectionType enum under TickLabels in Aspose.Cells for .NET v20.3, see the screenshot for the line of code:
sc_shot1.png (7.2 KB)

But what i need is chart.Nseries[0].Datalables.TextDirection= “vertical”,not ticklables.like this picture:
series.datalables.png (46.2 KB),not ticklables.and i have checked your release notes, it shows "CELLSNET-47229 Support for setting chart.series.dataLables.TextDirection to vertical New Feature
"image.png (11.1 KB)

@standheo,

Thanks for the screenshots.

Well, the ticket title is logged based on thread title, so it does not mean we follow your way when defining or updating APIs. We first check the feasibility of the newer APIs or its members. We got to analyze the scenario/case in details and then decide where to place/under which node the members would come. The labels you are referring to are ticklabels of category axis, so we find it suitable to add the newer enum (with members) under TickLabels (We also told this info in one of previous posts).

I’m sorry that i have not told you more detail,and here is the xlsx file i created by aspose.cells:samplexlsx.zip (11.1 KB)
,we called this chart updown column. in this chart i add two series,one is just normal column,but the other one i set it’s fill and border to none,and to set it’s datalables only show categoryName,so in my previous screenshot [series.datalables.png] (https://forum.aspose.com/uploads/discourse_instance3/36269) the chart just look like that.you may confused by my second series’s setting,but this is driving by my business. blow is my series and categoryAxis setting code:

chart.CategoryAxis.TickLabels.RotationAngle = 0;
chart.CategoryAxis.TickLabelPosition = TickLabelPositionType.None;

var s1 = chart.NSeries[0];
var s2 = chart.NSeries[1];
SetSeriesColor(chart, data);
s1.DataLabels.ShowValue = true;
s1.DataLabels.Position = LabelPositionType.OutsideEnd;
s1.Overlap = 100;

s2.SeriesLines.FormattingType = ChartLineFormattingType.None;
s2.Border.FormattingType = ChartLineFormattingType.None;
s2.Area.FillFormat.FillType = FillType.None;
s2.DataLabels.ShowValue = false;
s2.DataLabels.ShowCategoryName = true;
s2.DataLabels.IsTextWrapped = true;
s2.DataLabels.TextDirection = TextDirectionType.LeftToRight;
s2.DataLabels.TextVerticalAlignment = TextAlignmentType.Center;
here my question is,i need to change the s2.DataLabels.TextDirection to vertical,can you give me some help?

@standheo,
Could you please confirm the option in MS Excel as shown in the attached image?
DataLabelsTextDirection.png (182.3 KB)

yes,in my ms-excel,it shows textDirection:vertical.
verticalTextDirection1.png (34.4 KB)verticalTextDirection2.png (35.6 KB)

and here is my ms-excel version info
ms-excel2016 (15.2 KB)
i’m in china,and my ms-excel has installed Chinese language,maybe this is the reason why there has difference between your screenshots and mine?

@standheo,
Thank you for more information. We are analyzing it and will share our feedback soon.

@standheo,

Please try our latest version/fix: Aspose.Cells for .NET v20.3.1 (attached)

Your issue should be fixed in it. Please try DataLabels.DirectionType property.

Let us know your feedback.
Aspose.Cells20.3.1 For .Net2_AuthenticodeSigned.Zip (5.2 MB)
Aspose.Cells20.3.1 For .Net4.0.Zip (5.2 MB)