improved bargraph.
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
*/
|
||||
|
||||
static void _setDataTicks(const AQDG_GRAPH *g, AQDG_GRAPH_AXIS *axis);
|
||||
static void _setValuesX(AQDG_GRAPH_DATAPAIR_LIST *dpList);
|
||||
|
||||
|
||||
|
||||
@@ -87,6 +88,7 @@ void AQDG_BarGraph_AddCurve(AQDG_GRAPH *g, const char *sLabel, int graphType, AQ
|
||||
{
|
||||
AQDG_GRAPH_SUBGRAPH *subGraph;
|
||||
|
||||
_setValuesX(dpList);
|
||||
subGraph=AQDG_Graph_GetFirstSubGraph(g);
|
||||
if (subGraph) {
|
||||
AQDG_GRAPH_CURVE *curve;
|
||||
@@ -110,7 +112,8 @@ void AQDG_BarGraph_SetupTicks(AQDG_GRAPH *g, uint32_t flags, double minY, double
|
||||
/* create ticks for X axis */
|
||||
axis=AQDG_Graph_GetAxisByIndex(g, AQDG_GRAPH_AXISPOS_BOTTOM);
|
||||
if (axis) {
|
||||
AQDG_Graph_Axis_AddMargins(axis, AQDG_BARGRAPH_MARGINSPERCENT_X);
|
||||
AQDG_Graph_Axis_SetMinValue(axis, AQDG_Graph_Axis_GetMinValue(axis)-0.5);
|
||||
AQDG_Graph_Axis_SetMaxValue(axis, AQDG_Graph_Axis_GetMaxValue(axis)+0.5);
|
||||
_setDataTicks(g, axis);
|
||||
}
|
||||
|
||||
@@ -149,3 +152,20 @@ void _setDataTicks(const AQDG_GRAPH *g, AQDG_GRAPH_AXIS *axis)
|
||||
|
||||
|
||||
|
||||
void _setValuesX(AQDG_GRAPH_DATAPAIR_LIST *dpList)
|
||||
{
|
||||
if (dpList) {
|
||||
AQDG_GRAPH_DATAPAIR *dp;
|
||||
int idx;
|
||||
|
||||
dp=AQDG_Graph_DataPair_List_First(dpList);
|
||||
while(dp) {
|
||||
AQDG_Graph_DataPair_SetValueX(dp, (double)(idx++));
|
||||
dp=AQDG_Graph_DataPair_List_Next(dp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user