Wt  4.11.1
Public Member Functions | List of all members
Wt::Chart::CurveLabel Class Reference

A curve label. More...

#include <WCartesianChart.h>

Public Member Functions

 CurveLabel (const WDataSeries &series, const WPointF &point, const WString &label)
 Create a new curve label. More...
 
 CurveLabel (const WDataSeries &series, const cpp17::any &x, const cpp17::any &y, const WString &label)
 Create a new curve label. More...
 
void setSeries (const WDataSeries &series)
 Set the series this curve label is associated with.
 
const WDataSeriesseries () const
 Get the series this curve label is associated with. More...
 
void setPoint (const WPointF &point)
 Set the point in model coordinates this label is associated with.
 
void setPoint (const cpp17::any &x, const cpp17::any &y)
 Set the point in model coordinates this label is associated with.
 
const WPointF point () const
 Get the point in model coordinates this label is associated with. More...
 
const cpp17::any & x () const
 Get the x position for this label. More...
 
const cpp17::any & y () const
 Get the y position for this label. More...
 
void setLabel (const WString &label)
 Set the label that should be drawn in the box.
 
const WStringlabel () const
 Get the label that should be drawn in the box. More...
 
void setOffset (const WPointF &offset)
 Set the offset the text should be placed at. More...
 
const WPointFoffset () const
 Get the offset the text should be placed at. More...
 
void setWidth (int width)
 Set the width of the box in pixels. More...
 
int width () const
 Get the width of the box in pixels. More...
 
void setLinePen (const WPen &pen)
 Set the pen to use for the connecting line. More...
 
const WPenlinePen () const
 Get the pen to use for the connecting line. More...
 
void setTextPen (const WPen &pen)
 Set the pen for the text in the box.
 
const WPentextPen () const
 Get the pen for the text in the box. More...
 
void setBoxBrush (const WBrush &brush)
 Set the brush to use for the box around the text. More...
 
const WBrushboxBrush () const
 Get the brush to use for the box around the text. More...
 
void setMarkerBrush (const WBrush &brush)
 Set the brush used to fill the circle at point().
 
const WBrushmarkerBrush () const
 Get the brush used to fill the circle at point(). More...
 

Detailed Description

A curve label.

Curve labels can be added with WCartesianChart::addCurveLabel(). They are associated with a particular series, and are drawn at the given point in model coordinates. When the chart is transformed (zoom or pan) or the associated series is manipulated, the curve label's position will change, but not its size.

A curve label

Constructor & Destructor Documentation

◆ CurveLabel() [1/2]

Wt::Chart::CurveLabel::CurveLabel ( const WDataSeries series,
const WPointF point,
const WString label 
)

Create a new curve label.

Create a new curve label for given series, at the given point with the given text.

◆ CurveLabel() [2/2]

Wt::Chart::CurveLabel::CurveLabel ( const WDataSeries series,
const cpp17::any &  x,
const cpp17::any &  y,
const WString label 
)

Create a new curve label.

Create a new curve label for given series, at the given x, y coordinates and the given text.

Member Function Documentation

◆ boxBrush()

const WBrush& Wt::Chart::CurveLabel::boxBrush ( ) const

Get the brush to use for the box around the text.

See also
setBoxBrush()

◆ label()

const WString& Wt::Chart::CurveLabel::label ( ) const

Get the label that should be drawn in the box.

See also
setLabel()

◆ linePen()

const WPen& Wt::Chart::CurveLabel::linePen ( ) const

Get the pen to use for the connecting line.

See also
setLinePen()

◆ markerBrush()

const WBrush& Wt::Chart::CurveLabel::markerBrush ( ) const

Get the brush used to fill the circle at point().

See also
setMarkerBrush()

◆ offset()

const WPointF& Wt::Chart::CurveLabel::offset ( ) const

Get the offset the text should be placed at.

See also
setOffset()

◆ point()

const WPointF Wt::Chart::CurveLabel::point ( ) const

Get the point in model coordinates this label is associated with.

Note
This uses asNumber(), which may not be the same conversion that WCartesianChart::mapToDevice() uses, depending on the scale of the axis. x() and y() will perform no conversion, so they may be safer to use.
See also
setPoint()

◆ series()

const WDataSeries& Wt::Chart::CurveLabel::series ( ) const

Get the series this curve label is associated with.

See also
setSeries()

◆ setBoxBrush()

void Wt::Chart::CurveLabel::setBoxBrush ( const WBrush brush)

Set the brush to use for the box around the text.

This sets the brush used to fill the box with the text defined in label().

◆ setLinePen()

void Wt::Chart::CurveLabel::setLinePen ( const WPen pen)

Set the pen to use for the connecting line.

This sets the pen to use for the line connecting the point to the box with the label at offset pixels from the point.

◆ setOffset()

void Wt::Chart::CurveLabel::setOffset ( const WPointF offset)

Set the offset the text should be placed at.

The offset is defined in pixels, with x values going from left to right, and y values from top to bottom.

The default offset is (60, -20), which means the middle of the label() is drawn 60 pixels to the right, and 20 pixels above the point.

◆ setWidth()

void Wt::Chart::CurveLabel::setWidth ( int  width)

Set the width of the box in pixels.

If the width is 0 (the default), server side font metrics will be used to determine the size of the box.

◆ textPen()

const WPen& Wt::Chart::CurveLabel::textPen ( ) const

Get the pen for the text in the box.

See also
setTextPen()

◆ width()

int Wt::Chart::CurveLabel::width ( ) const

Get the width of the box in pixels.

See also
setWidth()

◆ x()

const cpp17::any& Wt::Chart::CurveLabel::x ( ) const

Get the x position for this label.

See also
setPoint()

◆ y()

const cpp17::any& Wt::Chart::CurveLabel::y ( ) const

Get the y position for this label.

See also
setPoint()