[GH-ISSUE #186] Align X Axis labels #152

Closed
opened 2026-05-05 11:47:46 -06:00 by gitea-mirror · 8 comments
Owner

Originally created by @j15e on GitHub (Jun 14, 2018).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/186

Originally assigned to: @jmcnamara on GitHub.

It looks like axis labels alignement (c:lblAlgn) is hardcoded to ctr (center).

I would like to know if there is a way to change this property with the current library that I am not aware of? Or it would require a new feature on the chart writer?

Here are the revelant parts :

1 - An axis is created :
b616fb59ff/src/chart.c (L4028-L4032)

2 - A c:lblAlgn element is added :
b616fb59ff/src/chart.c (L4093-L4094)

3 - Element is added with ctr value :
b616fb59ff/src/chart.c (L3204-L3215)

PS I have been using your library with https://github.com/Paxa/fast_excel, I must say a big thanks, this is pretty well done!

Originally created by @j15e on GitHub (Jun 14, 2018). Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/186 Originally assigned to: @jmcnamara on GitHub. It looks like axis labels alignement (`c:lblAlgn`) is hardcoded to `ctr` (center). I would like to know if there is a way to change this property with the current library that I am not aware of? Or it would require a new feature on the chart writer? Here are the revelant parts : 1 - An axis is created : https://github.com/jmcnamara/libxlsxwriter/blob/b616fb59ffe0268b1ee0cecf822bf8ed45cf4f30/src/chart.c#L4028-L4032 2 - A `c:lblAlgn` element is added : https://github.com/jmcnamara/libxlsxwriter/blob/b616fb59ffe0268b1ee0cecf822bf8ed45cf4f30/src/chart.c#L4093-L4094 3 - Element is added with `ctr` value : https://github.com/jmcnamara/libxlsxwriter/blob/b616fb59ffe0268b1ee0cecf822bf8ed45cf4f30/src/chart.c#L3204-L3215 PS I have been using your library with https://github.com/Paxa/fast_excel, I must say a big thanks, this is pretty well done!
gitea-mirror 2026-05-05 11:47:46 -06:00
Author
Owner

@jmcnamara commented on GitHub (Jun 14, 2018):

That internal property may not be what you think it is.

What specific feature in Excel do you wish to change?

<!-- gh-comment-id:397457790 --> @jmcnamara commented on GitHub (Jun 14, 2018): That internal property may not be what you think it is. What specific feature in Excel do you wish to change?
Author
Owner

@j15e commented on GitHub (Jun 14, 2018):

The alignment of labels on the X axis like this :
unnamed-7

<!-- gh-comment-id:397458232 --> @j15e commented on GitHub (Jun 14, 2018): The alignment of labels on the X axis like this : ![unnamed-7](https://user-images.githubusercontent.com/143380/41441556-1d4c27d2-7001-11e8-8dc8-f804023cb1cc.png)
Author
Owner

@j15e commented on GitHub (Jun 14, 2018):

We want to do this to align the labels when creating an histogram, to make it clear the label is for the end of each histogram bucket (ex. the last column represent >725 to 750, not 750 to 775).

<!-- gh-comment-id:397458776 --> @j15e commented on GitHub (Jun 14, 2018): We want to do this to align the labels when creating an histogram, to make it clear the label is for the end of each histogram bucket (ex. the last column represent >725 to 750, not 750 to 775).
Author
Owner

@jmcnamara commented on GitHub (Jun 14, 2018):

Ok. Got it.

That isn't currently supported. I'll need to put it into the Python and Perl versions first and then port it across. Your patch looks okay though so you can use that in the meantime.

<!-- gh-comment-id:397461041 --> @jmcnamara commented on GitHub (Jun 14, 2018): Ok. Got it. That isn't currently supported. I'll need to put it into the Python and Perl versions first and then port it across. Your patch looks okay though so you can use that in the meantime.
Author
Owner

@j15e commented on GitHub (Jun 14, 2018):

Thanks, I hope my patch help implementing Python and Perl versions.

<!-- gh-comment-id:397463437 --> @j15e commented on GitHub (Jun 14, 2018): Thanks, I hope my patch help implementing Python and Perl versions.
Author
Owner

@jmcnamara commented on GitHub (Sep 1, 2018):

Added in version 0.7.9.

<!-- gh-comment-id:417889973 --> @jmcnamara commented on GitHub (Sep 1, 2018): Added in version 0.7.9.
Author
Owner

@jmcnamara commented on GitHub (Sep 2, 2018):

P.S. I changed the function name and enums slightly to make them consistent (or equally inconsistent) with existing code. See the changes in f7f32de

<!-- gh-comment-id:417931760 --> @jmcnamara commented on GitHub (Sep 2, 2018): P.S. I changed the function name and enums slightly to make them consistent (or equally inconsistent) with existing code. See the changes in f7f32de
Author
Owner

@j15e commented on GitHub (Sep 4, 2018):

Thanks for the hint, I will update my code accordingly when going back to the official repo. 👍

<!-- gh-comment-id:418386236 --> @j15e commented on GitHub (Sep 4, 2018): Thanks for the hint, I will update my code accordingly when going back to the official repo. 👍
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/libxlsxwriter#152
No description provided.