|
22 | 22 | #include "renderNativeWindow.h" |
23 | 23 | #include <TCL_obj_base.h> |
24 | 24 | #include "classdesc_access.h" |
| 25 | +#include "latexMarkup.h" |
25 | 26 | #include "plot.h" |
26 | 27 | #include "variable.h" |
27 | 28 | #include "variableValue.h" |
@@ -62,6 +63,10 @@ namespace minsky |
62 | 63 |
|
63 | 64 | bool xIsSecsSinceEpoch=false; |
64 | 65 | bool redraw(int, int, int, int) override; |
| 66 | + |
| 67 | + // shadow labels, so we can interpret as LaTeX code rather than Pango markup |
| 68 | + std::string m_xlabel, m_ylabel, m_y1label; |
| 69 | + |
65 | 70 | public: |
66 | 71 | using Item::x; |
67 | 72 | using Item::y; |
@@ -95,7 +100,24 @@ namespace minsky |
95 | 100 |
|
96 | 101 | const PlotWidget* plotWidgetCast() const override {return this;} |
97 | 102 | PlotWidget* plotWidgetCast() override {return this;} |
98 | | - |
| 103 | + |
| 104 | + /// shadowed label commands to allow latex intepretation |
| 105 | + const std::string& xlabel() const {return m_xlabel;} |
| 106 | + const std::string& xlabel(const std::string& x) { |
| 107 | + ecolab::Plot::xlabel=latexToPangoNonItalicised(x); |
| 108 | + return m_xlabel=x; |
| 109 | + } |
| 110 | + const std::string& ylabel() const {return m_ylabel;} |
| 111 | + const std::string& ylabel(const std::string& x) { |
| 112 | + ecolab::Plot::ylabel=latexToPangoNonItalicised(x); |
| 113 | + return m_ylabel=x; |
| 114 | + } |
| 115 | + const std::string& y1label() const {return m_y1label;} |
| 116 | + const std::string& y1label(const std::string& x) { |
| 117 | + ecolab::Plot::y1label=latexToPangoNonItalicised(x); |
| 118 | + return m_y1label=x; |
| 119 | + } |
| 120 | + |
99 | 121 | void addPlotPt(double t); ///< add another plot point |
100 | 122 | void updateIcon(double t) override {addPlotPt(t);} |
101 | 123 | /// add vector/tensor curves to plot |
|
0 commit comments