/* chart.c generated by valac 0.56.0, the Vala compiler
 * generated from chart.vala, do not modify */

#include "livechart_static.h"
#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <cairo-gobject.h>
#include <float.h>
#include <math.h>
#include <gee.h>
#include <stdlib.h>
#include <string.h>
#include <gdk/gdk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>

enum  {
	LIVE_CHART_CHART_0_PROPERTY,
	LIVE_CHART_CHART_GRID_PROPERTY,
	LIVE_CHART_CHART_BACKGROUND_PROPERTY,
	LIVE_CHART_CHART_LEGEND_PROPERTY,
	LIVE_CHART_CHART_NUM_PROPERTIES
};
static GParamSpec* live_chart_chart_properties[LIVE_CHART_CHART_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _live_chart_config_unref0(var) ((var == NULL) ? NULL : (var = (live_chart_config_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _Block1Data Block1Data;
#define _g_free0(var) ((var == NULL) ? NULL : (var = (g_free (var), NULL)))

struct _LiveChartChartPrivate {
	LiveChartGrid* _grid;
	LiveChartBackground* _background;
	LiveChartLegend* _legend;
	guint source_timeout;
};

struct _Block1Data {
	int _ref_count_;
	LiveChartChart* self;
	gint64 ts;
	LiveChartValues* values;
	gint timespan_between_value;
};

static gint LiveChartChart_private_offset;
static gpointer live_chart_chart_parent_class = NULL;

static void __lambda9_ (LiveChartChart* self,
                 GtkAllocation* allocation);
static void ___lambda9__gtk_widget_size_allocate (GtkWidget* _sender,
                                           GtkAllocation* allocation,
                                           gpointer self);
static gboolean live_chart_chart_render (LiveChartChart* self,
                                  GtkWidget* _,
                                  cairo_t* ctx);
static gboolean _live_chart_chart_render_gtk_widget_draw (GtkWidget* _sender,
                                                   cairo_t* cr,
                                                   gpointer self);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
static gboolean __lambda11_ (Block1Data* _data1_,
                      gdouble* value);
static gboolean ___lambda11__gee_forall_func (gpointer g,
                                       gpointer self);
static gboolean __lambda10_ (LiveChartChart* self);
static gboolean ___lambda10__gsource_func (gpointer self);
static void live_chart_chart_finalize (GObject * obj);
static GType live_chart_chart_get_type_once (void);
static void _vala_live_chart_chart_get_property (GObject * object,
                                          guint property_id,
                                          GValue * value,
                                          GParamSpec * pspec);
static void _vala_live_chart_chart_set_property (GObject * object,
                                          guint property_id,
                                          const GValue * value,
                                          GParamSpec * pspec);

GQuark
live_chart_chart_error_quark (void)
{
	return g_quark_from_static_string ("live-chart-chart-error-quark");
}

static GType
live_chart_chart_error_get_type_once (void)
{
	static const GEnumValue values[] = {{LIVE_CHART_CHART_ERROR_EXPORT_ERROR, "LIVE_CHART_CHART_ERROR_EXPORT_ERROR", "export-error"}, {LIVE_CHART_CHART_ERROR_SERIE_NOT_FOUND, "LIVE_CHART_CHART_ERROR_SERIE_NOT_FOUND", "serie-not-found"}, {0, NULL, NULL}};
	GType live_chart_chart_error_type_id;
	live_chart_chart_error_type_id = g_enum_register_static ("LiveChartChartError", values);
	return live_chart_chart_error_type_id;
}

GType
live_chart_chart_error_get_type (void)
{
	static volatile gsize live_chart_chart_error_type_id__once = 0;
	if (g_once_init_enter (&live_chart_chart_error_type_id__once)) {
		GType live_chart_chart_error_type_id;
		live_chart_chart_error_type_id = live_chart_chart_error_get_type_once ();
		g_once_init_leave (&live_chart_chart_error_type_id__once, live_chart_chart_error_type_id);
	}
	return live_chart_chart_error_type_id__once;
}

static inline gpointer
live_chart_chart_get_instance_private (LiveChartChart* self)
{
	return G_STRUCT_MEMBER_P (self, LiveChartChart_private_offset);
}

static gpointer
_live_chart_config_ref0 (gpointer self)
{
#line 22 "../src/chart.vala"
	return self ? live_chart_config_ref (self) : NULL;
#line 118 "chart.c"
}

static void
__lambda9_ (LiveChartChart* self,
            GtkAllocation* allocation)
{
	LiveChartConfig* _tmp0_;
	GtkAllocation _tmp1_;
	LiveChartConfig* _tmp2_;
	GtkAllocation _tmp3_;
#line 23 "../src/chart.vala"
	g_return_if_fail (allocation != NULL);
#line 24 "../src/chart.vala"
	_tmp0_ = self->config;
#line 24 "../src/chart.vala"
	_tmp1_ = *allocation;
#line 24 "../src/chart.vala"
	live_chart_config_set_height (_tmp0_, _tmp1_.height);
#line 25 "../src/chart.vala"
	_tmp2_ = self->config;
#line 25 "../src/chart.vala"
	_tmp3_ = *allocation;
#line 25 "../src/chart.vala"
	live_chart_config_set_width (_tmp2_, _tmp3_.width);
#line 143 "chart.c"
}

static void
___lambda9__gtk_widget_size_allocate (GtkWidget* _sender,
                                      GtkAllocation* allocation,
                                      gpointer self)
{
#line 23 "../src/chart.vala"
	__lambda9_ ((LiveChartChart*) self, allocation);
#line 153 "chart.c"
}

static gboolean
_live_chart_chart_render_gtk_widget_draw (GtkWidget* _sender,
                                          cairo_t* cr,
                                          gpointer self)
{
	gboolean result;
	result = live_chart_chart_render ((LiveChartChart*) self, _sender, cr);
#line 28 "../src/chart.vala"
	return result;
#line 165 "chart.c"
}

LiveChartChart*
live_chart_chart_construct (GType object_type,
                            LiveChartConfig* config)
{
	LiveChartChart * self = NULL;
	LiveChartConfig* _tmp0_;
	LiveChartSeries* _tmp1_;
#line 21 "../src/chart.vala"
	g_return_val_if_fail (config != NULL, NULL);
#line 21 "../src/chart.vala"
	self = (LiveChartChart*) g_object_new (object_type, NULL);
#line 22 "../src/chart.vala"
	_tmp0_ = _live_chart_config_ref0 (config);
#line 22 "../src/chart.vala"
	_live_chart_config_unref0 (self->config);
#line 22 "../src/chart.vala"
	self->config = _tmp0_;
#line 23 "../src/chart.vala"
	g_signal_connect_object ((GtkWidget*) self, "size-allocate", (GCallback) ___lambda9__gtk_widget_size_allocate, self, 0);
#line 28 "../src/chart.vala"
	g_signal_connect_object ((GtkWidget*) self, "draw", (GCallback) _live_chart_chart_render_gtk_widget_draw, self, 0);
#line 30 "../src/chart.vala"
	live_chart_chart_refresh_every (self, 100);
#line 32 "../src/chart.vala"
	_tmp1_ = live_chart_series_new (self);
#line 32 "../src/chart.vala"
	_g_object_unref0 (self->series);
#line 32 "../src/chart.vala"
	self->series = _tmp1_;
#line 21 "../src/chart.vala"
	return self;
#line 199 "chart.c"
}

LiveChartChart*
live_chart_chart_new (LiveChartConfig* config)
{
#line 21 "../src/chart.vala"
	return live_chart_chart_construct (LIVE_CHART_TYPE_CHART, config);
#line 207 "chart.c"
}

void
live_chart_chart_add_serie (LiveChartChart* self,
                            LiveChartSerie* serie)
{
	LiveChartSeries* _tmp0_;
	LiveChartSerie* _tmp1_;
	LiveChartSerie* _tmp2_;
#line 35 "../src/chart.vala"
	g_return_if_fail (self != NULL);
#line 35 "../src/chart.vala"
	g_return_if_fail (serie != NULL);
#line 36 "../src/chart.vala"
	_tmp0_ = self->series;
#line 36 "../src/chart.vala"
	_tmp1_ = live_chart_series_register (_tmp0_, serie);
#line 36 "../src/chart.vala"
	_tmp2_ = _tmp1_;
#line 36 "../src/chart.vala"
	_g_object_unref0 (_tmp2_);
#line 229 "chart.c"
}

void
live_chart_chart_add_value (LiveChartChart* self,
                            LiveChartSerie* serie,
                            gdouble value)
{
#line 40 "../src/chart.vala"
	g_return_if_fail (self != NULL);
#line 40 "../src/chart.vala"
	g_return_if_fail (serie != NULL);
#line 41 "../src/chart.vala"
	live_chart_serie_add (serie, value);
#line 243 "chart.c"
}

static gpointer
_g_error_copy0 (gpointer self)
{
#line 50 "../src/chart.vala"
	return self ? g_error_copy (self) : NULL;
#line 251 "chart.c"
}

void
live_chart_chart_add_value_by_index (LiveChartChart* self,
                                     gint serie_index,
                                     gdouble value,
                                     GError** error)
{
	GError* _inner_error0_ = NULL;
#line 45 "../src/chart.vala"
	g_return_if_fail (self != NULL);
#line 263 "chart.c"
	{
		LiveChartSerie* serie = NULL;
		LiveChartSeries* _tmp0_;
		LiveChartSerie* _tmp1_;
		LiveChartSerie* _tmp2_;
#line 47 "../src/chart.vala"
		_tmp0_ = self->series;
#line 47 "../src/chart.vala"
		_tmp1_ = live_chart_series_get (_tmp0_, serie_index, &_inner_error0_);
#line 47 "../src/chart.vala"
		serie = _tmp1_;
#line 47 "../src/chart.vala"
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
#line 47 "../src/chart.vala"
			if (_inner_error0_->domain == LIVE_CHART_CHART_ERROR) {
#line 279 "chart.c"
				goto __catch0_live_chart_chart_error;
			}
#line 47 "../src/chart.vala"
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
#line 47 "../src/chart.vala"
			g_clear_error (&_inner_error0_);
#line 47 "../src/chart.vala"
			return;
#line 288 "chart.c"
		}
#line 48 "../src/chart.vala"
		_tmp2_ = serie;
#line 48 "../src/chart.vala"
		live_chart_chart_add_value (self, _tmp2_, value);
#line 46 "../src/chart.vala"
		_g_object_unref0 (serie);
#line 296 "chart.c"
	}
	goto __finally0;
	__catch0_live_chart_chart_error:
	{
		GError* e = NULL;
		GError* _tmp3_;
		GError* _tmp4_;
#line 46 "../src/chart.vala"
		e = _inner_error0_;
#line 46 "../src/chart.vala"
		_inner_error0_ = NULL;
#line 50 "../src/chart.vala"
		_tmp3_ = e;
#line 50 "../src/chart.vala"
		_tmp4_ = _g_error_copy0 (_tmp3_);
#line 50 "../src/chart.vala"
		_inner_error0_ = _tmp4_;
#line 50 "../src/chart.vala"
		_g_error_free0 (e);
#line 316 "chart.c"
		goto __finally0;
	}
	__finally0:
#line 46 "../src/chart.vala"
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
#line 46 "../src/chart.vala"
		if (_inner_error0_->domain == LIVE_CHART_CHART_ERROR) {
#line 46 "../src/chart.vala"
			g_propagate_error (error, _inner_error0_);
#line 46 "../src/chart.vala"
			return;
#line 328 "chart.c"
		} else {
#line 46 "../src/chart.vala"
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
#line 46 "../src/chart.vala"
			g_clear_error (&_inner_error0_);
#line 46 "../src/chart.vala"
			return;
#line 336 "chart.c"
		}
	}
}

static Block1Data*
block1_data_ref (Block1Data* _data1_)
{
#line 54 "../src/chart.vala"
	g_atomic_int_inc (&_data1_->_ref_count_);
#line 54 "../src/chart.vala"
	return _data1_;
#line 348 "chart.c"
}

static void
block1_data_unref (void * _userdata_)
{
	Block1Data* _data1_;
	_data1_ = (Block1Data*) _userdata_;
#line 54 "../src/chart.vala"
	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
#line 358 "chart.c"
		LiveChartChart* self;
#line 54 "../src/chart.vala"
		self = _data1_->self;
#line 54 "../src/chart.vala"
		_g_object_unref0 (_data1_->values);
#line 54 "../src/chart.vala"
		_g_object_unref0 (self);
#line 54 "../src/chart.vala"
		g_slice_free (Block1Data, _data1_);
#line 368 "chart.c"
	}
}

static gboolean
__lambda11_ (Block1Data* _data1_,
             gdouble* value)
{
	LiveChartChart* self;
	LiveChartTimestampedValue _tmp0_ = {0};
	LiveChartConfig* _tmp1_;
	LiveChartYAxis* _tmp2_;
	gboolean result;
#line 57 "../src/chart.vala"
	self = _data1_->self;
#line 58 "../src/chart.vala"
	_data1_->ts += (gint64) _data1_->timespan_between_value;
#line 59 "../src/chart.vala"
	_tmp0_.timestamp = (gdouble) _data1_->ts;
#line 59 "../src/chart.vala"
	_tmp0_.value = *value;
#line 59 "../src/chart.vala"
	live_chart_values_add (_data1_->values, &_tmp0_);
#line 60 "../src/chart.vala"
	_tmp1_ = self->config;
#line 60 "../src/chart.vala"
	_tmp2_ = _tmp1_->y_axis;
#line 60 "../src/chart.vala"
	live_chart_yaxis_update_bounds (_tmp2_, *value);
#line 61 "../src/chart.vala"
	result = TRUE;
#line 61 "../src/chart.vala"
	_g_free0 (value);
#line 61 "../src/chart.vala"
	return result;
#line 403 "chart.c"
}

static gboolean
___lambda11__gee_forall_func (gpointer g,
                              gpointer self)
{
	gboolean result;
	result = __lambda11_ (self, (gdouble*) g);
#line 57 "../src/chart.vala"
	return result;
#line 414 "chart.c"
}

void
live_chart_chart_add_unaware_timestamp_collection (LiveChartChart* self,
                                                   LiveChartSerie* serie,
                                                   GeeCollection* collection,
                                                   gint timespan_between_value)
{
	Block1Data* _data1_;
	gint _tmp0_;
	gint _tmp1_;
	LiveChartValues* _tmp2_;
#line 54 "../src/chart.vala"
	g_return_if_fail (self != NULL);
#line 54 "../src/chart.vala"
	g_return_if_fail (serie != NULL);
#line 54 "../src/chart.vala"
	g_return_if_fail (collection != NULL);
#line 54 "../src/chart.vala"
	_data1_ = g_slice_new0 (Block1Data);
#line 54 "../src/chart.vala"
	_data1_->_ref_count_ = 1;
#line 54 "../src/chart.vala"
	_data1_->self = g_object_ref (self);
#line 54 "../src/chart.vala"
	_data1_->timespan_between_value = timespan_between_value;
#line 55 "../src/chart.vala"
	_tmp0_ = gee_collection_get_size (collection);
#line 55 "../src/chart.vala"
	_tmp1_ = _tmp0_;
#line 55 "../src/chart.vala"
	_data1_->ts = (g_get_real_time () / 1000) - (_tmp1_ * _data1_->timespan_between_value);
#line 56 "../src/chart.vala"
	_tmp2_ = live_chart_serie_get_values (serie);
#line 56 "../src/chart.vala"
	_data1_->values = _tmp2_;
#line 57 "../src/chart.vala"
	gee_traversable_foreach ((GeeTraversable*) collection, ___lambda11__gee_forall_func, _data1_);
#line 54 "../src/chart.vala"
	block1_data_unref (_data1_);
#line 54 "../src/chart.vala"
	_data1_ = NULL;
#line 457 "chart.c"
}

void
live_chart_chart_add_unaware_timestamp_collection_by_index (LiveChartChart* self,
                                                            gint serie_index,
                                                            GeeCollection* collection,
                                                            gint timespan_between_value,
                                                            GError** error)
{
	GError* _inner_error0_ = NULL;
#line 65 "../src/chart.vala"
	g_return_if_fail (self != NULL);
#line 65 "../src/chart.vala"
	g_return_if_fail (collection != NULL);
#line 472 "chart.c"
	{
		LiveChartSerie* serie = NULL;
		LiveChartSeries* _tmp0_;
		LiveChartSerie* _tmp1_;
		LiveChartSerie* _tmp2_;
#line 67 "../src/chart.vala"
		_tmp0_ = self->series;
#line 67 "../src/chart.vala"
		_tmp1_ = live_chart_series_get (_tmp0_, serie_index, &_inner_error0_);
#line 67 "../src/chart.vala"
		serie = _tmp1_;
#line 67 "../src/chart.vala"
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
#line 67 "../src/chart.vala"
			if (_inner_error0_->domain == LIVE_CHART_CHART_ERROR) {
#line 488 "chart.c"
				goto __catch0_live_chart_chart_error;
			}
#line 67 "../src/chart.vala"
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
#line 67 "../src/chart.vala"
			g_clear_error (&_inner_error0_);
#line 67 "../src/chart.vala"
			return;
#line 497 "chart.c"
		}
#line 68 "../src/chart.vala"
		_tmp2_ = serie;
#line 68 "../src/chart.vala"
		live_chart_chart_add_unaware_timestamp_collection (self, _tmp2_, collection, timespan_between_value);
#line 66 "../src/chart.vala"
		_g_object_unref0 (serie);
#line 505 "chart.c"
	}
	goto __finally0;
	__catch0_live_chart_chart_error:
	{
		GError* e = NULL;
		GError* _tmp3_;
		GError* _tmp4_;
#line 66 "../src/chart.vala"
		e = _inner_error0_;
#line 66 "../src/chart.vala"
		_inner_error0_ = NULL;
#line 70 "../src/chart.vala"
		_tmp3_ = e;
#line 70 "../src/chart.vala"
		_tmp4_ = _g_error_copy0 (_tmp3_);
#line 70 "../src/chart.vala"
		_inner_error0_ = _tmp4_;
#line 70 "../src/chart.vala"
		_g_error_free0 (e);
#line 525 "chart.c"
		goto __finally0;
	}
	__finally0:
#line 66 "../src/chart.vala"
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
#line 66 "../src/chart.vala"
		if (_inner_error0_->domain == LIVE_CHART_CHART_ERROR) {
#line 66 "../src/chart.vala"
			g_propagate_error (error, _inner_error0_);
#line 66 "../src/chart.vala"
			return;
#line 537 "chart.c"
		} else {
#line 66 "../src/chart.vala"
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
#line 66 "../src/chart.vala"
			g_clear_error (&_inner_error0_);
#line 66 "../src/chart.vala"
			return;
#line 545 "chart.c"
		}
	}
}

