B4J Library [B4X] [XUI] xGraph Class and b4xlib

budakbaru

Member
Licensed User
Yes I expect 1 peak also but different amplitude. I just want to test whether CalcIntegral method can be use for FFT Magnitude signal or not.
The x axis value I just make it. Also for CalcRMSValue, can it be used for FFT Amplitude signal to get the same or almost same value as original sine wave rms.

Thanks.
 

klaus

Expert
Licensed User
In the mean time, I played a little bit with your project.

1613311045036.png


If you have an integer number of sine cycles in the time window you get one peak.
The amplitude returned by the FFT calculation is the sine amplitude.

I just want to test whether CalcIntegral method can be use for FFT Magnitude signal or not.
What exactly do you mean with this ?
 

Attachments

Last edited:

budakbaru

Member
Licensed User
Thanks klaus.
I'm not very good in calculus but I like to learn it. I thought it is ok just to use calcintegral for FFT magnitude.

B4X:
For i = 0 To Samples - 1
        TimeVelocity(i) = xGraph1.CurveY(TimeVelIndex, i)
    Next
this is the secret.

Many thanks Klaus.
 

klaus

Expert
Licensed User
The xGraph library has been updated to version 1.4.

Set CurveStrokeWidth to Public
Added CalcRMSValue, RMS calculation of a curve
Added CalcSmooth, smoothing of a curve
Added CalcSmoothExponentialLag and CalcSmoothExponentialLead smouthing methods, kindly provided by @rgarnett1955.
Added DrawCurve(Index), draws one curve with the given index
Added DrawCurves(Index()), superimposes up to 4 curves with the given indexes
Added SetGraphToSynchronize method, allows to synchronize two xGraph objects.
Added DeSynchronize method
Added UnZoom method
 

budakbaru

Member
Licensed User
Hai Klaus.

Thanks again for you excellent graph plotting.

I would like to know how to clear the label when cursor added or zoom function selected. I mean after the cursor added to the graph then the label disappear.

Thank a lot
 

budakbaru

Member
Licensed User
Dear Klaus,

How to plot 2 curves with different number of index but same scale as below.

Curve 1
index valueX valueY
0 0 0
1 0.1 1
2 0.2 2
3 0.3 1
4 0.4 0
5 0.5 -1
6 0.6 -2
7 0.7 -1
8 0.8 0
9 0.9 1
10 1.0 2

Curve 2
index valueX valueY
0 0 1
1 0.2 0
2 0.4 -1
3 0.6 0
4 0.8 1
5 1.0 0

Curve 1 has many samples than curve 2 but final value of X still same.
 

klaus

Expert
Licensed User
I suppose that you are speaking of the tooltip label on top of the graph.
Can you please explain more in detail what you are doing when it happens.
It probably happens when you have two synchronized graphs and you have selected one, activate the zoom function but move the cursor on the other graph.
You need to finish the method in the selected graph.

How to plot 2 curves with different number of index but same scale as below.
You cannot. The data structure is not made for this.
You can do it with a YXChart, there the data structure is different.
 

budakbaru

Member
Licensed User
I suppose that you are speaking of the tooltip label on top of the graph.
Can you please explain more in detail what you are doing when it happens.
It probably happens when you have two synchronized graphs and you have selected one, activate the zoom function but move the cursor on the other graph.
You need to finish the method in the selected graph.
In B4A when I want to set a cursor there will be a label appear say select the position of the cursor. After select on the graph, the label still there.
Same for zoom function. The label stay there until exit the apps.
But for B4J the label will disappear immediately after the position of the cursor on the graph selected.

Thanks.
 

klaus

Expert
Licensed User
I see it too.
Thank you for reporting it.
Amended for the next version.
Attached the two files of the current not yet official version 1.5.
 

Attachments

Top