2
* Picviz - Parallel coordinates ploter
3
* Copyright (C) 2008 Sebastien Tricaud <toady@gscore.org>
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation version 3.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
* $Id: axis.c 374 2009-01-20 18:08:24Z toady $
25
#include <linuxlist.h>
36
* \brief Create and manipulate axes
39
static unsigned int id = 0;
42
PicvizAxis *picviz_axis_new(void)
44
PicvizAxis *axis = NULL;
46
axis = malloc(sizeof(*axis));
48
fprintf(stderr, "Cannot initialize axis: memory exhausted.\n");
51
INIT_LLIST_HEAD(&axis->list);
53
axis->type = DATATYPE_EMPTY;
55
axis->ymin = ~0; /* FIXME: that must be auto-adaptative */
58
picviz_properties_new(&axis->props);
59
picviz_properties_set(axis->props, "label", "");
60
picviz_properties_set(axis->props, "color", "#000000");
65
void picviz_axis_destroy(PicvizAxis *axis)
67
picviz_properties_destroy(axis->props);
71
PicvizAxis *picviz_axis_get(PicvizImage *i, unsigned int id)
75
llist_for_each_entry(a, &i->axes, list) {
83
void picviz_axis_set_type(PicvizAxis *axis, PicvizDataType type)
88
void picviz_axis_set_type_from_string(PicvizAxis *axis, char *string)
90
if (!strcmp(string, "timeline")) {
91
axis->type = DATATYPE_TIMELINE;
94
if (!strcmp(string, "integer")) {
95
axis->type = DATATYPE_INTEGER;
98
if (!strcmp(string, "string")) {
99
axis->type = DATATYPE_STRING;
102
if (!strcmp(string, "float")) {
103
axis->type = DATATYPE_FLOAT;
106
if (!strcmp(string, "short")) {
107
axis->type = DATATYPE_SHORT;
110
if (!strcmp(string, "ipv4")) {
111
axis->type = DATATYPE_IPV4;
114
if (!strcmp(string, "char")) {
115
axis->type = DATATYPE_CHAR;
118
if (!strcmp(string, "gold")) {
119
axis->type = DATATYPE_GOLD;
122
if (!strcmp(string, "years")) {
123
axis->type = DATATYPE_YEARS;
126
if (!strcmp(string, "enum")) {
127
axis->type = DATATYPE_ENUM;
130
if (!strcmp(string, "ln")) {
131
axis->type = DATATYPE_LN;
134
if (!strcmp(string, "port")) {
135
axis->type = DATATYPE_PORT;
139
axis->type = DATATYPE_EMPTY;
142
char *picviz_axis_get_string_from_type(PicvizAxis *axis)
145
case DATATYPE_TIMELINE:
148
case DATATYPE_INTEGER:
151
case DATATYPE_STRING:
179
return "*** error ***";
185
PicvizAxisPlot *picviz_axisplot_new(void)
187
PicvizAxisPlot *axisplot;
189
axisplot = malloc(sizeof(*axisplot));
191
fprintf(stderr, "Cannot initalize axisplot: memory exhaustred.\n");
195
axisplot->strval = NULL;
197
axisplot->axis_id = 0;
198
picviz_properties_new(&axisplot->props);
203
void picviz_axisplot_destroy(PicvizAxisPlot *axisplot)
205
picviz_properties_destroy(axisplot->props);