How can I format the x-axis in a time series diagram with many values nicely?
Asked by Mirko Klotz:

I'm using the standard diagram/chart macro from Confluence to display time series data in a line diagram. The data itself is queried from a database using the SQL macro.

When there are only few records in the resulting data table, the date labels are displayed nicely and readable on the x-axis (upper example "few values in x-axis").

But when there are my records (in my example almost 1000), the date labels are displayed overlapping each other, resulting in unreadable black bars (lower example "may values in x-axis").

![Confluence_timeseries.PNG](/t5/image/serverpage/image-id/57648i165DBB870B56AC31/image-size/large?v=v2&px=999 "Confluence_timeseries.PNG")

I've tried playing around with all the parameters you can configure there, but could not find a solution in a way, so that you can actually read these date labels. Of course not all 1000 of them, but at least the left-most and the right-most would be interesting and maybe a handful in the middle.

Any idea?


Answers:
author: Andrey Khaneev _StiltSoft_
body: Hi Mirko,

You can try to use [Chart from Table](https://docs.stiltsoft.com/display/public/TableFilter/How+to+use+Chart+from+Table+macro#HowtouseChartfromTablemacro-TimeLine/TimeAreachart) macro. It should show a human readable amount of ticks on the axis, or you can set it manually. This macro is a part of [Table Filter and Charts](https://marketplace.atlassian.com/apps/27447/table-filter-and-charts-for-confluence?hosting=cloud&tab=overview) app.

comments: author: Mirko Klotz
body: Hi Andrey,

thanks for your answer, but it seems like this "Chart from Table" macro does not work, when the table is produced dynamically by a SQL macro. At least Confluence is telling me, that it cannot add this macro when I click the according button and I should edit the page and insert the macro manually:

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/57659iB0E1BE365BCA13D3/image-size/large?v=v2&px=999 "image.png")

It does work with a static table and the result looks indeed good. But I cannot set the amount of ticks manually, there's just no configuration option for this:

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/57658iDBE81CFC4F1CCEFA/image-size/large?v=v2&px=999 "image.png")

But anyways, the possibility of generating charts based on database queries is the feature I'm mostly interested it, because this brings a lot of benefit. Doing this on static data wouldn't help me at all.


author: Andrey Khaneev _StiltSoft_
body: What SQL macro do you use?

It looks like it fails to insert the chart when viewing the page, but you can edit the page, add Chart from Table macro and put SQL macro within it.

Use "Scale X step" parameter to set tick size manually:

![2019-06-14_16h22_03.png](https://community.atlassian.com/t5/image/serverpage/image-id/57661i3005259A323E1C08/image-size/large?v=v2&px=999 "2019-06-14_16h22_03.png")


author: Mirko Klotz
body: I'm using the plain {sql} macro.

But I've just noticed something else, because the chart configuration dialog in your screenshots looks so different from the chart configuration dialog on my machine:

We're obviously talking about different chart macros!

What I was using all the time is the one in the upper right corner of this screenshot (marked red):

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/57662iAA3E0850DA433F0F/image-dimensions/621x382?v=v2 "image.png")But you're obviously using the one that I see in the lower left corner (marked blue).

I didn't see it before or even knew about it (probably it was not available when I started with Confluence years ago :-). But I've tried it out now and have to admit, it looks much better than the one I was using all the time. And the date labels are indeed readable!

![image.png](https://community.atlassian.com/t5/image/serverpage/image-id/57663i326D74100AD67188/image-dimensions/536x316?v=v2 "image.png")

So even if your answers didn't exactly answer my questions yet, they've definitely pushed me into the right direction. Thanks for that! :)


author: Andrey Khaneev _StiltSoft_
body: Yes, I was talking about the second "blue" one. Glad it helped you!


author: David C
body: Is it possible to hide the values of the x axis entirely? I am using a bar chart and have the numbers showing on each bar and the x axis is redundant.


Tags: chart

confluence-server

diagram

server