static gpointer
_g_object_ref0 (gpointer self)
{
#line 75 "../src/chart.vala"
	return self ? g_object_ref (self) : NULL;
#line 555 "chart.c"
}

void
live_chart_chart_to_png (LiveChartChart* self,
                         const gchar* filename,
                         GError** error)
{
	GdkWindow* window = NULL;
	GdkWindow* _tmp0_;
	GdkWindow* _tmp1_;
	GdkPixbuf* pixbuff = NULL;
	GdkPixbuf* _tmp3_;
	GdkPixbuf* _tmp4_;
	GError* _inner_error0_ = NULL;
#line 74 "../src/chart.vala"
	g_return_if_fail (self != NULL);
#line 74 "../src/chart.vala"
	g_return_if_fail (filename != NULL);
#line 75 "../src/chart.vala"
	_tmp0_ = gtk_widget_get_window ((GtkWidget*) self);
#line 75 "../src/chart.vala"
	_tmp1_ = _g_object_ref0 (_tmp0_);
#line 75 "../src/chart.vala"
	window = _tmp1_;
#line 76 "../src/chart.vala"
	if (window == NULL) {
#line 582 "chart.c"
		GError* _tmp2_;
#line 77 "../src/chart.vala"
		_tmp2_ = g_error_new_literal (LIVE_CHART_CHART_ERROR, LIVE_CHART_CHART_ERROR_EXPORT_ERROR, "Chart is not realized yet");
#line 77 "../src/chart.vala"
		_inner_error0_ = _tmp2_;
#line 77 "../src/chart.vala"
		g_propagate_error (error, _inner_error0_);
#line 77 "../src/chart.vala"
		_g_object_unref0 (window);
#line 77 "../src/chart.vala"
		return;
#line 594 "chart.c"
	}
#line 79 "../src/chart.vala"
	_tmp3_ = gdk_pixbuf_get_from_window (window, 0, 0, gdk_window_get_width (window), gdk_window_get_height (window));
#line 79 "../src/chart.vala"
	pixbuff = _tmp3_;
#line 80 "../src/chart.vala"
	_tmp4_ = pixbuff;
#line 80 "../src/chart.vala"
	if (_tmp4_ != NULL) {
#line 604 "chart.c"
		GdkPixbuf* _tmp5_;
#line 81 "../src/chart.vala"
		_tmp5_ = pixbuff;
#line 81 "../src/chart.vala"
		gdk_pixbuf_save (_tmp5_, filename, "png", &_inner_error0_, NULL);
#line 81 "../src/chart.vala"
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
#line 81 "../src/chart.vala"
			g_propagate_error (error, _inner_error0_);
#line 81 "../src/chart.vala"
			_g_object_unref0 (pixbuff);
#line 81 "../src/chart.vala"
			_g_object_unref0 (window);
#line 81 "../src/chart.vala"
			return;
#line 620 "chart.c"
		}
	}
