ag-charts

How can I display all labels on the x-axis in Ag-Charts?


I want to ensure that all labels on the x-axis are visible, but the labels at both ends are sometimes cut off.

I'm using ag-charts-community version 11.3.2 in a Vue 3 environment.
(The same issue also occurs in the latest version, 12.0.0.)
Here is a Plunker example

I found that adding a small amount of right padding makes the labels appear, but since label lengths can vary, I’d like to find a way to automatically ensure all labels are fully visible without relying on manual padding.


Solution

  • You've asked this at https://github.com/ag-grid/ag-charts/issues/4606 and I've responded there with an example of https://plnkr.co/edit/KUIMbVpydQabuKTa where manual padding is utilised.

    Additionally, I have modified your example to used our unit-time axis and Date objects - see https://www.ag-grid.com/charts/javascript/axes-time/ for more information about this.

    As mentioned there, we have a feature request on our backlog for automatic padding.

    You can track it on our pipeline with this reference:
    AG-8163 - [Charts] Allow automatic series area padding if necessary

    Thanks

    David