[Lazarus] PlotFunction patch declined?

Michael Van Canneyt michael at freepascal.org
Tue Nov 7 13:42:47 CET 2017



On Tue, 7 Nov 2017, Werner Pamler via Lazarus wrote:

> Am 07.11.2017 um 12:50 schrieb Michael Van Canneyt via Lazarus:
>> I see that I missed to commit a patch to plotpanel, because here sin(x) 
>> works. I have too many unfinished patches in my source tree :/
>> 
>> Should I still commit it, or it is not necessary any more ?
>
> Please commit it. I think we should fix the shortcomings of plotpanel. There 
> were already a few bugs which I fixed - look at the svn commit notes. I'm 
> just against adding too many new features which just will be appetizers for 
> even more new features.

OK.

>
> In the meantime I put the TExpressionSeries into the standard TAChart package 
> where everything works fine (in order to remove the dependence on 
> fpexprparser, maybe I'll move it to a separate package later once I know how 
> to get the registration for the series editor done).

I don't see why you would need a separate package. fpexprparser is in the
FCL since 10 years or so. A separate unit is definitely good so as to
minimize the dependencies of the basic tachart unit, but a package ? 
Seems overkill to me ?

> Here are short instruction how to use it
>
> * Add a TChart on the form
> * Double-click the chart
> * In the "Edit series" dialog select "+ Add" and "Math expression
>   series" at the very bottom.
> * In the Object Tree, select the newly added serie,
>   Chart1ExpressionSeries1
> * Enter the function term, e.g. 'sin(x)*exp(-0.1x)'
> * Define the x range for which the function will be plotted: Select
>   "Range", enter the minimum and maximum x values, e.g. XMin = 0, XMax
>   = 50, set UseXMin and UseMax to true in order to apply this axis range.
> * Set AutoExtentY to true in order to auto-scale the y axis.
> * Voila - see the attached screenshot (which is taken at designtime,
>   of course).
>
> Michael, the expression panel allows to add identifiers at designtime. I do 
> understand this for variables, and, in fact, this is great to parameterize 
> the function or to use natural constants. But the IdentifierType can also be 
> itFunctionCallBack, itFunctionHandler, itFunctionNode. Can you explain how 
> these should be handled in practice?

These values can only be handled in code. 
Of the three, itFunctionHandler can be handled by using an event handler.
But itFunctionCallBack,itFunctionNode make no sense in the designer.

For simplicity, the plot panel uses the default collection editor, 
so the other values are exposed as well in the designer. 
A specialized collection editor would simply hide these possibilities. 
(and would also disallow editing the X variable)

Michael.


More information about the Lazarus mailing list