Browse Source

фикс графиков

nodeinfo-routing-update
jeka 7 months ago
parent
commit
bd6054bac9
  1. 13
      tools/etcpmon/etcpmon_graph.c
  2. 12
      tools/etcpmon/etcpmon_gui.c

13
tools/etcpmon/etcpmon_graph.c

@ -81,10 +81,10 @@ void DrawGraph(HDC hdc, RECT* rc, struct etcpmon_app* app)
int sc = 0;
GetSelectedChannels(app, sel, &sc);
int pad = 5;
int gl = pad + 45; /* левая граница графика */
int gl = pad + 5; /* левая граница графика */
int gr = w - pad; /* правая граница */
int gt = pad; /* верх */
int gb = h - 25; /* низ */
int gb = h - 5; /* низ */
int gh = gb - gt;
/* === Сетка === */
HPEN grid = CreatePen(PS_DOT, 1, GetSysColor(COLOR_BTNSHADOW));
@ -141,6 +141,12 @@ void DrawGraph(HDC hdc, RECT* rc, struct etcpmon_app* app)
LineTo(memDC, app->graph_cursor_x, gb);
SelectObject(memDC, old);
DeleteObject(cp);
int cursor_rel_x = app->graph_cursor_x - startx;
if (cursor_rel_x >= 0 && cursor_rel_x < vis) {
int cursor_idx = (oldest + cursor_rel_x) % GRAPH_HISTORY_SIZE;
UpdateChannelValues(app, cursor_idx);
}
}
end:
/* Копируем на экран */
@ -225,6 +231,9 @@ LRESULT CALLBACK GraphWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
InvalidateRect(hWnd, NULL, FALSE);
last_invalidate = now;
}
TRACKMOUSEEVENT tme = { sizeof(tme), TME_LEAVE, hWnd, 0 };
TrackMouseEvent(&tme);
} else {
app->graph_cursor_active = 0;
InvalidateRect(hWnd, NULL, FALSE);

12
tools/etcpmon/etcpmon_gui.c

@ -520,7 +520,7 @@ void etcpmon_gui_update_graph(struct etcpmon_app* app, struct etcpmon_rsp_metric
InvalidateRect(app->hGraphWnd, NULL, FALSE);
}
if (app->client) {
if (!app->graph_cursor_active && app->client) {
struct metrics_history* h = etcpmon_client_get_history(app->client);
if (h && h->count > 0) {
int last_idx = (h->head - 1 + GRAPH_HISTORY_SIZE) % GRAPH_HISTORY_SIZE;
@ -551,10 +551,12 @@ static void on_metrics(struct etcpmon_rsp_metrics* metrics,
if (app) {
etcpmon_gui_update_metrics(app, metrics, links, links_count);
etcpmon_client_add_to_history(app->client, metrics);
struct metrics_history* h = etcpmon_client_get_history(app->client);
if (h && h->count > 0) {
int last_idx = (h->head - 1 + GRAPH_HISTORY_SIZE) % GRAPH_HISTORY_SIZE;
UpdateChannelValues(app, last_idx);
if (!app->graph_cursor_active) {
struct metrics_history* h = etcpmon_client_get_history(app->client);
if (h && h->count > 0) {
int last_idx = (h->head - 1 + GRAPH_HISTORY_SIZE) % GRAPH_HISTORY_SIZE;
UpdateChannelValues(app, last_idx);
}
}
}
}

Loading…
Cancel
Save