#line 74 "../src/chart.vala"
	_g_object_unref0 (pixbuff);
#line 74 "../src/chart.vala"
	_g_object_unref0 (window);
#line 627 "chart.c"
}

static gboolean
__lambda10_ (LiveChartChart* self)
{
	gboolean result;
#line 90 "../src/chart.vala"
	gtk_widget_queue_draw ((GtkWidget*) self);
#line 91 "../src/chart.vala"
	result = TRUE;
#line 91 "../src/chart.vala"
	return result;
#line 640 "chart.c"
}

static gboolean
___lambda10__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda10_ ((LiveChartChart*) self);
#line 89 "../src/chart.vala"
	return result;
#line 650 "chart.c"
}

void
live_chart_chart_refresh_every (LiveChartChart* self,
                                gint ms)
{
#line 85 "../src/chart.vala"
	g_return_if_fail (self != NULL);
#line 86 "../src/chart.vala"
	if (self->priv->source_timeout != ((guint) 0)) {
#line 87 "../src/chart.vala"
		g_source_remove (self->priv->source_timeout);
#line 663 "chart.c"
	}
#line 89 "../src/chart.vala"
	self->priv->source_timeout = g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) ms, ___lambda10__gsource_func, g_object_ref (self), g_object_unref);
#line 667 "chart.c"
}

