issue with drawing graph in GTK



Hello,

please refer to the graph images one.jpg
<https://drive.google.com/open?id=0By6TAMxEKC6yUjYtU3VKOE5TQ1k> and two.jpg
<https://drive.google.com/open?id=0By6TAMxEKC6yYXNXN2lCMmVOTTA>.

I am using below code for drawing two graphs from same data.
=====================================================
void on_draw_event( GtkWidget *widget, cairo_t *cr, parameter_type
parameter )
{
    cairo_line_to(.......);
    cairo_stroke( cr )
    cairo_set_source_surface( cr, parameter->surface, 0, 0 );
    cairo_paint( cr );
}

gboolean draw_graphs( gpointer param )
{
    gtk_widget_queue_draw( parameter->statistics );
}

main()
{
    parameter->surface = create_image_surface();
    parameter->cr = cairo_create( temp->surface );
    parameter->statistics = gtk_drawing_area_new();
    if( g_signal_connect( G_OBJECT(parameter->statistics), "draw",
G_CALLBACK( on_draw_event ), parameter ) == 0 )
         fprintf( stderr, "unable to connect.");

     const guint draw_event_source = g_timeout_add_seconds( 2, draw_graphs,
NULL );
     .
     .
     .
     g_source_remove( draw_event_source );

}
=====================================================

even though it is same code and same data, I am seeing one graph is proper
and other graph is with some missing lines. graph one.jpg is not as per
expectations and graph two.jpg is proper.
can some one help me what wrong I am doing ?

both the graphs are attached to a box which in turn was attached to a
scrolling window.
My requirement is that, both the graphs to be exactly look a like.

please let me know if more information is required.



Thanks & Regards
--
Lokesh Chakka.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]