DzlGraphView
Sorry if this doesn't belong here, though not really an issue per se, we can then embed this code as an example for this repo.
I've been trying to implement a DzlGraphView solely for now, I looked at the docs and looked at the code for the cpu_graph_view(as it is an implementation of the graphview).
In my example I just try to monitor some random generated numbers, however, what I get is a white window.
I'd love any assistance or guidance, even if it means to be directed to ask someplace else.
The code for reference:
#include<gtk/gtk.h>
#include<dazzle.h>
#include<time.h>
static void
activate (GtkApplication* app,
gpointer user_data)
{
GtkWidget *window;
DzlGraphView *view;
DzlGraphLineRenderer *ren;
DzlGraphModel *model;
DzlGraphModelIter iter;
DzlGraphColumn *clm;
clm = dzl_graph_view_column_new("rand", G_TYPE_INT);
window = gtk_application_window_new (app);
view = (DzlGraphView *)dzl_graph_view_new();
model = dzl_graph_view_model_new();
ren = dzl_graph_view_line_renderer_new();
dzl_graph_view_line_renderer_set_stroke_color(ren, "#73d216");
dzl_graph_view_model_set_timespan(model, G_TIME_SPAN_MINUTE);
gtk_window_set_title (GTK_WINDOW (window), "Window");
gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
dzl_graph_view_add_renderer(view, ren);
dzl_graph_view_model_add_column(model, clm);
dzl_graph_view_set_model(view, model);
dzl_graph_view_model_push(model, &iter, g_get_monotonic_time ());
gtk_container_add(GTK_CONTAINER(window), (GtkWidget *)view);
for(int i=0;i<100;i++)
dzl_graph_view_model_iter_set(&iter, 0, rand()%100, -1);
gtk_widget_show_all (window);
}
int
main (int argc,
char **argv)
{
GtkApplication *app;
int status;
app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
status = g_application_run (G_APPLICATION (app), argc, argv);
g_object_unref (app);
return status;
}
Edited by Ghost User