static gboolean
live_chart_chart_render (LiveChartChart* self,
                         GtkWidget* _,
                         cairo_t* ctx)
{
	LiveChartConfig* _tmp0_;
	LiveChartLegend* _tmp1_;
	LiveChartBackground* _tmp2_;
	LiveChartConfig* _tmp3_;
	LiveChartGrid* _tmp4_;
	LiveChartConfig* _tmp5_;
	LiveChartLegend* _tmp6_;
	LiveChartBoundaries boundaries = {0};
	LiveChartConfig* _tmp9_;
	LiveChartBoundaries _tmp10_ = {0};
	gboolean result;
#line 95 "../src/chart.vala"
	g_return_val_if_fail (self != NULL, FALSE);
#line 95 "../src/chart.vala"
	g_return_val_if_fail (_ != NULL, FALSE);
#line 95 "../src/chart.vala"
	g_return_val_if_fail (ctx != NULL, FALSE);
#line 97 "../src/chart.vala"
	_tmp0_ = self->config;
#line 97 "../src/chart.vala"
	_tmp1_ = self->priv->_legend;
#line 97 "../src/chart.vala"
	live_chart_config_configure (_tmp0_, ctx, _tmp1_);
#line 99 "../src/chart.vala"
	_tmp2_ = self->priv->_background;
#line 99 "../src/chart.vala"
	_tmp3_ = self->config;
#line 99 "../src/chart.vala"
	live_chart_drawable_draw ((LiveChartDrawable*) _tmp2_, ctx, _tmp3_);
#line 100 "../src/chart.vala"
	_tmp4_ = self->priv->_grid;
#line 100 "../src/chart.vala"
	_tmp5_ = self->config;
#line 100 "../src/chart.vala"
	live_chart_drawable_draw ((LiveChartDrawable*) _tmp4_, ctx, _tmp5_);
#line 101 "../src/chart.vala"
	_tmp6_ = self->priv->_legend;
#line 101 "../src/chart.vala"
	if (_tmp6_ != NULL) {
#line 714 "chart.c"
		LiveChartLegend* _tmp7_;
		LiveChartConfig* _tmp8_;
#line 101 "../src/chart.vala"
		_tmp7_ = self->priv->_legend;
#line 101 "../src/chart.vala"
		_tmp8_ = self->config;
#line 101 "../src/chart.vala"
		live_chart_legend_draw (_tmp7_, ctx, _tmp8_);
#line 723 "chart.c"
	}
#line 103 "../src/chart.vala"
	_tmp9_ = self->config;
#line 103 "../src/chart.vala"
	live_chart_config_boundaries (_tmp9_, &_tmp10_);
#line 103 "../src/chart.vala"
	boundaries = _tmp10_;
#line 731 "chart.c"
	{
		GeeIterator* _serie_it = NULL;
		LiveChartSeries* _tmp11_;
		GeeIterator* _tmp12_;
#line 104 "../src/chart.vala"
		_tmp11_ = self->series;
#line 104 "../src/chart.vala"
		_tmp12_ = live_chart_series_iterator (_tmp11_);
#line 104 "../src/chart.vala"
		_serie_it = _tmp12_;
#line 104 "../src/chart.vala"
		while (TRUE) {
#line 744 "chart.c"
			GeeIterator* _tmp13_;
			LiveChartDrawable* serie = NULL;
			GeeIterator* _tmp14_;
			gpointer _tmp15_;
			LiveChartBoundaries _tmp16_;
			LiveChartBoundary _tmp17_;
			LiveChartBoundaries _tmp18_;
			LiveChartBoundary _tmp19_;
			LiveChartBoundaries _tmp20_;
			LiveChartBoundary _tmp21_;
			LiveChartBoundaries _tmp22_;
			LiveChartBoundary _tmp23_;
			LiveChartDrawable* _tmp24_;
			LiveChartConfig* _tmp25_;
#line 104 "../src/chart.vala"
			_tmp13_ = _serie_it;
#line 104 "../src/chart.vala"
			if (!gee_iterator_next (_tmp13_)) {
#line 104 "../src/chart.vala"
				break;
#line 765 "chart.c"
			}
#line 104 "../src/chart.vala"
			_tmp14_ = _serie_it;
#line 104 "../src/chart.vala"
			_tmp15_ = gee_iterator_get (_tmp14_);
#line 104 "../src/chart.vala"
			serie = (LiveChartDrawable*) ((LiveChartSerie*) _tmp15_);
#line 105 "../src/chart.vala"
			_tmp16_ = boundaries;
#line 105 "../src/chart.vala"
			_tmp17_ = _tmp16_.x;
#line 105 "../src/chart.vala"
			_tmp18_ = boundaries;
#line 105 "../src/chart.vala"
			_tmp19_ = _tmp18_.y;
#line 105 "../src/chart.vala"
			_tmp20_ = boundaries;
#line 105 "../src/chart.vala"
			_tmp21_ = _tmp20_.x;
#line 105 "../src/chart.vala"
			_tmp22_ = boundaries;
#line 105 "../src/chart.vala"
			_tmp23_ = _tmp22_.y;
#line 105 "../src/chart.vala"
			cairo_rectangle (ctx, (gdouble) _tmp17_.min, (gdouble) _tmp19_.min, (gdouble) _tmp21_.max, (gdouble) _tmp23_.max);
#line 106 "../src/chart.vala"
			cairo_clip (ctx);
#line 107 "../src/chart.vala"
			_tmp24_ = serie;
#line 107 "../src/chart.vala"
			_tmp25_ = self->config;
#line 107 "../src/chart.vala"
			live_chart_drawable_draw (_tmp24_, ctx, _tmp25_);
#line 104 "../src/chart.vala"
			_g_object_unref0 (serie);
#line 801 "chart.c"
		}
#line 104 "../src/chart.vala"
		_g_object_unref0 (_serie_it);
#line 805 "chart.c"
	}
#line 110 "../src/chart.vala"
	result = TRUE;
#line 110 "../src/chart.vala"
	return result;
#line 811 "chart.c"
}

