Aspose chart Align axis x values to the left

@Tati2895,

Thank you for providing the sample files and code snippet.

I am currently evaluating your issue/requirements. However, could you please open the file “outputAsposeCells.xlsx” in MS Excel and adjust the axis labels to align them as per your desired alignment for the x-axis labels? After making the adjustments, please resave the file and provide it to us again. Additionally, please specify and provide details on the “Format Axis” and “Alignment” attributes or properties that you manually set for the chart in MS Excel to achieve your desired alignment for the x-axis values/labels. This information will assist us in evaluating and addressing your requirements using Aspose.Cells APIs. I attempted to use various chart options in MS Excel manually, but I was unable to achieve the desired alignment for the x-axis values/labels.

what I did manually was that I selected the axis area and in the excel ribbon options in the alignment area I selected align left.
image.png (53.4 KB)
outputAsposeCells.zip (10.8 KB)

@Tati2895,

Thanks for the sample file and screenshot.

I tried a bit but I could not accomplish the task using Aspose.Cells APIs. Apparently, I could not find relevant APIs to align chart category axis (x-axis) labels to left as per your desired output chart.

We need to evaluate your issue/requirements in details. We have opened the following new ticket(s) in our internal issue tracking system and will give you (updated) code snippet or deliver a fix/supported version according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSNET-55137

Once we have an update on it, we will let you know here.

@Tati2895
Thanks for your help!
We have supported this feature with Chart.CategoryAxis.TickLabels.AlignmentType property and will release it in the next version 24.3.

1 Like

The issues you have found earlier (filed as CELLSNET-55137) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi

I updated the version of the library and made the implementation of the new feature , it works if I save the excel but when I convert the graphic to an image does not take that change.
I have attached the excel and Image here along with the changes made in the code.

CodeImage.png (175.8 KB)

CodeImg.png (74.0 KB)

Excel.png (152.9 KB)

image.png (148.6 KB)

@jshelkme,

Thanks for the screenshots.

Could you please share the following, so we can evaluate your issue accurately on our end:

  • A sample (standalone) console app or sample code (source code without compilation errors)
  • Input Excel file (if any)
  • Output Excel file with desired chart results
  • Output image file with undesired results

After receiving the resource files and artifacts, we will start investigating the issue and handling it accordingly.

PS. Please zip the resource files before attaching them here.

hello, I have attached resource files and artifacts you need for investigation.

POCAsposeOpenXMLoutput.7z (9.1 KB)

POCAsposeOpenoutput.png (9.6 KB)

POCAsposeOpenXML.zip

@Tati2895
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSNET-55819

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Hi @jshelkme
We optimized this problem and the results are shown in the following image.
It will take effect in Aspose.Cells 24.6 and is expected to be released next week.
240606.png (6.9 KB)

Hii @leoluo
I needed access for this, I am not able to download the image.

@jshelkme
The image is mailed to you.
This post is not yours, so you only can view the post .
If you has any other issue, please create a new topic.

The issues you have found earlier (filed as CELLSNET-55819) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi

Hii…I am having issue with the tickmarks in the graph ,they should align with the starting edge of the bar but currently they are aligning at left side of the bar. I have attached the expected graph image with my current output graph image .
ExpectedGraphImage.png (77.0 KB)

CurrentoutputImg.png (16.1 KB)

@jshelkme
Would you like to provide your sample file and test code? We will check it soon.

image.png (6.2 KB)

Hiii…I have attached my sample code in our last conversastion ‘POCAsposeOpenXml.zip’. Currently I am using same code for the graph .

@jshelkme
In this post, you uploaded a sample file “POCAsposeOpenXMLoutput.7z”. When we opened it in Excel, we found that it was different from your expected result image “ExpectedGraphImage.png”. Would you like to upload your test sample file? If you could take a screenshot and highlight the incorrect area, it would be very helpful for us to locate the issue. We will check it soon.

@John.He
I have attached the my current output Excel and Image file of the graph and highlighted the incorrect area with circle, also attached the expected Graph Image “ExpectedGraphImage.png”.
ExpectedGraphImage.png (77.0 KB)

CurrentOutputGraphImg.png (14.6 KB)

CurrentGraphXlsx.png (73.5 KB)

@jshelkme
Due to the discrepancy between your expected image “ExpectedGraphImage. png” and the other two images, I am still unable to distinguish your true needs.
Do you want to place the numbers on the left side of the short vertical line? Please refer to the image. result.jpg (84.6 KB)
If that’s the requirement, would you like to share an Excel file of the expected image? We will further investigate how to achieve this display.

Sorry for any inconvenience caused to you.

@jshelkme
We adjusted the position of the numbers by testing with the following example code. Please refer to the attachment. result.zip (36.4 KB)

The sample code as follows:

Workbook book = new Workbook(filePath + "POCAsposeOpenXMLoutput.xlsx");
Chart chart = book.Worksheets[0].Charts[0];
chart.CategoryAxis.TickLabels.AlignmentType = TickLabelAlignmentType.Center;
chart.CategoryAxis.AxisBetweenCategories = false;
book.Save(filePath + "POCAsposeOpenXMLoutput_result.xlsx");

chart.ToImage(filePath + "out_result.png");

After further research, we found that the position of Tick Marks cannot be adjusted, so the position of Tick Marks on the left side of a single bar in the image you provided cannot be achieved in Excel. If you still have questions, please provide your sample file. If you can take a screenshot and highlight how to set the position of Tick Marks, it will be very helpful for us to locate the issue and implement the requirements.