decrease verbosity, allow for fixed limits.
This commit is contained in:
@@ -87,27 +87,27 @@ void AQDG_TimeGraph_AddCurve(AQDG_GRAPH *g, const char *sLabel, int graphType, A
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void AQDG_TimeGraph_SetupTicks(AQDG_GRAPH *g)
|
void AQDG_TimeGraph_SetupTicks(AQDG_GRAPH *g, uint32_t flags, double minY, double maxY)
|
||||||
{
|
{
|
||||||
AQDG_GRAPH_AXIS *axis;
|
AQDG_GRAPH_AXIS *axis;
|
||||||
|
|
||||||
DBG_ERROR(NULL, "Calc min/max values");
|
|
||||||
AQDG_Graph_CalcMinMaxValues(g);
|
AQDG_Graph_CalcMinMaxValues(g);
|
||||||
|
|
||||||
/* create ticks for X axis */
|
/* create ticks for X axis */
|
||||||
DBG_ERROR(NULL, "Create ticks for X axis");
|
|
||||||
axis=AQDG_Graph_GetAxisByIndex(g, AQDG_GRAPH_AXISPOS_BOTTOM);
|
axis=AQDG_Graph_GetAxisByIndex(g, AQDG_GRAPH_AXISPOS_BOTTOM);
|
||||||
if (axis) {
|
if (axis) {
|
||||||
_setupTicksForTimeAxis(axis);
|
_setupTicksForTimeAxis(axis);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create ticks for Y axis */
|
/* create ticks for Y axis */
|
||||||
DBG_ERROR(NULL, "Create ticks for Y axis");
|
|
||||||
axis=AQDG_Graph_GetAxisByIndex(g, AQDG_GRAPH_AXISPOS_LEFT);
|
axis=AQDG_Graph_GetAxisByIndex(g, AQDG_GRAPH_AXISPOS_LEFT);
|
||||||
if (axis) {
|
if (axis) {
|
||||||
|
if (flags & AQDG_TIMEGRAPH_SETUPTICKS_FLAGS_MINY)
|
||||||
|
AQDG_Graph_Axis_SetMinValue(axis, minY);
|
||||||
|
if (flags & AQDG_TIMEGRAPH_SETUPTICKS_FLAGS_MAXY)
|
||||||
|
AQDG_Graph_Axis_SetMaxValue(axis, maxY);
|
||||||
_setupTicksForDataAxis(axis);
|
_setupTicksForDataAxis(axis);
|
||||||
}
|
}
|
||||||
DBG_ERROR(NULL, "Ticks done");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -121,33 +121,27 @@ void _setupTicksForTimeAxis(AQDG_GRAPH_AXIS *axis)
|
|||||||
minValue=AQDG_Graph_Axis_GetMinValue(axis);
|
minValue=AQDG_Graph_Axis_GetMinValue(axis);
|
||||||
maxValue=AQDG_Graph_Axis_GetMaxValue(axis);
|
maxValue=AQDG_Graph_Axis_GetMaxValue(axis);
|
||||||
diffInDays=(maxValue-minValue)/(24*60*60);
|
diffInDays=(maxValue-minValue)/(24*60*60);
|
||||||
DBG_ERROR(NULL, "Difference in days: %f.0", diffInDays);
|
DBG_INFO(AQDG_LOGDOMAIN, "Difference in days: %f.0", diffInDays);
|
||||||
if (diffInDays<3) {
|
if (diffInDays<3) {
|
||||||
DBG_ERROR(NULL, "Gen hour ticks");
|
AQDG_Graph_Axis_GenHourTicks(axis, 0, 1);
|
||||||
AQDG_Graph_Axis_GenHourTicks(axis, 0);
|
|
||||||
}
|
}
|
||||||
else if (diffInDays<32) {
|
else if (diffInDays<32) {
|
||||||
DBG_ERROR(NULL, "Gen day ticks");
|
AQDG_Graph_Axis_GenDayTicks(axis, 0); /* level 0: gen tick for every day */
|
||||||
AQDG_Graph_Axis_GenDayTicks(axis, 0);
|
AQDG_Graph_Axis_GenHourTicks(axis, 1, 8); /* level 1: gen tick for every 8h */
|
||||||
}
|
}
|
||||||
else if (diffInDays<90) {
|
else if (diffInDays<90) {
|
||||||
DBG_ERROR(NULL, "Gen week and day ticks");
|
|
||||||
AQDG_Graph_Axis_GenWeekTicks(axis, 0);
|
AQDG_Graph_Axis_GenWeekTicks(axis, 0);
|
||||||
AQDG_Graph_Axis_GenDayTicks(axis, 1);
|
AQDG_Graph_Axis_GenDayTicks(axis, 1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DBG_ERROR(NULL, "Gen month ticks");
|
|
||||||
AQDG_Graph_Axis_GenMonthTicks(axis, 0);
|
AQDG_Graph_Axis_GenMonthTicks(axis, 0);
|
||||||
if (diffInDays<100) {
|
if (diffInDays<100) {
|
||||||
DBG_ERROR(NULL, "Gen day ticks");
|
|
||||||
AQDG_Graph_Axis_GenDayTicks(axis, 1);
|
AQDG_Graph_Axis_GenDayTicks(axis, 1);
|
||||||
}
|
}
|
||||||
else if (diffInDays<400) {
|
else if (diffInDays<400) {
|
||||||
DBG_ERROR(NULL, "Gen week ticks");
|
|
||||||
AQDG_Graph_Axis_GenWeekTicks(axis, 1);
|
AQDG_Graph_Axis_GenWeekTicks(axis, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DBG_ERROR(NULL, "Ticks done");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,11 @@
|
|||||||
#include <aqdiagram/graph/graph.h>
|
#include <aqdiagram/graph/graph.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define AQDG_TIMEGRAPH_SETUPTICKS_FLAGS_MINY 0x01
|
||||||
|
#define AQDG_TIMEGRAPH_SETUPTICKS_FLAGS_MAXY 0x02
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
AQDG_API AQDG_GRAPH *AQDG_TimeGraph_new(const char *sTitle,
|
AQDG_API AQDG_GRAPH *AQDG_TimeGraph_new(const char *sTitle,
|
||||||
const char *sSubTitle,
|
const char *sSubTitle,
|
||||||
const char *sYLabel,
|
const char *sYLabel,
|
||||||
@@ -20,7 +25,7 @@ AQDG_API AQDG_GRAPH *AQDG_TimeGraph_new(const char *sTitle,
|
|||||||
int yPrecision);
|
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_AddCurve(AQDG_GRAPH *g, const char *sLabel, int graphType, AQDG_GRAPH_DATAPAIR_LIST *dpList);
|
||||||
AQDG_API void AQDG_TimeGraph_SetupTicks(AQDG_GRAPH *g);
|
AQDG_API void AQDG_TimeGraph_SetupTicks(AQDG_GRAPH *g, uint32_t flags, double minY, double maxY);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user