1 /* gtkplot - 2d scientific plots widget for gtk+ 2 * Copyright 1999-2001 Adrian E. Feiguin <feiguin@ifir.edu.ar> 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Library General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library 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 GNU 12 * Library General Public License for more details. 13 * 14 * You should have received a copy of the GNU Library General Public 15 * License along with this library; if not, write to the 16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 * Boston, MA 02111-1307, USA. 18 */ 19 #ifndef __GTK_PLOT_H__ 20 #define __GTK_PLOT_H__ 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif /* __cplusplus */ 25 26 #include "gtkplotpc.h" 27 #include "gtkplotarray.h" 28 29 #define GTK_PLOT(obj) GTK_CHECK_CAST (obj, gtk_plot_get_type (), GtkPlot) 30 31 #define GTK_TYPE_PLOT (gtk_plot_get_type ()) 32 33 #define GTK_PLOT_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_plot_get_type(), GtkPlotClass) 34 #define GTK_IS_PLOT(obj) GTK_CHECK_TYPE (obj, gtk_plot_get_type ()) 35 #define GTK_PLOT_AXIS(obj) GTK_CHECK_CAST (obj, gtk_plot_axis_get_type (), GtkPlotAxis) 36 37 #define GTK_TYPE_PLOT_AXIS (gtk_plot_axis_get_type ()) 38 #define GTK_IS_PLOT_AXIS(obj) GTK_CHECK_TYPE (obj, gtk_plot_axis_get_type ()) 39 40 typedef struct _GtkPlot GtkPlot; 41 typedef struct _GtkPlotClass GtkPlotClass; 42 typedef struct _GtkPlotData GtkPlotData; 43 typedef struct _GtkPlotDataClass GtkPlotDataClass; 44 typedef struct _GtkPlotAxis GtkPlotAxis; 45 typedef struct _GtkPlotAxisClass GtkPlotAxisClass; 46 typedef struct _GtkPlotText GtkPlotText; 47 typedef struct _GtkPlotLine GtkPlotLine; 48 typedef struct _GtkPlotSymbol GtkPlotSymbol; 49 typedef struct _GtkPlotTick GtkPlotTick; 50 typedef struct _GtkPlotTicks GtkPlotTicks; 51 typedef struct _GtkPlotVector GtkPlotVector; 52 typedef struct _GtkPlotMarker GtkPlotMarker; 53 54 55 typedef gdouble (*GtkPlotFunc) (GtkPlot *plot, 56 GtkPlotData *data, 57 gdouble x, 58 gboolean *error); 59 60 typedef gdouble (*GtkPlotFunc3D) (GtkPlot *plot, 61 GtkPlotData *data, 62 gdouble x, gdouble y, 63 gboolean *error); 64 65 typedef void (*GtkPlotIterator) (GtkPlot *plot, 66 GtkPlotData *data, 67 gint iter, 68 gdouble *x, 69 gdouble *y, 70 gdouble *z, 71 gdouble *a, 72 gdouble *dx, 73 gdouble *dy, 74 gdouble *dz, 75 gdouble *da, 76 gchar **label, 77 gboolean *error); 78 79 enum 80 { 81 GTK_PLOT_DATA_X = 1 << 0, 82 GTK_PLOT_DATA_Y = 1 << 1, 83 GTK_PLOT_DATA_Z = 1 << 2, 84 GTK_PLOT_DATA_A = 1 << 3, 85 GTK_PLOT_DATA_DX = 1 << 4, 86 GTK_PLOT_DATA_DY = 1 << 5, 87 GTK_PLOT_DATA_DZ = 1 << 6, 88 GTK_PLOT_DATA_DA = 1 << 7, 89 GTK_PLOT_DATA_LABELS = 1 << 8, 90 }; 91 92 typedef enum 93 { 94 GTK_PLOT_SCALE_LINEAR , 95 GTK_PLOT_SCALE_LOG10 96 } GtkPlotScale; 97 98 typedef enum 99 { 100 GTK_PLOT_SYMBOL_NONE , 101 GTK_PLOT_SYMBOL_SQUARE , 102 GTK_PLOT_SYMBOL_CIRCLE , 103 GTK_PLOT_SYMBOL_UP_TRIANGLE , 104 GTK_PLOT_SYMBOL_DOWN_TRIANGLE , 105 GTK_PLOT_SYMBOL_RIGHT_TRIANGLE , 106 GTK_PLOT_SYMBOL_LEFT_TRIANGLE , 107 GTK_PLOT_SYMBOL_DIAMOND , 108 GTK_PLOT_SYMBOL_PLUS , 109 GTK_PLOT_SYMBOL_CROSS , 110 GTK_PLOT_SYMBOL_STAR , 111 GTK_PLOT_SYMBOL_DOT , 112 GTK_PLOT_SYMBOL_IMPULSE , 113 } GtkPlotSymbolType; 114 115 typedef enum 116 { 117 GTK_PLOT_SYMBOL_EMPTY , 118 GTK_PLOT_SYMBOL_FILLED , 119 GTK_PLOT_SYMBOL_OPAQUE 120 } GtkPlotSymbolStyle; 121 122 typedef enum 123 { 124 GTK_PLOT_BORDER_NONE , 125 GTK_PLOT_BORDER_LINE , 126 GTK_PLOT_BORDER_SHADOW , 127 } GtkPlotBorderStyle; 128 129 typedef enum 130 { 131 GTK_PLOT_LINE_NONE , 132 GTK_PLOT_LINE_SOLID , 133 GTK_PLOT_LINE_DOTTED , 134 GTK_PLOT_LINE_DASHED , 135 GTK_PLOT_LINE_DOT_DASH , 136 GTK_PLOT_LINE_DOT_DOT_DASH , 137 GTK_PLOT_LINE_DOT_DASH_DASH 138 } GtkPlotLineStyle; 139 140 typedef enum 141 { 142 GTK_PLOT_CONNECT_NONE , 143 GTK_PLOT_CONNECT_STRAIGHT , 144 GTK_PLOT_CONNECT_SPLINE , 145 GTK_PLOT_CONNECT_HV_STEP , 146 GTK_PLOT_CONNECT_VH_STEP , 147 GTK_PLOT_CONNECT_MIDDLE_STEP 148 } GtkPlotConnector; 149 150 typedef enum 151 { 152 GTK_PLOT_LABEL_NONE = 0, 153 GTK_PLOT_LABEL_IN = 1 << 0, 154 GTK_PLOT_LABEL_OUT = 1 << 1, 155 }GtkPlotLabelPos; 156 157 typedef enum 158 { 159 GTK_PLOT_ERROR_DIV_ZERO, 160 GTK_PLOT_ERROR_LOG_NEG 161 } GtkPlotError; 162 163 typedef enum 164 { 165 GTK_PLOT_AXIS_X , 166 GTK_PLOT_AXIS_Y , 167 GTK_PLOT_AXIS_Z , 168 } GtkPlotOrientation; 169 170 typedef enum 171 { 172 GTK_PLOT_AXIS_LEFT , 173 GTK_PLOT_AXIS_RIGHT , 174 GTK_PLOT_AXIS_TOP , 175 GTK_PLOT_AXIS_BOTTOM 176 } GtkPlotAxisPos; 177 178 typedef enum 179 { 180 GTK_PLOT_LABEL_FLOAT , 181 GTK_PLOT_LABEL_EXP , 182 GTK_PLOT_LABEL_POW 183 } GtkPlotLabelStyle; 184 185 typedef enum 186 { 187 GTK_PLOT_TICKS_NONE = 0, 188 GTK_PLOT_TICKS_IN = 1 << 0, 189 GTK_PLOT_TICKS_OUT = 1 << 1 190 } GtkPlotTicksPos; 191 192 enum 193 { 194 GTK_PLOT_GRADIENT_H = 1 << 0, 195 GTK_PLOT_GRADIENT_V = 1 << 1, 196 GTK_PLOT_GRADIENT_S = 1 << 2, 197 }; 198 199 struct _GtkPlotMarker 200 { 201 GtkPlotData *data; 202 gint point; 203 }; 204 205 struct _GtkPlotText 206 { 207 gdouble x, y; 208 gint angle; /* 0, 90, 180, 270 */ 209 GdkColor fg; 210 GdkColor bg; 211 212 gboolean transparent; 213 214 GtkPlotBorderStyle border; 215 gint border_width; 216 gint shadow_width; 217 gint border_space; 218 219 gchar *font; 220 gint height; 221 222 gchar *text; 223 224 GtkJustification justification; 225 }; 226 227 struct _GtkPlotLine 228 { 229 GtkPlotLineStyle line_style; 230 GdkCapStyle cap_style; 231 GdkJoinStyle join_style; 232 233 gfloat line_width; 234 GdkColor color; 235 }; 236 237 struct _GtkPlotSymbol 238 { 239 GtkPlotSymbolType symbol_type; 240 GtkPlotSymbolStyle symbol_style; 241 242 gint size; 243 244 GdkColor color; 245 GtkPlotLine border; 246 }; 247 248 struct _GtkPlotVector 249 { 250 gdouble x, y, z; 251 }; 252 253 struct _GtkPlotTick 254 { 255 gdouble value; 256 gboolean minor; 257 }; 258 259 struct _GtkPlotTicks 260 { 261 gdouble min; 262 gdouble max; 263 264 GtkPlotScale scale; 265 266 gint nmajorticks; /* Number of major ticks drawn */ 267 gint nminorticks; /* Number of minor ticks drawn */ 268 gint nticks; /* total number of ticks */ 269 270 gdouble step; /* major ticks step */ 271 gint nminor; /* number of minor ticks between major ticks */ 272 273 gboolean apply_break; 274 GtkPlotScale break_scale; 275 gdouble break_step; 276 gint break_nminor; 277 gdouble break_min; 278 gdouble break_max; 279 gdouble break_position; 280 281 GtkPlotTick *values; 282 283 gboolean set_limits; 284 gdouble begin, end; 285 }; 286 287 struct _GtkPlotAxis 288 { 289 GtkObject object; 290 291 gboolean is_visible; 292 293 GtkPlotVector origin; 294 GtkPlotVector direction; 295 296 GtkPlotText title; 297 gboolean title_visible; 298 299 GtkPlotTicks ticks; 300 301 GtkPlotOrientation orientation; 302 303 GtkPlotLine line; 304 GtkPlotLine major_grid; 305 GtkPlotLine minor_grid; 306 307 gint major_mask; 308 gint minor_mask; 309 gint ticks_length; 310 gfloat ticks_width; 311 312 gboolean custom_labels; 313 314 gint labels_offset; 315 316 gchar *labels_prefix; 317 gchar *labels_suffix; 318 319 gboolean show_major_grid; 320 gboolean show_minor_grid; 321 322 GtkPlotText labels_attr; 323 324 gint label_precision; 325 gint label_style; 326 gint label_mask; 327 328 GtkPlotArray *tick_labels; 329 330 void (*ticks_recalc) (GtkPlotAxis *axis); 331 void (*ticks_autoscale) (GtkPlotAxis *axis, 332 gdouble xmin, gdouble xmax, 333 gint *precision); 334 gdouble (*ticks_transform) (GtkPlotAxis *axis, gdouble y); 335 gdouble (*ticks_inverse) (GtkPlotAxis *axis, gdouble y); 336 void (*parse_label) (GtkPlotAxis *axis, 337 gdouble val, 338 gint precision, 339 gint style, 340 gchar *label); 341 }; 342 343 struct _GtkPlotData 344 { 345 GtkWidget widget; 346 347 gboolean is_function; 348 gboolean is_iterator; 349 350 guint16 iterator_mask; 351 352 gboolean show_legend; 353 gboolean show_labels; 354 gboolean fill_area; 355 356 gchar *name; 357 gchar *legend; 358 359 GtkPlot *plot; 360 361 GtkPlotSymbol symbol; 362 GtkPlotLine line; 363 GtkPlotConnector line_connector; 364 365 GtkPlotLine x_line; 366 GtkPlotLine y_line; 367 GtkPlotLine z_line; 368 369 gboolean show_xerrbars; 370 gint xerrbar_width; 371 gint xerrbar_caps; 372 373 gboolean show_yerrbars; 374 gint yerrbar_width; 375 gint yerrbar_caps; 376 377 gboolean show_zerrbars; 378 gint zerrbar_width; 379 gint zerrbar_caps; 380 381 gint num_points; 382 383 GtkPlotArrayList *data; 384 385 gint labels_offset; 386 GtkPlotText labels_attr; 387 388 GtkPlotFunc function; 389 GtkPlotFunc3D function3d; 390 GtkPlotIterator iterator; 391 392 gdouble x_step; 393 gdouble y_step; 394 gdouble z_step; 395 396 GdkColor color_min, color_max; 397 GdkColor color_lt_min, color_gt_max; 398 gint gradient_mask; 399 GtkPlotAxis * gradient; 400 gboolean gradient_custom; 401 GdkColor *gradient_colors; 402 403 gboolean show_gradient; 404 gint legends_precision; 405 GtkPlotLabelStyle legends_style; 406 407 gpointer link; 408 409 GList *markers; 410 gboolean show_markers; 411 412 gboolean redraw_pending; 413 414 GtkPlotAxisPos gradient_title_pos; 415 gint gradient_line_width; 416 gint gradient_line_height; 417 gdouble gradient_x, gradient_y; 418 419 GtkPlotBorderStyle gradient_border; 420 gint gradient_border_offset; 421 gint gradient_border_width; 422 gint gradient_shadow_width; 423 }; 424 425 struct _GtkPlot 426 { 427 GtkWidget widget; 428 429 GtkAllocation internal_allocation; 430 431 GdkDrawable *drawable; 432 433 GdkPixmap *bg_pixmap; 434 gboolean use_pixmap; 435 436 gboolean transparent; 437 438 gdouble magnification; 439 440 gboolean clip_data; 441 442 GdkColor background; 443 444 gboolean grids_on_top; 445 gboolean show_x0; 446 gboolean show_y0; 447 448 /* location and size in percentage of the widget's size */ 449 gdouble x, y, width, height; 450 451 gdouble xmin, xmax; 452 gdouble ymin, ymax; 453 454 GtkPlotScale xscale, yscale; 455 456 GtkPlotAxis *bottom; 457 GtkPlotAxis *top; 458 GtkPlotAxis *left; 459 GtkPlotAxis *right; 460 461 gboolean reflect_x; 462 gboolean reflect_y; 463 464 gfloat bottom_align; 465 gfloat top_align; 466 gfloat left_align; 467 gfloat right_align; 468 469 GtkPlotLine x0_line; 470 GtkPlotLine y0_line; 471 472 gdouble legends_x, legends_y; /* position in % */ 473 gint legends_width, legends_height; /* absolute size */ 474 475 GtkPlotBorderStyle legends_border; 476 gint legends_line_width; 477 gint legends_border_width; 478 gint legends_shadow_width; 479 gboolean show_legends; 480 GtkPlotText legends_attr; 481 482 GList *data_sets; 483 GList *text; 484 485 GtkPlotPC *pc; 486 }; 487 488 struct _GtkPlotClass 489 { 490 GtkWidgetClass parent_class; 491 492 void (* set_pc) (GtkPlot *plot, GtkPlotPC *pc); 493 void (* set_drawable) (GtkPlot *plot, GdkDrawable *drawable); 494 gboolean (* add_data) (GtkPlot *plot, GtkPlotData *data); 495 void (* update) (GtkPlot *plot, gboolean new_range); 496 void (* changed) (GtkPlot *plot); 497 498 gboolean (* moved) (GtkPlot *plot, 499 gdouble x, gdouble y); 500 501 gboolean (* resized) (GtkPlot *plot, 502 gdouble width, gdouble height); 503 504 void (* plot_paint) (GtkWidget *plot); 505 506 void (* draw_legends) (GtkWidget *plot); 507 508 void (* get_pixel) (GtkWidget *plot, 509 gdouble x, gdouble y, 510 gdouble *px, gdouble *py); 511 512 void (* get_point) (GtkWidget *plot, 513 gint px, gint py, 514 gdouble *x, gdouble *y); 515 516 /* 517 void (* error) (GtkPlot *plot, gint errno); 518 */ 519 }; 520 521 struct _GtkPlotDataClass 522 { 523 GtkWidgetClass parent_class; 524 525 gboolean (* add_to_plot) (GtkPlotData *data, GtkPlot *plot); 526 void (* update) (GtkPlotData *data, gboolean new_range); 527 void (* gradient_changed) (GtkPlotData *data); 528 void (* gradient_colors_changed) (GtkPlotData *data); 529 void (* draw_data) (GtkPlotData *data); 530 void (* draw_symbol) (GtkPlotData *data, 531 gdouble x, 532 gdouble y, 533 gdouble z, 534 gdouble a, 535 gdouble dx, 536 gdouble dy, 537 gdouble dz, 538 gdouble da); 539 void (* draw_legend) (GtkPlotData *data, gint x, gint y); 540 void (* get_legend_size) (GtkPlotData *data, 541 gint *width, gint *height); 542 void (* draw_gradient) (GtkPlotData *data); 543 void (* get_gradient_size) (GtkPlotData *data, 544 gint *width, gint *height); 545 546 void (* clone) (GtkPlotData *data, GtkPlotData *copy); 547 /* 548 void (* error) (GtkPlotData *data, gint errno); 549 */ 550 }; 551 552 struct _GtkPlotAxisClass 553 { 554 GtkObjectClass parent_class; 555 556 gboolean (* tick_label) (GtkPlotAxis *axis, 557 gdouble *tick, 558 gchar *label); 559 gboolean (* changed) (GtkPlotAxis *axis); 560 }; 561 562 563 /* Plot */ 564 565 GtkType gtk_plot_get_type (void); 566 GtkWidget* gtk_plot_new (GdkDrawable *drawable); 567 GtkWidget* gtk_plot_new_with_size (GdkDrawable *drawable, 568 gdouble width, gdouble height); 569 void gtk_plot_construct (GtkPlot *plot, 570 GdkDrawable *drawable); 571 void gtk_plot_construct_with_size (GtkPlot *plot, 572 GdkDrawable *drawable, 573 gdouble width, gdouble height); 574 void gtk_plot_set_drawable (GtkPlot *plot, 575 GdkDrawable *drawable); 576 GdkDrawable * gtk_plot_get_drawable (GtkPlot *plot); 577 void gtk_plot_set_pc (GtkPlot *plot, 578 GtkPlotPC *pc); 579 void gtk_plot_set_background_pixmap (GtkPlot *plot, 580 GdkPixmap *pixmap); 581 void gtk_plot_set_transparent (GtkPlot *plot, 582 gboolean transparent); 583 gboolean gtk_plot_is_transparent (GtkPlot *plot); 584 void gtk_plot_get_position (GtkPlot *plot, 585 gdouble *x, gdouble *y); 586 void gtk_plot_get_size (GtkPlot *plot, 587 gdouble *width, 588 gdouble *height); 589 GtkAllocation gtk_plot_get_internal_allocation(GtkPlot *plot); 590 void gtk_plot_set_background (GtkPlot *plot, 591 const GdkColor *background); 592 void gtk_plot_paint (GtkPlot *plot); 593 void gtk_plot_refresh (GtkPlot *plot, 594 GdkRectangle *area); 595 void gtk_plot_move (GtkPlot *plot, 596 gdouble x, gdouble y); 597 void gtk_plot_resize (GtkPlot *plot, 598 gdouble width, gdouble height); 599 void gtk_plot_set_magnification (GtkPlot *plot, 600 gdouble magnification); 601 void gtk_plot_move_resize (GtkPlot *plot, 602 gdouble x, gdouble y, 603 gdouble width, gdouble height); 604 void gtk_plot_get_pixel (GtkPlot *plot, 605 gdouble xx, gdouble yy, 606 gdouble *x, gdouble *y); 607 void gtk_plot_get_point (GtkPlot *plot, 608 gint x, gint y, 609 gdouble *xx, gdouble *yy); 610 void gtk_plot_clip_data (GtkPlot *plot, gboolean clip); 611 void gtk_plot_set_xrange (GtkPlot *plot, 612 gdouble xmin, gdouble xmax); 613 void gtk_plot_set_yrange (GtkPlot *plot, 614 gdouble ymin, gdouble ymax); 615 void gtk_plot_set_range (GtkPlot *plot, 616 gdouble xmin, gdouble xmax, 617 gdouble ymin, gdouble ymax); 618 void gtk_plot_autoscale (GtkPlot *plot); 619 void gtk_plot_get_xrange (GtkPlot *plot, 620 gdouble *xmin, gdouble *xmax); 621 void gtk_plot_get_yrange (GtkPlot *plot, 622 gdouble *ymin, gdouble *ymax); 623 void gtk_plot_set_xscale (GtkPlot *plot, 624 GtkPlotScale scale_type); 625 void gtk_plot_set_yscale (GtkPlot *plot, 626 GtkPlotScale scale_type); 627 GtkPlotScale gtk_plot_get_xscale (GtkPlot *plot); 628 GtkPlotScale gtk_plot_get_yscale (GtkPlot *plot); 629 void gtk_plot_reflect_x (GtkPlot *plot, 630 gboolean reflect); 631 void gtk_plot_reflect_y (GtkPlot *plot, 632 gboolean reflect); 633 gboolean gtk_plot_is_x_reflected (GtkPlot *plot); 634 gboolean gtk_plot_is_y_reflected (GtkPlot *plot); 635 GtkPlotText * gtk_plot_put_text (GtkPlot *plot, 636 gdouble x, gdouble y, 637 const gchar *font, 638 gint height, 639 gint angle, 640 const GdkColor *foreground, 641 const GdkColor *background, 642 gboolean transparent, 643 GtkJustification justification, 644 const gchar *text); 645 gint gtk_plot_remove_text (GtkPlot *plot, 646 GtkPlotText *text); 647 648 void gtk_plot_text_get_size (const gchar *text, 649 gint angle, 650 const gchar *font_name, 651 gint font_size, 652 gint *width, gint *height, 653 gint *ascent, gint *descent); 654 void gtk_plot_text_get_area (const gchar *text, 655 gint angle, 656 GtkJustification just, 657 const gchar *font_name, 658 gint font_size, 659 gint *x, gint *y, 660 gint *width, gint *height); 661 void gtk_plot_text_set_attributes (GtkPlotText *text_attr, 662 const gchar *font, 663 gint height, 664 gint angle, 665 const GdkColor *fg, 666 const GdkColor *bg, 667 gboolean transparent, 668 GtkJustification justification, 669 const gchar *text); 670 void gtk_plot_text_set_border (GtkPlotText *text, 671 GtkPlotBorderStyle border, 672 gint border_space, 673 gint border_width, 674 gint shadow_width); 675 void gtk_plot_draw_line (GtkPlot *plot, 676 GtkPlotLine line, 677 gdouble x1, gdouble y1, 678 gdouble x2, gdouble y2); 679 void gtk_plot_draw_text (GtkPlot *plot, 680 GtkPlotText text); 681 void gtk_plot_set_ticks (GtkPlot *plot, 682 GtkPlotOrientation orientation, 683 gdouble major_step, 684 gint nminor); 685 void gtk_plot_set_major_ticks (GtkPlot *plot, 686 GtkPlotOrientation orientation, 687 gdouble major_step); 688 void gtk_plot_set_minor_ticks (GtkPlot *plot, 689 GtkPlotOrientation orientation, 690 gint nminor); 691 void gtk_plot_set_ticks_limits (GtkPlot *plot, 692 GtkPlotOrientation orientation, 693 gdouble begin, gdouble end); 694 void gtk_plot_unset_ticks_limits(GtkPlot *plot, 695 GtkPlotOrientation orientation); 696 void gtk_plot_set_break (GtkPlot *plot, 697 GtkPlotOrientation orient, 698 gdouble min, gdouble max, 699 gdouble step_after, 700 gint nminor_after, 701 GtkPlotScale scale_after, 702 gdouble pos); 703 void gtk_plot_remove_break (GtkPlot *plot, 704 GtkPlotOrientation orient); 705 706 /* Axis */ 707 708 GtkType gtk_plot_axis_get_type (void); 709 GtkObject* gtk_plot_axis_new (GtkPlotOrientation orientation); 710 void gtk_plot_axis_construct (GtkPlotAxis *axis, 711 GtkPlotOrientation orientation); 712 GtkPlotAxis * gtk_plot_get_axis (GtkPlot *plot, 713 GtkPlotAxisPos axis); 714 void gtk_plot_axis_set_visible (GtkPlotAxis *axis, 715 gboolean visible); 716 gboolean gtk_plot_axis_visible (GtkPlotAxis *axis); 717 void gtk_plot_axis_set_title (GtkPlotAxis *axis, 718 const gchar *title); 719 void gtk_plot_axis_show_title (GtkPlotAxis *axis); 720 void gtk_plot_axis_hide_title (GtkPlotAxis *axis); 721 void gtk_plot_axis_move_title (GtkPlotAxis *axis, 722 gint angle, 723 gdouble x, gdouble y); 724 void gtk_plot_axis_justify_title (GtkPlotAxis *axis, 725 GtkJustification justification); 726 void gtk_plot_axis_set_attributes (GtkPlotAxis *axis, 727 gfloat width, 728 const GdkColor *color); 729 void gtk_plot_axis_get_attributes (GtkPlotAxis *axis, 730 gfloat *width, 731 GdkColor *color); 732 void gtk_plot_axis_set_ticks (GtkPlotAxis *axis, 733 gdouble major_step, 734 gint nminor); 735 void gtk_plot_axis_set_major_ticks (GtkPlotAxis *axis, 736 gdouble major_step); 737 void gtk_plot_axis_set_minor_ticks (GtkPlotAxis *axis, 738 gint nminor); 739 void gtk_plot_axis_set_ticks_length (GtkPlotAxis *axis, 740 gint length); 741 void gtk_plot_axis_set_ticks_width (GtkPlotAxis *axis, 742 gfloat width); 743 void gtk_plot_axis_show_ticks (GtkPlotAxis *axis, 744 gint major_mask, 745 gint minor_mask); 746 void gtk_plot_axis_set_ticks_limits (GtkPlotAxis *axis, 747 gdouble begin, gdouble end); 748 void gtk_plot_axis_unset_ticks_limits(GtkPlotAxis *axis); 749 void gtk_plot_axis_set_tick_labels (GtkPlotAxis *axis, 750 GtkPlotArray *array); 751 void gtk_plot_axis_set_break (GtkPlotAxis *axis, 752 gdouble min, gdouble max, 753 gdouble step_after, 754 gint nminor_after, 755 GtkPlotScale scale_after, 756 gdouble pos); 757 void gtk_plot_axis_remove_break (GtkPlotAxis *axis); 758 void gtk_plot_axis_show_labels (GtkPlotAxis *axis, 759 gint labels_mask); 760 void gtk_plot_axis_title_set_attributes 761 (GtkPlotAxis *axis, 762 const gchar *font, 763 gint height, 764 gint angle, 765 const GdkColor *foreground, 766 const GdkColor *background, 767 gboolean transparent, 768 GtkJustification justification); 769 void gtk_plot_axis_set_labels_attributes 770 (GtkPlotAxis *axis, 771 const gchar *font, 772 gint height, 773 gint angle, 774 const GdkColor *foreground, 775 const GdkColor *background, 776 gboolean transparent, 777 GtkJustification justification); 778 #define gtk_plot_axis_set_labels_numbers gtk_plot_axis_set_labels_style 779 void gtk_plot_axis_set_labels_style (GtkPlotAxis *axis, 780 GtkPlotLabelStyle style, 781 gint precision); 782 void gtk_plot_axis_set_labels_offset (GtkPlotAxis *axis, 783 gint offset); 784 gint gtk_plot_axis_get_labels_offset (GtkPlotAxis *axis); 785 void gtk_plot_axis_use_custom_tick_labels 786 (GtkPlotAxis *axis, 787 gboolean use); 788 void gtk_plot_axis_set_labels_suffix (GtkPlotAxis *axis, 789 const gchar *text); 790 void gtk_plot_axis_set_labels_prefix (GtkPlotAxis *axis, 791 const gchar *text); 792 gchar * gtk_plot_axis_get_labels_suffix (GtkPlotAxis *axis); 793 gchar * gtk_plot_axis_get_labels_prefix (GtkPlotAxis *axis); 794 795 void gtk_plot_axis_ticks_recalc (GtkPlotAxis *axis); 796 void gtk_plot_axis_ticks_autoscale (GtkPlotAxis *axis, 797 gdouble xmin, gdouble xmax, 798 gint *precision); 799 gdouble gtk_plot_axis_ticks_transform (GtkPlotAxis *axis, 800 gdouble y); 801 gdouble gtk_plot_axis_ticks_inverse (GtkPlotAxis *axis, 802 gdouble x); 803 void gtk_plot_axis_parse_label (GtkPlotAxis *axis, 804 gdouble val, 805 gint precision, 806 gint style, 807 gchar *label); 808 /* Grids */ 809 void gtk_plot_x0_set_visible (GtkPlot *plot, 810 gboolean visible); 811 gboolean gtk_plot_x0_visible (GtkPlot *plot); 812 void gtk_plot_y0_set_visible (GtkPlot *plot, 813 gboolean visible); 814 gboolean gtk_plot_y0_visible (GtkPlot *plot); 815 void gtk_plot_grids_set_on_top (GtkPlot *plot, 816 gboolean on_top); 817 gboolean gtk_plot_grids_on_top (GtkPlot *plot); 818 void gtk_plot_grids_set_visible (GtkPlot *plot, 819 gboolean vmajor, 820 gboolean vminor, 821 gboolean hmajor, 822 gboolean hminor); 823 void gtk_plot_grids_visible (GtkPlot *plot, 824 gboolean *vmajor, 825 gboolean *vminor, 826 gboolean *hmajor, 827 gboolean *hminor); 828 void gtk_plot_y0line_set_attributes (GtkPlot *plot, 829 GtkPlotLineStyle style, 830 gfloat width, 831 const GdkColor *color); 832 void gtk_plot_x0line_set_attributes (GtkPlot *plot, 833 GtkPlotLineStyle style, 834 gfloat width, 835 const GdkColor *color); 836 void gtk_plot_major_vgrid_set_attributes (GtkPlot *plot, 837 GtkPlotLineStyle style, 838 gfloat width, 839 const GdkColor *color); 840 void gtk_plot_minor_vgrid_set_attributes (GtkPlot *plot, 841 GtkPlotLineStyle style, 842 gfloat width, 843 const GdkColor *color); 844 void gtk_plot_major_hgrid_set_attributes (GtkPlot *plot, 845 GtkPlotLineStyle style, 846 gfloat width, 847 const GdkColor *color); 848 void gtk_plot_minor_hgrid_set_attributes (GtkPlot *plot, 849 GtkPlotLineStyle style, 850 gfloat width, 851 const GdkColor *color); 852 853 /* Legends */ 854 855 void gtk_plot_show_legends (GtkPlot *plot); 856 void gtk_plot_hide_legends (GtkPlot *plot); 857 void gtk_plot_set_legends_border (GtkPlot *plot, 858 GtkPlotBorderStyle border, 859 gint shadow_width); 860 void gtk_plot_legends_move (GtkPlot *plot, 861 gdouble x, gdouble y); 862 void gtk_plot_legends_get_position (GtkPlot *plot, 863 gdouble *x, gdouble *y); 864 GtkAllocation gtk_plot_legends_get_allocation (GtkPlot *plot); 865 void gtk_plot_legends_set_attributes (GtkPlot *plot, 866 const gchar *font, 867 gint height, 868 const GdkColor *foreground, 869 const GdkColor *background); 870 void gtk_plot_set_line_attributes (GtkPlot *plot, 871 GtkPlotLine line); 872 /* Datasets */ 873 874 void gtk_plot_add_data (GtkPlot *plot, 875 GtkPlotData *data); 876 gint gtk_plot_remove_data (GtkPlot *plot, 877 GtkPlotData *data); 878 GtkPlotData * gtk_plot_add_function (GtkPlot *plot, 879 GtkPlotFunc function); 880 881 #ifdef __cplusplus 882 } 883 #endif /* __cplusplus */ 884 885 886 #endif /* __GTK_PLOT_H__ */ 887