gnome-power-manager r3078 - in trunk: . src



Author: rhughes
Date: Sat Nov  8 16:25:44 2008
New Revision: 3078
URL: http://svn.gnome.org/viewvc/gnome-power-manager?rev=3078&view=rev

Log:
2008-11-08  Richard Hughes  <richard hughsie com>

* src/gpm-graph-widget.c: (gpm_graph_widget_auto_range),
(gpm_graph_widget_draw_line), (gpm_graph_widget_draw_graph):
Fix the graph autoranging when the values are negative.


Modified:
   trunk/ChangeLog
   trunk/src/gpm-graph-widget.c

Modified: trunk/src/gpm-graph-widget.c
==============================================================================
--- trunk/src/gpm-graph-widget.c	(original)
+++ trunk/src/gpm-graph-widget.c	Sat Nov  8 16:25:44 2008
@@ -559,7 +559,7 @@
 	if (graph->priv->axis_type_x == GPM_GRAPH_WIDGET_TYPE_PERCENTAGE) {
 		if (graph->priv->stop_x >= 90)
 			graph->priv->stop_x = 100;
-		if (graph->priv->start_x <= 10)
+		if (graph->priv->start_x > 0 && graph->priv->start_x <= 10)
 			graph->priv->start_x = 0;
 	} else if (graph->priv->axis_type_x == GPM_GRAPH_WIDGET_TYPE_TIME) {
 		if (graph->priv->start_x > 0 && graph->priv->start_x <= 60*10)
@@ -568,7 +568,7 @@
 	if (graph->priv->axis_type_y == GPM_GRAPH_WIDGET_TYPE_PERCENTAGE) {
 		if (graph->priv->stop_y >= 90)
 			graph->priv->stop_y = 100;
-		if (graph->priv->start_y <= 10)
+		if (graph->priv->start_y > 0 && graph->priv->start_y <= 10)
 			graph->priv->start_y = 0;
 	} else if (graph->priv->axis_type_y == GPM_GRAPH_WIDGET_TYPE_TIME) {
 		if (graph->priv->start_y <= 60*10)
@@ -668,9 +668,10 @@
 	GpmPointObj *point;
 	guint i;
 
-	if (graph->priv->data_list->len == 0)
+	if (graph->priv->data_list->len == 0) {
 		egg_debug ("no data");
 		return;
+	}
 	cairo_save (cr);
 
 	/* do all the line on the graph */
@@ -839,7 +840,6 @@
 	g_return_if_fail (GPM_IS_GRAPH_WIDGET (graph));
 
 	gpm_graph_widget_legend_calculate_size (graph, cr, &legend_width, &legend_height);
-
 	cairo_save (cr);
 
 	/* we need this so we know the y text */
@@ -864,10 +864,8 @@
 	/* graph background */
 	gpm_graph_widget_draw_bounding_box (cr, graph->priv->box_x, graph->priv->box_y,
 				     graph->priv->box_width, graph->priv->box_height);
-
-	if (graph->priv->use_grid) {
+	if (graph->priv->use_grid)
 		gpm_graph_widget_draw_grid (graph, cr);
-	}
 
 	/* -3 is so we can keep the lines inside the box at both extremes */
 	data_x = graph->priv->stop_x - graph->priv->start_x;



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