11#include <plplot/plstream.h>
13typedef PLINT (*PLTICK_FUNC_callback)(PLINT axis, PLINT nticks, PLFLT *ticks,
14 PLFLT min, PLFLT max, PLPointer data);
19 enum class Style :
char { Default, WritePowerInFrame };
23 std::string_view getAxisOptString()
const;
25 void setTitle(std::string_view title);
27 std::string_view getTitle()
const;
29 void setDrawZeroLine(
bool on);
31 void setDrawConventionalAxis(
bool on);
33 void setDrawUnconventionalAxis(
bool on);
35 void setLabelsAsDate(
bool on);
37 void setFixedPoint(
bool on);
39 void setInvertedTicks(
bool on);
41 void setLogarithmic(
bool on);
43 void setDrawConventionalLabels(
bool on);
45 void setDrawUnconventionalLabels(
bool on);
47 void setDrawSubTicks(
bool on);
49 void setDrawTicks(
bool on);
51 void setWriteLabelsParallel(
bool on);
53 void setPrecision(
int precision);
55 const int &getPrecision()
const;
57 void setMaxDigits(
int max);
59 const int &getMaxDigits()
const;
61 void setStyle(Style style);
63 const Style &getStyle()
const;
65 void setReciprocalLabelFormatter();
67 void setReciprocalTickFinder();
69 PLLABEL_FUNC_callback getLabelFormatter();
71 PLTICK_FUNC_callback getTickFinder();
76 std::string _axisoptstr;
84 PLLABEL_FUNC_callback _label_callback;
86 PLTICK_FUNC_callback _tick_callback;
88 void _set(
char option,
bool on);
90 static void _reciprocal_labeller(PLINT axis, PLFLT value,
91 PLCHAR_NC_VECTOR label, PLINT length,
94 static PLINT _reciprocal_tickfinder(PLINT axis, PLINT nticks, PLFLT *ticks,
95 PLFLT min, PLFLT max, PLPointer data);
98inline std::string_view Axis::getAxisOptString()
const {
return (_axisoptstr); }
100inline void Axis::setTitle(
const std::string_view title) { _title = title; }
102inline std::string_view Axis::getTitle()
const {
return (_title); }
104inline void Axis::setDrawZeroLine(
bool on =
true) { _set(
'a', on); }
106inline void Axis::setDrawConventionalAxis(
bool on =
true) { _set(
'b', on); }
108inline void Axis::setDrawUnconventionalAxis(
bool on =
true) { _set(
'c', on); }
110inline void Axis::setLabelsAsDate(
bool on =
true) { _set(
'd', on); }
112inline void Axis::setFixedPoint(
bool on =
true) { _set(
'f', on); }
114inline void Axis::setInvertedTicks(
bool on =
true) { _set(
'i', on); }
116inline void Axis::setLogarithmic(
bool on =
true) { _set(
'l', on); }
118inline void Axis::setDrawConventionalLabels(
bool on =
true) { _set(
'n', on); }
120inline void Axis::setDrawUnconventionalLabels(
bool on =
true) { _set(
'm', on); }
122inline void Axis::setDrawSubTicks(
bool on =
true) { _set(
's', on); }
124inline void Axis::setDrawTicks(
bool on =
true) { _set(
't', on); }
126inline void Axis::setWriteLabelsParallel(
bool on =
true) { _set(
'v', on); }
128inline void Axis::setPrecision(
int precision) { _precision = precision; }
130inline const int &Axis::getPrecision()
const {
return (_precision); }
132inline void Axis::setMaxDigits(
int max) { _maxdigits = max; }
134inline const int &Axis::getMaxDigits()
const {
return (_maxdigits); }
136inline void Axis::setStyle(Axis::Style style) { _style = style; }
138inline const Axis::Style &Axis::getStyle()
const {
return (_style); }
140inline void Axis::setReciprocalLabelFormatter() {
142 _label_callback = Axis::_reciprocal_labeller;
145inline void Axis::setReciprocalTickFinder() {
146 _tick_callback = Axis::_reciprocal_tickfinder;
149inline PLLABEL_FUNC_callback Axis::getLabelFormatter() {
150 return _label_callback;
153inline PLTICK_FUNC_callback Axis::getTickFinder() {
return _tick_callback; }