/****************************************************************************
 * This file is part of the project AqDiagram.
 * AqDiagram (c) by 2025 Martin Preuss, all rights reserved.
 *
 * The license for this file can be found in the file COPYING which you
 * should have received along with this file.
 ****************************************************************************/

#ifndef AQDG_GRAPH_TIMEGRAPH_H
#define AQDG_GRAPH_TIMEGRAPH_H

#include <aqdiagram/placement/object.h>
#include <aqdiagram/graph/graph.h>


#define AQDG_TIMEGRAPH_SETUPTICKS_FLAGS_MINY 0x01
#define AQDG_TIMEGRAPH_SETUPTICKS_FLAGS_MAXY 0x02


#ifdef __cplusplus
extern "C" {
#endif


AQDG_API AQDG_GRAPH *AQDG_TimeGraph_new(const char *sTitle,
                                        const char *sSubTitle,
                                        const char *sYLabel,
                                        const char *sYUnits,
                                        int yPrecision);

AQDG_API void AQDG_TimeGraph_AddCurve(AQDG_GRAPH *g, const char *sLabel, int graphType, AQDG_GRAPH_DATAPAIR_LIST *dpList);
AQDG_API void AQDG_TimeGraph_SetupTicks(AQDG_GRAPH *g, uint32_t flags, double minY, double maxY);


/**
 * @param g graph object to add curve to
 * @param sLabel label for the new curve
 * @param sModifier modifier determining the curve setup
 *   - first char L=line graph, P=points graph, B=bar graph, S=step graph
 *   - following chars:
 *     - d=average data over days
 *     - mXXX=average data over minutes (XXX=minutes)
 *     - fXXX=floating average (XXX=number of data points to average)
 *     - aXXX=max data over minutes (XXX=minutes)
 *     - iXXX=min data over minutes (XXX=minutes)
 * @param dpList list of datapoints for the curve (is taken over by this function)
 */
AQDG_API void AQDG_TimeGraph_ModifyDataAndAddCurve(AQDG_GRAPH *g,
                                                   const char *sLabel,
                                                   const char *sModifier,
                                                   AQDG_GRAPH_DATAPAIR_LIST *dpList);


#ifdef __cplusplus
}
#endif


#endif

