[Solved] Calc line chart missing category / x-axis values

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
db_user
Posts: 5
Joined: Thu Oct 27, 2022 11:52 pm

[Solved] Calc line chart missing category / x-axis values

Post by db_user »

Hello, I have a problem with a line chart drawing by code. Following this topic https://forum.openoffice.org/en/forum/v ... dataseries I am trying to create a new chart with x-axes other than numerical. I searched the forum for this and unfortunately I could not come across a solution.

In the appendix on the left are sample data and a chart drawn by the code. On the right is the chart I am aiming for.

In the series I have to use data from different columns and it works. What doesn't work, however, is assigning values to the x-axis and displaying the correct values when I hover over a point on the chart. I will have to dynamically create at least a dozen charts of this type every time the data changes. The data may have a different number of rows each time. The problem seems to be that there is no assigned category on the chart, but I don't know how to do it.

The main problem:
How to properly assign a category to this type of chart using code, so that it displays on the X axis, and so that the correct values (as in the right chart) appear in the points on the chart when you hover the mouse over them.
Attachments
MakeChart.ods
(26.63 KiB) Downloaded 53 times
Last edited by db_user on Sun Oct 30, 2022 2:23 pm, edited 1 time in total.
OpenOffice 4.1.13 / Win10
ms777
Volunteer
Posts: 177
Joined: Mon Oct 08, 2007 1:33 am

Re: Calc line chart missing category / x-axis values

Post by ms777 »

Hi,

to add the axis descriptions you have to add a line

Code: Select all

oData.setRowDescriptions(oDataXValuesArray)
Good luck,

ms777
db_user
Posts: 5
Joined: Thu Oct 27, 2022 11:52 pm

Re: Calc line chart missing category / x-axis values

Post by db_user »

Thank you very much ms777. Now there is nothing blocking me from continuing my work.
OpenOffice 4.1.13 / Win10
Post Reply