Static Graph
I want to add custom wave forms like square, sine and etc, so how I could achieve this easily?
I want to add custom wave forms like square, sine and etc, so how I could achieve this easily?
Hello
The form of your waves depends on the formulation you are using for adding data. In other words, there is no specific way to show a sine wave or a square one. You just need to calculate your values and then use the addDataPoint(value) function of either Dynamic graph or Static graph depending on your use case.
For instance you can use create a sine wave like this:
#include <cmath>
...
void Screen1View::handleTickEvent()
{
static float degree = 0.0;
tickCounter++;
if (tickCounter % 2 == 0)
{
float radian = (degree * 3.14159f) / 180.0f;
dynamicGraph.addDataPoint((float)sin(radian));
degree += 10;
}
}which results in:
Sine wave
Keep in mind that you need to configure the settings of the graph in the TouchGFX designer as well to make your graph look good.
You can read more about the graphs here: Dynamic Graph and Static Graph
I hope this helps you
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.