How to create a graphic from a formula y = f(x) - not from a table

The predecessor of vba was a macro language that was written into special macro sheets.

Microsoft Excel - Wikipedia (scroll down to “macro Programming” → “History”. It’s called “XLM” and still runs with recent versions of Excel.

Thanks. Yet another info about Excel I happily didn’t miss consciously for many years. Even when I still had to use Excel in some cases, I never wrote or recorded macros for it.

Hello, thank you all for your answers.

@EarnestAl
I think you are close to the trouble source :).

We have Name Manager in Calc (drop box at the right of the formula box : Manage Names..., Ctrl F3)
With F9 (Recalculate) in H1 and C6, I have the right values, even when I modified the settings.
But not in the graphic.

It seems to me, the problem come from “evaluate” function in “y” name. The Function EVALUATE does not exist in Calc.

Please note that, in the tutorial, the author (sorry, I didn’t take account that it was in French) said something like “The EVALUATE function is not more accessible in Excel. But it still exist”.

Your sample .zip project contains an .xlsm file. That means: It is a xlsx file, containing some MACROS. But your sample file not contain any macros. (I can not find them inside.)
.
Then, your sample file contains two cells for the x range limit values, and one more cell for the number of the “calculated” points. Therefore it is logical for me: something will calculate the points of the graph… It is possible in some helper cells, or temporarly in the memory, it is depends on the “macro code”.
.
Finally the macro will insert/manage the Graph with inner x-y values (the sample graph has not source cell range reference.)
.
.
I think it is possible to achieve in Calc.
You need use a named cell for the x values, and one helper cell for the y values. (You can use an invisible sheet - if you want to hide these temporarly values.)
You need put the formula into the y cell, and then you must put the x values cyclically into the x cell. (Not needed the EVALUATE function, the cells can calculate/evaluate the inserted formula) You must store (cyclically) the x values and the y results into some array variables.
Finally you need adjust the inner x-y values of the graph.
.
It is not a simple project…

Yes. It is Excel tables that Calc doesn’t have, Overview of Excel tables - Microsoft Support

Thank you for your time @Zizi64 :).

I am not sure to see what you mention.
It is what the example did about x and y.
I try to put the y formula without the key word "EVALUATE.
Even inside “{ }”

I have the data series with F9 in x and y.
The problem come from the graphic.
How to make the graphic reading the data series :).

With Macros:
Graphique f(x)_Zizi64.ods (24.4 KB)

Great @Zizi64
This is the solution.
The idea with the button is excellent.

Very simple. Thank you.

Thank you @Lader and @Villeroy for your approach.

Have a nice summer, José from France

Anybody with the most basic spreadsheet skill is able to create a table where y = ax²+bx+c with a chart for any range of x.

Just such an experiment
Evaluate Graf X.ods (52.5 KB)

1 Like

Hi @Lader , thank you for this way (which needs to create a table :slight_smile: )

Sorry to tell you, it does not work in my Calc application.

I think, it does not recognize the “EVALUATE” function.

Do I need to add an extension on Calc?

Many thanks for your time and interest.

José from France

The function is a Basic functionembedded in the document.
Tools>Options>Security>[Macro Security]
Leviel:: Highest
Trusted sources: some folder(s) but not your downloads folder.
Load the document from there.

1 Like

Thank you @Lader and @Villeroy

@Lader, your file works (with an automated table, not exactly as the initial example).

and thank you @Villeroy for reminding me the level of security and trusted sources which make the @Lader’s file working :).

Note that the initial file doesn’t work with the same level of security :).
I think the trouble is the way they use the function “EVALUATE”.

Have a nice summer :).
José from France

La solution d’OpenAI ! Chat GPT 3.5
https://chat.openai.com/c/449439ea-7185-4051-bafc-2efc538d0d22

To be checked

Your link shows a login page only…

Oups, my mistake (again !)
I need to note, in the url, the keyword “share” !

https://chat.openai.com/share/8ad42bc5-b9ab-48f5-af26-ab7f11cf78f2

Thank you for your interest. See my post on this topic.

José from France

The linked page shows how you can create a table from a formula, and then how you can create a graph based on the data table.

But, the original poster want to create a graph based on a formula, without creating a data table.
It is related to the fact: the calc has not function “EVALUATE()”. you must handle the textual FORMULA by some Macro tricks.

2 Likes

Yes @Zizi64
that is why I have to refresh my Python and see how to do that with Python macros :slight_smile:
I’ve been unable to make BASIC macros working :slight_smile:

By way, see the follow is here :slight_smile: How to get hatching on an LO Calc diagram. See my try

Have a nice day, José

???
A solution to the original question will neither be found (or much simplified) by the usage of Python or C# or whatever language, but needs to be based on a good understanding of how Chart objects are treated with the help of API services and interfaces.

My old comment from 2023-07-30 should give the needed hints.
Howsoever: The reasonable way to get the chart is to calculate the needed data in an additional sheet of the spreadsheet document.
After all the question was asked with the tag “calc”, but even if the chart is needed for a Writer or a Draw document the usage of an intermediary Calc document should be advantageous…

1 Like

Thank you for the time and interest.

I will try soon, I didn’t miss to share here the result.

Have a good time @Lupp

Just to mention that my aim is a curve with dynamics hatching area :slight_smile:
See here: How to get hatching on an LO Calc diagram. See my try