88#define CHART_WAXIS_H_
99
1010#include < Wt/Chart/WChartGlobal>
11+ #include < Wt/WDateTime>
1112#include < Wt/WFont>
1213#include < Wt/WPen>
1314#include < Wt/WString>
14- #include < Wt/WDateTime>
15+ #include < Wt/WTransform>
16+
1517#include < boost/any.hpp>
1618#include < cfloat>
1719
@@ -491,6 +493,12 @@ public:
491493 */
492494 void setPen (const WPen& pen);
493495
496+ /* ! \brief Returns the pen used for rendering the axis and ticks.
497+ *
498+ * \sa setPen()
499+ */
500+ const WPen& pen () const { return pen_; }
501+
494502 /* ! \brief Changes the pen used for rendering labels for this axis
495503 *
496504 * The default value is a black pen of 0 width.
@@ -501,11 +509,11 @@ public:
501509 */
502510 void setTextPen (const WPen& pen);
503511
504- /* ! \brief Returns the pen used for rendering the axis and ticks.
512+ /* ! \brief Returns the pen used for rendering labels for this axis
505513 *
506- * \sa setPen ()
514+ * \sa setTextPen ()
507515 */
508- const WPen& pen () const { return pen_ ; }
516+ const WPen& textPen () const { return textPen_ ; }
509517
510518 /* ! \brief Changes the pen used for rendering the grid lines.
511519 *
@@ -596,11 +604,56 @@ public:
596604 */
597605 virtual WString label (double u) const ;
598606
599- /* ! \brief Returns the chart to which this axis belongs.
607+ /* ! \brief Sets the initial zoom level for this axis.
608+ *
609+ * Only applies to a WCartesianChart in interactive mode.
610+ * The zoom level should be >= 1 and smaller than maxZoom()
611+ *
612+ * \note This is only implemented for the X and first Y axis. It has no effect on the second Y axis.
613+ */
614+ void setInitialZoom (double initialZoom);
615+
616+ /* ! \brief Get the initial zoom level for this axis.
617+ *
618+ * \see setInitialZoom()
619+ */
620+ double initialZoom () const ;
621+
622+ /* ! \brief Sets the maximum zoom level for this axis.
623+ *
624+ * Only applies to a WCartesianChart in interactive mode.
625+ * The zoom level should be >= 1 (no zoom).
600626 *
601- * \sa WCartesianChart:: axis()
627+ * \note This is only implemented for the X and first Y axis. It has no effect on the second Y axis.
602628 */
603- // WCartesianChart *chart() const { return chart_; }
629+ void setMaxZoom (double maxZoom);
630+
631+ /* ! \brief Get the maximum zoom level for this axis.
632+ *
633+ * \see setMaxZoom()
634+ */
635+ double maxZoom () const ;
636+
637+ /* ! \brief Sets the initial value to pan to for this axis.
638+ *
639+ * This sets the leftmost (horizontal axis)
640+ * or bottom (vertical axis) value to be displayed on the chart.
641+ *
642+ * Note that if this would cause the chart to go out of bounds,
643+ * the panning of the chart will be automatically adjusted.
644+ *
645+ * Only applies to a WCartesianChart in interactive mode.
646+ * The zoom level should be >= 1 and smaller than maxZoom()
647+ *
648+ * \note This is only implemented for the X and first Y axis. It has no effect on the second Y axis.
649+ */
650+ void setInitialPan (double initialPan);
651+
652+ /* ! \brief Get the initial value to pan to for this axis, when pan is enabled on the chart.
653+ *
654+ * \see setInitialPan()
655+ */
656+ double initialPan () const ;
604657
605658 int segmentCount () const { return (int )segments_.size (); }
606659
@@ -613,7 +666,22 @@ public:
613666 const WPointF& axisStart,
614667 const WPointF& axisEnd,
615668 double tickStart, double tickEnd, double labelPos,
616- WFlags<AlignmentFlag> labelFlags) const ;
669+ WFlags<AlignmentFlag> labelFlags,
670+ const WTransform &transform = WTransform()) const {
671+ std::vector<WPen> pens;
672+ std::vector<WPen> textPens;
673+ render (painter, properties, axisStart, axisEnd, tickStart, tickEnd, labelPos, labelFlags, transform, pens, textPens);
674+ }
675+
676+ void render (WPainter& painter,
677+ WFlags<AxisProperty> properties,
678+ const WPointF& axisStart,
679+ const WPointF& axisEnd,
680+ double tickStart, double tickEnd, double labelPos,
681+ WFlags<AlignmentFlag> labelFlags,
682+ const WTransform &transform,
683+ std::vector<WPen> pens,
684+ std::vector<WPen> textPens) const ;
617685
618686 /* ! \brief Returns the positions for grid lines on this axis.
619687 *
@@ -625,7 +693,8 @@ public:
625693 void renderLabel (WPainter& painter,
626694 const WString& text, const WPointF& p,
627695 WFlags<AlignmentFlag> flags,
628- double angle, int margin) const ;
696+ double angle, int margin, WTransform transform,
697+ const WPen& pen) const ;
629698
630699 void setRenderMirror (bool enable) { renderingMirror_ = enable; }
631700 double calcTitleSize (WPaintDevice *device, Orientation orientation) const ;
@@ -659,7 +728,7 @@ protected:
659728
660729 /* ! \brief Returns the label (and ticks) information for this axis.
661730 */
662- virtual void getLabelTicks (std::vector<TickLabel>& ticks, int segment) const ;
731+ virtual void getLabelTicks (std::vector<TickLabel>& ticks, int segment, int zoomLevel ) const ;
663732
664733 /* ! \brief Returns the Date format
665734 */
@@ -688,6 +757,9 @@ private:
688757 double titleOffset_;
689758 WPen textPen_;
690759 Orientation titleOrientation_;
760+ double maxZoom_;
761+ double initialZoom_;
762+ double initialPan_;
691763
692764 // for 3D charts, don't call update when the labelangle is tempor. changed
693765 bool renderingMirror_;
0 commit comments