Skip to content

Commit

Permalink
improve doc
Browse files Browse the repository at this point in the history
  • Loading branch information
jkriege2 committed Dec 19, 2023
1 parent 61ca148 commit 0080f07
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 17 deletions.
5 changes: 3 additions & 2 deletions doc/dox/jkqtplotter_baseplotelements.dox
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
\defgroup jkqtplotter_general_basicplotelements_coordinateaxes Coordinate Axes
\ingroup jkqtplotter_general_basicplotelements

\copydetails JKQTPCoordinateAxis
\copydetails JKQTPCoordinateAxis



\defgroup jkqtplotter_general_basicplotelements_key Plot Key/Legend
\ingroup jkqtplotter_general_basicplotelements


\copydetails JKQTBaseKey


*/

Expand Down
12 changes: 6 additions & 6 deletions lib/jkqtplotter/jkqtpcoordinateaxes.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ typedef JKQTPCoordinateAxes JKQTPCoordinateAxisRef;
/*! \brief this virtual class is the base for any type of coordinate axis, to be drawn by JKQTBasePlotter.
\ingroup jkqtpbaseplotter_elements
Class derived from JKQTPCoordinateAxis implements all the functionality needed for a coordinate axis:
Classes derived from JKQTPCoordinateAxis implements all the functionality needed for a coordinate axis:
- transform world to screen coordinates and vice versa
- draw the axis (implemented by child classes!) with these elements: axis lines, ticks, tick labels, axis label, x/y=0 axis
- measure the axes in screen coordinates
Expand Down Expand Up @@ -168,13 +168,13 @@ typedef JKQTPCoordinateAxes JKQTPCoordinateAxisRef;
unit than \f$ pi \f$ ,i.e.:
\image html axisstyle/axis_unit_scaling_none.png "no axis scaling (default case)"
\image html axisstyle/axis_unit_scaling_pi.png "pi-axis scaling (default case)"
\image html axisstyle/axis_unit_scaling_pi.png "pi-axis scaling"
You can use these methods to set such a factor:
- setTickUnitFactor() for the actual factor and setTickUnitName() for a name, added to the tick label
- setTickUnit() sets factor and name in one call
- setTickUnitPi() shortcut to set pi-scaling
- resetTickUnit() resets to no-scaling (default case)
- JKQTPCoordinateAxis::setTickUnitFactor() for the actual factor and setTickUnitName() for a name, added to the tick label
- JKQTPCoordinateAxis::setTickUnit() sets factor and name in one call
- JKQTPCoordinateAxis::setTickUnitPi() shortcut to set pi-scaling
- JKQTPCoordinateAxis::resetTickUnit() resets to no-scaling (default case)
.
*/
Expand Down
35 changes: 26 additions & 9 deletions lib/jkqtplotter/jkqtpkey.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,43 @@ class JKQTMathText;
/*! \brief base class for drawing a key (or legend)
\ingroup jkqtpbaseplotter_elements
This class immplements the basic layouting and drawing of a key/legend:
The class JKQTPBaseKey implements the basic layouting and drawing of a key/legend. The basic style properties are defined in JKQTPKeyStyle.
The following image shows, which properties of the key may be altered with the style:
\image html plot_key.png
\section JKQTPBaseKey_Usage Usage
The functions in JKQTPBaseKey are mainly used for drawing the main key in a JKQTBasePlotter.
The instance representing that main key is accessible via JKQTPBaseKey::getMainKey().
It is not a direct instance of JKQTPBaseKey, which is impossible, as it is pure virtual,
but an instance of JKQTPMainKey, which extends JKQTPBaseKey with access to the titles assigned to
each JKQTPPlotElement (see JKQTPPlotElement::getTitle(), JKQTPPlotElement::setTitle()) and its key-marker (JKQTPPlotElement::drawKeyMarker()).
Note however that it is also possible to draw additional keys into the graph (e.g. to show the size/color classes in a parametrized scatter graph),
if the corresponding JKQTPPlotElement implements this.
\section JKQTPBaseKey_ImplementationDetails Implementation Details
It relies on these protected virtual functions to determine the contents of the legend items:
- getEntryCount()
- getEntryTextExtent()
- getEntryText()
- drawEntrySample()
- JKQTPBaseKey::getEntryCount()
- JKQTPBaseKey::getEntryTextExtent()
- JKQTPBaseKey::getEntryText()
- JKQTPBaseKey::drawEntrySample()
.
So you can derive from JKQTPBaseKey and implement these to provide a new source of data.
There are additional customization points in this class. You can also override the
default implementations of these functions to change the way keys/legends are drawn:
- drawKey()
- getLayout()
- modifySize()
- JKQTPBaseKey::drawKey()
- JKQTPBaseKey::getLayout()
- JKQTPBaseKey::modifySize()
.
\see JKQTPKeyStyle
\see JKQTPKeyStyle, JKQTPMainKey
*/
class JKQTPLOTTER_LIB_EXPORT JKQTPBaseKey: public QObject {
Expand Down

0 comments on commit 0080f07

Please sign in to comment.