graph->symbol = CIRCLE;
graph->points = g_ptr_array_new();
graph->lines = NULL;
+ graph->xaxis = graph->yaxis = NULL;
}
Graph *graph_new(void) {
}
int graph_add_graph_line(Graph* graph, struct graph_line *l) {
+ if(l == NULL) return 1;
if(graph->lines == NULL) {
if((graph->lines = g_ptr_array_new()) == NULL) return 1;
}
*x2 = (x3-2.0*(*x1))/3.0;
*x1 = (x0-2.0*(*x1))/3.0;
}
+
+void graph_set_xaxis(Graph *g, struct graph_axis *axis) {
+ if(g->xaxis != NULL) {
+ free(g->xaxis);
+ }
+ g->xaxis=axis;
+}
+void graph_set_yaxis(Graph *g, struct graph_axis *axis) {
+ if(g->yaxis != NULL) {
+ free(g->yaxis);
+ }
+ g->yaxis=axis;
+}
+
+void graph_autoset_xaxis(Graph *g) {
+ struct graph_axis *axis;
+ if((axis=(struct graph_axis *)malloc(sizeof(struct graph_axis))) == NULL) {
+ return 1;
+ }
+ graph_set_xaxis(g, axis);
+}
+
+void graph_autoset_yaxis(Graph *g) {
+ struct graph_axis *axis;
+ if((axis=(struct graph_axis *)malloc(sizeof(struct graph_axis))) == NULL) {
+ return 1;
+ }
+ graph_set_xaxis(g, axis);
+}
double p3_y;
};
+struct graph_axis {
+ double start;
+ double step;
+ int xminor;
+ int subminor;
+ GString title;
+};
+
typedef struct _Graph {
GObject parent_instance;
/*Array of n_points sets of x,y coords*/
double maxy;
double miny;
graph_symbol symbol;
+ struct graph_axis *xaxis;
+ struct graph_axis *yaxis;
} Graph;
typedef struct _GraphClass {
}
if(bow != NULL) {
if((p1_x = g_hash_table_lookup(bow->properties, propmap->xprop->str)) != NULL) {
- l->p1_x = *p1_x;
+ l->p1_x = *p1_x/2.0;
graph_bezier_quadratic_to_cubic(l->p0_x, l->p3_x, &(l->p1_x), &(l->p2_x));
}else{
graph_bezier_linear_to_cubic(l->p0_x, l->p3_x, &(l->p1_x), &(l->p2_x));
}
if((p1_y = g_hash_table_lookup(bow->properties, propmap->yprop->str)) != NULL) {
- l->p1_y = *p1_y;
+ l->p1_y = *p1_y/2.0;
graph_bezier_quadratic_to_cubic(l->p0_y, l->p3_y, &(l->p1_y), &(l->p2_y));
}else{
graph_bezier_linear_to_cubic(l->p0_y, l->p3_y, &(l->p1_y), &(l->p2_y));