/*[
* Copyright 2000, 2004 Thomas Williams, Colin Kelley
*
* Permission to use, copy, and distribute this software and its
* documentation for any purpose with or without fee is hereby granted,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation.
*
* Permission to modify the software is granted, but not the right to
* distribute the complete modified source code. Modifications are to
* be distributed as patches to the released version. Permission to
* distribute binaries produced by compiling modified sources is granted,
* provided you
* 1. distribute the corresponding source modifications from the
* released version in the form of a patch file along with the binaries,
* 2. add special version identification to distinguish your version
* in addition to the base release version number,
* 3. provide your name and address as the primary contact for the
* support of your modified version, and
* 4. retain our contact information in regard to use of the base
* software.
* Permission to distribute the released version of the source code along
* with corresponding source modifications in the form of a patch file is
* granted with same provisions 2 through 4 for binary distributions.
*
* This software is provided "as is" without express or implied warranty
* to the extent permitted by applicable law.
]*/
#ifndef GNUPLOT_AXIS_H
#define GNUPLOT_AXIS_H
/* Aug 2017 - unconditional support for nonlinear axes */
# define nonlinear(axis) ((axis)->linked_to_primary != NULL && (axis)->link_udf->at != NULL)
# define invalid_coordinate(x,y) ((unsigned)(x)==intNaN || (unsigned)(y)==intNaN)
#include "gp_types.h" /* for TBOOLEAN */
#include "gadgets.h"
#include "parse.h" /* for const_*() */
#include "tables.h" /* for the axis name parse table */
#include "term_api.h" /* for lp_style_type */
#include "util.h" /* for int_error() */
/* typedefs / #defines */
/* give some names to some array elements used in command.c and grap*.c
* maybe one day the relevant items in setshow will also be stored
* in arrays.
*
* Always keep the following conditions alive:
* SECOND_X_AXIS = FIRST_X_AXIS + SECOND_AXES
* FIRST_X_AXIS & SECOND_AXES == 0
*/
typedef enum AXIS_INDEX {
NO_AXIS = -2,
ALL_AXES = -1,
FIRST_Z_AXIS = 0,
#define FIRST_AXES FIRST_Z_AXIS
FIRST_Y_AXIS,
FIRST_X_AXIS,
COLOR_AXIS, /* fill gap */
SECOND_Z_AXIS, /* not used, yet */
#define SECOND_AXES SECOND_Z_AXIS
SAMPLE_AXIS=SECOND_Z_AXIS,
SECOND_Y_AXIS,
SECOND_X_AXIS,
POLAR_AXIS,
#define NUMBER_OF_MAIN_VISIBLE_AXES (POLAR_AXIS + 1)
T_AXIS,
U_AXIS,
V_AXIS, /* Last index into axis_array[] */
PARALLEL_AXES, /* Parallel axis structures are allocated dynamically */
THETA_index = 1234, /* Used to identify THETA_AXIS */
MOUSE_PROXY_AXIS, /* Used by watchpoints code */
AXIS_ARRAY_SIZE = PARALLEL_AXES
} AXIS_INDEX;
/* sample axis doesn't need mtics, so use the slot to hold sample interval */
# define SAMPLE_INTERVAL miniticscale
/* What kind of ticmarking is wanted? */
typedef enum en_ticseries_type {
TIC_COMPUTED=1, /* default; gnuplot figures them */
TIC_SERIES, /* user-defined series */
TIC_USER, /* user-defined points */
TIC_MONTH, /* print out month names ((mo-1)%12)+1 */
TIC_DAY /* print out day of week */
} t_ticseries_type;
/* Defines one ticmark for TIC_USER style.
* If label==NULL, the value is printed with the usual format string.
* else, it is used as the format string (note that it may be a constant
* string, like "high" or "low").
*/
typedef struct ticmark {
double position; /* where on axis is this */
char *label; /* optional (format) string label */
int level; /* 0=major tic, 1=minor tic */
struct ticmark *next; /* linked list */
} ticmark;
/* Tic-mark labelling definition; see set xtics */
typedef struct ticdef {
t_ticseries_type type;
char *font;
struct t_colorspec textcolor;
struct {
struct ticmark *user; /* for TIC_USER */
struct { /* for TIC_SERIES */
double start, incr;
double end; /* ymax, if VERYLARGE */
} series;
TBOOLEAN mix; /* TRUE to use both the above */
} def;
struct position offset;
TBOOLEAN rangelimited; /* Limit tics to data range */
TBOOLEAN enhanced; /* Use enhanced text mode or labels */
TBOOLEAN logscaling; /* place tics using old logscale algorithm */
} t_ticdef;
/* Version 5.5 (Jun 2021)
* Default is AUTO for log scale, OFF otherwise
* New mode TIME only applies when axis or axis tics are set to time mode
* and the user has requested "set mxtics time ".
*/
typedef enum en_minitics_status {
MINI_OFF,
MINI_DEFAULT,
MINI_USER,
MINI_AUTO,
MINI_TIME
} t_minitics_status;
/* Values to put in the axis_tics[] variables that decides where the
* ticmarks should be drawn: not at all, on one or both plot borders,
* or the zeroaxes. These look like a series of values, but TICS_MASK
* shows that they're actually bit masks --> don't turn into an enum
* */
#define NO_TICS 0
#define TICS_ON_BORDER 1
#define TICS_ON_AXIS 2
#define TICS_MASK 3
#define TICS_MIRROR 4
/* Tic levels 0 and 1 are maintained in the axis structure.
* Tic levels 2 - MAX_TICLEVEL have only one property - scale.
*/
#define MAX_TICLEVEL 5
extern double ticscale[MAX_TICLEVEL];
/* HBB 20010610: new type for storing autoscale activity. Effectively
* two booleans (bits) in a single variable, so I'm using an enum with
* all 4 possible bit masks given readable names. */
typedef enum e_autoscale {
AUTOSCALE_NONE = 0,
AUTOSCALE_MIN = 1