LiveChartGrid*
live_chart_chart_get_grid (LiveChartChart* self)
{
	LiveChartGrid* result;
	LiveChartGrid* _tmp0_;
#line 13 "../src/chart.vala"
	g_return_val_if_fail (self != NULL, NULL);
#line 13 "../src/chart.vala"
	_tmp0_ = self->priv->_grid;
#line 13 "../src/chart.vala"
	result = _tmp0_;
#line 13 "../src/chart.vala"
	return result;
#line 827 "chart.c"
}

void
live_chart_chart_set_grid (LiveChartChart* self,
                           LiveChartGrid* value)
{
	LiveChartGrid* old_value;
#line 13 "../src/chart.vala"
	g_return_if_fail (self != NULL);
#line 13 "../src/chart.vala"
	old_value = live_chart_chart_get_grid (self);
#line 13 "../src/chart.vala"
	if (old_value != value) {
#line 841 "chart.c"
		LiveChartGrid* _tmp0_;
#line 13 "../src/chart.vala"
		_tmp0_ = _g_object_ref0 (value);
#line 13 "../src/chart.vala"
		_g_object_unref0 (self->priv->_grid);
#line 13 "../src/chart.vala"
		self->priv->_grid = _tmp0_;
#line 13 "../src/chart.vala"
		g_object_notify_by_pspec ((GObject *) self, live_chart_chart_properties[LIVE_CHART_CHART_GRID_PROPERTY]);
#line 851 "chart.c"
	}
}

