added AQDG_Data_DifferenceY()

This commit is contained in:
Martin Preuss
2026-01-05 00:43:47 +01:00
parent 1ac5c428bd
commit c06c71b091
2 changed files with 33 additions and 0 deletions

View File

@@ -84,3 +84,33 @@ double AQDG_Data_GetAbsMinDiffY(const AQDG_GRAPH_DATAPAIR_LIST *dpList)
AQDG_GRAPH_DATAPAIR_LIST *AQDG_Data_DifferenceY(const AQDG_GRAPH_DATAPAIR_LIST *dpList)
{
if (dpList && AQDG_Graph_DataPair_List_GetCount(dpList)) {
AQDG_GRAPH_DATAPAIR_LIST *newList;
const AQDG_GRAPH_DATAPAIR *dp;
newList=AQDG_Graph_DataPair_List_new();
dp=AQDG_Graph_DataPair_List_First(dpList);
if (dp) {
double lastValue;
lastValue=AQDG_Graph_DataPair_GetValueY(dp);
while(dp) {
AQDG_GRAPH_DATAPAIR *newDp;
double v;
v=AQDG_Graph_DataPair_GetValueY(dp);
newDp=AQDG_Graph_DataPair_dup(dp);
AQDG_Graph_DataPair_SetValueY(newDp, v-lastValue);
AQDG_Graph_DataPair_List_Add(newDp, newList);
lastValue=v;
dp=AQDG_Graph_DataPair_List_Next(dp);
}
return newList;
}
}
return NULL;
}

View File

@@ -20,6 +20,9 @@ extern "C" {
AQDG_API double AQDG_Data_GetAbsMinDiffX(const AQDG_GRAPH_DATAPAIR_LIST *dpList); AQDG_API double AQDG_Data_GetAbsMinDiffX(const AQDG_GRAPH_DATAPAIR_LIST *dpList);
AQDG_API double AQDG_Data_GetAbsMinDiffY(const AQDG_GRAPH_DATAPAIR_LIST *dpList);
AQDG_API AQDG_GRAPH_DATAPAIR_LIST *AQDG_Data_DifferenceY(const AQDG_GRAPH_DATAPAIR_LIST *dpList);