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);
+}