LiveChartBackground*
live_chart_chart_get_background (LiveChartChart* self)
{
	LiveChartBackground* result;
	LiveChartBackground* _tmp0_;
#line 14 "../src/chart.vala"
	g_return_val_if_fail (self != NULL, NULL);
#line 14 "../src/chart.vala"
	_tmp0_ = self->priv->_background;
#line 14 "../src/chart.vala"
	result = _tmp0_;
#line 14 "../src/chart.vala"
	return result;
#line 868 "chart.c"
}

void
live_chart_chart_set_background (LiveChartChart* self,
                                 LiveChartBackground* value)
{
	LiveChartBackground* old_value;
#line 14 "../src/chart.vala"
	g_return_if_fail (self != NULL);
#line 14 "../src/chart.vala"
	old_value = live_chart_chart_get_background (self);
#line 14 "../src/chart.vala"
	if (old_value != value) {
#line 882 "chart.c"
		LiveChartBackground* _tmp0_;
#line 14 "../src/chart.vala"
		_tmp0_ = _g_object_ref0 (value);
#line 14 "../src/chart.vala"
		_g_object_unref0 (self->priv->_background);
#line 14 "../src/chart.vala"
		self->priv->_background = _tmp0_;
#line 14 "../src/chart.vala"
		g_object_notify_by_pspec ((GObject *) self, live_chart_chart_properties[LIVE_CHART_CHART_BACKGROUND_PROPERTY]);
#line 892 "chart.c"
	}
}

LiveChartLegend*
live_chart_chart_get_legend (LiveChartChart* self)
{
	LiveChartLegend* result;
	LiveChartLegend* _tmp0_;
#line 15 "../src/chart.vala"
	g_return_val_if_fail (self != NULL, NULL);
#line 15 "../src/chart.vala"
	_tmp0_ = self->priv->_legend;
#line 15 "../src/chart.vala"
	result = _tmp0_;
#line 15 "../src/chart.vala"
	return result;
#line 909 "chart.c"
}

void
live_chart_chart_set_legend (LiveChartChart* self,
                             LiveChartLegend* value)
{
	LiveChartLegend* old_value;
#line 15 "../src/chart.vala"
	g_return_if_fail (self != NULL);
#line 15 "../src/chart.vala"
	old_value = live_chart_chart_get_legend (self);
#line 15 "../src/chart.vala"
	if (old_value != value) {
#line 923 "chart.c"
		LiveChartLegend* _tmp0_;
#line 15 "../src/chart.vala"
		_tmp0_ = _g_object_ref0 (value);
#line 15 "../src/chart.vala"
		_g_object_unref0 (self->priv->_legend);
#line 15 "../src/chart.vala"
		self->priv->_legend = _tmp0_;
#line 15 "../src/chart.vala"
		g_object_notify_by_pspec ((GObject *) self, live_chart_chart_properties[LIVE_CHART_CHART_LEGEND_PROPERTY]);
#line 933 "chart.c"
	}
}

static void
live_chart_chart_class_init (LiveChartChartClass * klass,
                             gpointer klass_data)
{
#line 11 "../src/chart.vala"
	live_chart_chart_parent_class = g_type_class_peek_parent (klass);
#line 11 "../src/chart.vala"
	g_type_class_adjust_private_offset (klass, &LiveChartChart_private_offset);
#line 11 "../src/chart.vala"
	G_OBJECT_CLASS (klass)->get_property = _vala_live_chart_chart_get_property;
#line 11 "../src/chart.vala"
	G_OBJECT_CLASS (klass)->set_property = _vala_live_chart_chart_set_property;
#line 11 "../src/chart.vala"
	G_OBJECT_CLASS (klass)->finalize = live_chart_chart_finalize;
#line 11 "../src/chart.vala"
	g_object_class_install_property (G_OBJECT_CLASS (klass), LIVE_CHART_CHART_GRID_PROPERTY, live_chart_chart_properties[LIVE_CHART_CHART_GRID_PROPERTY] = g_param_spec_object ("grid", "grid", "grid", LIVE_CHART_TYPE_GRID, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
#line 11 "../src/chart.vala"
	g_object_class_install_property (G_OBJECT_CLASS (klass), LIVE_CHART_CHART_BACKGROUND_PROPERTY, live_chart_chart_properties[LIVE_CHART_CHART_BACKGROUND_PROPERTY] = g_param_spec_object ("background", "background", "background", LIVE_CHART_TYPE_BACKGROUND, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
#line 11 "../src/chart.vala"
	g_object_class_install_property (G_OBJECT_CLASS (klass), LIVE_CHART_CHART_LEGEND_PROPERTY, live_chart_chart_properties[LIVE_CHART_CHART_LEGEND_PROPERTY] = g_param_spec_object ("legend", "legend", "legend", LIVE_CHART_TYPE_LEGEND, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
#line 957 "chart.c"
}

static void
live_chart_chart_instance_init (LiveChartChart * self,
                                gpointer klass)
{
	LiveChartGrid* _tmp0_;
	LiveChartBackground* _tmp1_;
	LiveChartHorizontalLegend* _tmp2_;
#line 11 "../src/chart.vala"
	self->priv = live_chart_chart_get_instance_private (self);
#line 13 "../src/chart.vala"
	_tmp0_ = live_chart_grid_new ();
#line 13 "../src/chart.vala"
	self->priv->_grid = _tmp0_;
#line 14 "../src/chart.vala"
	_tmp1_ = live_chart_background_new ();
#line 14 "../src/chart.vala"
	self->priv->_background = _tmp1_;
#line 15 "../src/chart.vala"
	_tmp2_ = live_chart_horizontal_legend_new ();
#line 15 "../src/chart.vala"
	self->priv->_legend = (LiveChartLegend*) _tmp2_;
#line 19 "../src/chart.vala"
	self->priv->source_timeout = (guint) 0;
#line 983 "chart.c"
}

static void
live_chart_chart_finalize (GObject * obj)
{
	LiveChartChart * self;
#line 11 "../src/chart.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, LIVE_CHART_TYPE_CHART, LiveChartChart);
#line 13 "../src/chart.vala"
	_g_object_unref0 (self->priv->_grid);
#line 14 "../src/chart.vala"
	_g_object_unref0 (self->priv->_background);
#line 15 "../src/chart.vala"
	_g_object_unref0 (self->priv->_legend);
#line 16 "../src/chart.vala"
	_live_chart_config_unref0 (self->config);
#line 17 "../src/chart.vala"
	_g_object_unref0 (self->series);
#line 11 "../src/chart.vala"
	G_OBJECT_CLASS (live_chart_chart_parent_class)->finalize (obj);
#line 1004 "chart.c"
}

static GType
live_chart_chart_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (LiveChartChartClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) live_chart_chart_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (LiveChartChart), 0, (GInstanceInitFunc) live_chart_chart_instance_init, NULL };
	GType live_chart_chart_type_id;
	live_chart_chart_type_id = g_type_register_static (gtk_drawing_area_get_type (), "LiveChartChart", &g_define_type_info, 0);
	LiveChartChart_private_offset = g_type_add_instance_private (live_chart_chart_type_id, sizeof (LiveChartChartPrivate));
	return live_chart_chart_type_id;
}

GType
live_chart_chart_get_type (void)
{
	static volatile gsize live_chart_chart_type_id__once = 0;
	if (g_once_init_enter (&live_chart_chart_type_id__once)) {
		GType live_chart_chart_type_id;
		live_chart_chart_type_id = live_chart_chart_get_type_once ();
		g_once_init_leave (&live_chart_chart_type_id__once, live_chart_chart_type_id);
	}
	return live_chart_chart_type_id__once;
}

static void
_vala_live_chart_chart_get_property (GObject * object,
                                     guint property_id,
                                     GValue * value,
                                     GParamSpec * pspec)
{
	LiveChartChart * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, LIVE_CHART_TYPE_CHART, LiveChartChart);
#line 11 "../src/chart.vala"
	switch (property_id) {
#line 11 "../src/chart.vala"
		case LIVE_CHART_CHART_GRID_PROPERTY:
#line 11 "../src/chart.vala"
		g_value_set_object (value, live_chart_chart_get_grid (self));
#line 11 "../src/chart.vala"
		break;
#line 11 "../src/chart.vala"
		case LIVE_CHART_CHART_BACKGROUND_PROPERTY:
#line 11 "../src/chart.vala"
		g_value_set_object (value, live_chart_chart_get_background (self));
#line 11 "../src/chart.vala"
		break;
#line 11 "../src/chart.vala"
		case LIVE_CHART_CHART_LEGEND_PROPERTY:
#line 11 "../src/chart.vala"
		g_value_set_object (value, live_chart_chart_get_legend (self));
#line 11 "../src/chart.vala"
		break;
#line 1057 "chart.c"
		default:
#line 11 "../src/chart.vala"
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 11 "../src/chart.vala"
		break;
#line 1063 "chart.c"
	}
}

static void
_vala_live_chart_chart_set_property (GObject * object,
                                     guint property_id,
                                     const GValue * value,
                                     GParamSpec * pspec)
{
	LiveChartChart * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, LIVE_CHART_TYPE_CHART, LiveChartChart);
#line 11 "../src/chart.vala"
	switch (property_id) {
#line 11 "../src/chart.vala"
		case LIVE_CHART_CHART_GRID_PROPERTY:
#line 11 "../src/chart.vala"
		live_chart_chart_set_grid (self, g_value_get_object (value));
#line 11 "../src/chart.vala"
		break;
#line 11 "../src/chart.vala"
		case LIVE_CHART_CHART_BACKGROUND_PROPERTY:
#line 11 "../src/chart.vala"
		live_chart_chart_set_background (self, g_value_get_object (value));
#line 11 "../src/chart.vala"
		break;
#line 11 "../src/chart.vala"
		case LIVE_CHART_CHART_LEGEND_PROPERTY:
#line 11 "../src/chart.vala"
		live_chart_chart_set_legend (self, g_value_get_object (value));
#line 11 "../src/chart.vala"
		break;
#line 1095 "chart.c"
		default:
#line 11 "../src/chart.vala"
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
#line 11 "../src/chart.vala"
		break;
#line 1101 "chart.c"
	}
}

