Code Documentation 3.1
Social Network Visualizer
Loading...
Searching...
No Matches
Chart Class Reference

#include <chart.h>

Inheritance diagram for Chart:
Collaboration diagram for Chart:

Public Member Functions

 Chart (QWidget *parent=Q_NULLPTR)
 
 ~Chart ()
 
void setTitle (const QString &title=QString(), const QFont &font=QFont())
 Set the title of the QChart.
 
void addSeries (QAbstractSeries *series=Q_NULLPTR)
 Adds QAbstractSeries series to chart If no series are passed, a new QSplineSeries is created with 1 point at (0,0)
 
void appendToSeries (const QPointF &p)
 Adds the data point p(qreal,qreal) to the series.
 
void removeAllSeries ()
 Removes and deletes all series objects that have been added to the chart.
 
void createDefaultAxes ()
 Creates default axes. Must be called AFTER loading a series to the chart.
 
QList< QAbstractAxis * > axes (Qt::Orientations orientation=Qt::Horizontal|Qt::Vertical, QAbstractSeries *series=Q_NULLPTR) const
 
void removeAllAxes ()
 Removes all previously attached X,Y axes from the QChart.
 
void addAxis (QAbstractAxis *axis, Qt::Alignment alignment)
 Add Axis axis to the QChart. Does not delete previously attached axis.
 
void setAxisX (QAbstractAxis *axis, QAbstractSeries *series=Q_NULLPTR)
 Adds the axis axis to the chart and attaches it to the series series as a bottom-aligned horizontal axis. The chart takes ownership of both the axis and the series.
 
void setAxisY (QAbstractAxis *axis, QAbstractSeries *series=Q_NULLPTR)
 Adds the axis axis to the chart and attaches it to the series series as a left-aligned horizontal axis. The chart takes ownership of both the axis and the series.
 
void setAxisXRange (const QVariant &min, const QVariant &max)
 Set the range of the (first) horizontal axis.
 
void setAxisXMin (const QVariant &min)
 Sets the minimum value shown on the horizontal axis.
 
void setAxisYRange (const QVariant &min, const QVariant &max)
 Set the range of the vertical axis.
 
void setAxisYMin (const QVariant &min)
 Sets the minimum value shown on the vertical axis.
 
void setAxesThemeDefault ()
 Applies a simple theme to axes (default label fonts, line and grid line pen). WARNING: Axes must be already attached to m_chart.
 
void setAxisXLabelsAngle (const int &angle)
 
void setAxisXLabelFont (const QFont &font=QFont("Helvetica", 6))
 Set the label font of the horizontal axis.
 
void setAxisYLabelFont (const QFont &font=QFont("Helvetica", 6))
 Set the label font of the vertical axis.
 
void setAxisXLinePen (const QPen &pen=QPen(QColor("#d0d0d0"), 1, Qt::SolidLine))
 Set the line pen of the horizontal axis.
 
void setAxisYLinePen (const QPen &pen=QPen(QColor("#d0d0d0"), 1, Qt::SolidLine))
 Set the line pen of the vertical axis.
 
void setAxisXGridLinePen (const QPen &pen=QPen(QColor("#e0e0e0"), 1, Qt::DotLine))
 Set the grid line pen of the horizontal axis.
 
void setAxisYGridLinePen (const QPen &pen=QPen(QColor("#e0e0e0"), 1, Qt::DotLine))
 Set the grid line pen of the vertical axis.
 
void setTheme (QChart::ChartTheme theme=QChart::ChartThemeLight)
 Set the theme of the QChart.
 
void setThemeSmallWidget (const int minWidth, const int minHeight)
 Set the theme for when our chart widget is small.
 
void setChartBackgroundBrush (const QBrush &brush=QBrush(Qt::transparent))
 Sets the background brush of the QChart If no brush defined, it uses a transparent brush.
 
void setChartBackgroundPen (const QPen &pen=QPen(Qt::transparent))
 Sets the background pen of the QChart If no pen defined, it uses a transparent pen.
 
void setMargins (const QMargins &margins=QMargins())
 Set the margins of the QChart.
 
void toggleLegend (const bool &toggle=false)
 Toggle the legend of the QChart.
 
void resetToTrivial ()
 

Private Attributes

QChart * m_chart
 
QSplineSeries * m_series
 

Constructor & Destructor Documentation

◆ Chart()

Chart::Chart ( QWidget *  parent = Q_NULLPTR)
explicit

◆ ~Chart()

Chart::~Chart ( )

Member Function Documentation

◆ addAxis()

void Chart::addAxis ( QAbstractAxis *  axis,
Qt::Alignment  alignment 
)

Add Axis axis to the QChart. Does not delete previously attached axis.

Parameters
axis
alignment

◆ addSeries()

void Chart::addSeries ( QAbstractSeries *  series = Q_NULLPTR)

Adds QAbstractSeries series to chart If no series are passed, a new QSplineSeries is created with 1 point at (0,0)

Parameters
series

◆ appendToSeries()

void Chart::appendToSeries ( const QPointF &  p)

Adds the data point p(qreal,qreal) to the series.

Parameters
p

◆ axes()

QList< QAbstractAxis * > Chart::axes ( Qt::Orientations  orientation = Qt::Horizontal|Qt::Vertical,
QAbstractSeries *  series = Q_NULLPTR 
) const

◆ createDefaultAxes()

void Chart::createDefaultAxes ( )

Creates default axes. Must be called AFTER loading a series to the chart.

◆ removeAllAxes()

void Chart::removeAllAxes ( )

Removes all previously attached X,Y axes from the QChart.

◆ removeAllSeries()

void Chart::removeAllSeries ( )

Removes and deletes all series objects that have been added to the chart.

◆ resetToTrivial()

void Chart::resetToTrivial ( )

◆ setAxesThemeDefault()

void Chart::setAxesThemeDefault ( )

Applies a simple theme to axes (default label fonts, line and grid line pen). WARNING: Axes must be already attached to m_chart.

◆ setAxisX()

void Chart::setAxisX ( QAbstractAxis *  axis,
QAbstractSeries *  series = Q_NULLPTR 
)

Adds the axis axis to the chart and attaches it to the series series as a bottom-aligned horizontal axis. The chart takes ownership of both the axis and the series.

Parameters
axis
series

◆ setAxisXGridLinePen()

void Chart::setAxisXGridLinePen ( const QPen &  pen = QPen(QColor("#e0e0e0"), 1,Qt::DotLine))

Set the grid line pen of the horizontal axis.

Parameters
font

◆ setAxisXLabelFont()

void Chart::setAxisXLabelFont ( const QFont &  font = QFont("Helvetica", 6 ))

Set the label font of the horizontal axis.

Parameters
font

◆ setAxisXLabelsAngle()

void Chart::setAxisXLabelsAngle ( const int &  angle)

◆ setAxisXLinePen()

void Chart::setAxisXLinePen ( const QPen &  pen = QPen(QColor("#d0d0d0"), 1,Qt::SolidLine))

Set the line pen of the horizontal axis.

Parameters
font

◆ setAxisXMin()

void Chart::setAxisXMin ( const QVariant &  min)

Sets the minimum value shown on the horizontal axis.

Parameters
min

◆ setAxisXRange()

void Chart::setAxisXRange ( const QVariant &  min,
const QVariant &  max 
)

Set the range of the (first) horizontal axis.

Parameters
min
max

◆ setAxisY()

void Chart::setAxisY ( QAbstractAxis *  axis,
QAbstractSeries *  series = Q_NULLPTR 
)

Adds the axis axis to the chart and attaches it to the series series as a left-aligned horizontal axis. The chart takes ownership of both the axis and the series.

Parameters
axis
series

◆ setAxisYGridLinePen()

void Chart::setAxisYGridLinePen ( const QPen &  pen = QPen(QColor("#e0e0e0"), 1,Qt::DotLine))

Set the grid line pen of the vertical axis.

Parameters
font

◆ setAxisYLabelFont()

void Chart::setAxisYLabelFont ( const QFont &  font = QFont("Helvetica", 6 ))

Set the label font of the vertical axis.

Parameters
font

◆ setAxisYLinePen()

void Chart::setAxisYLinePen ( const QPen &  pen = QPen(QColor("#d0d0d0"), 1,Qt::SolidLine))

Set the line pen of the vertical axis.

Parameters
font

◆ setAxisYMin()

void Chart::setAxisYMin ( const QVariant &  min)

Sets the minimum value shown on the vertical axis.

Parameters
min

◆ setAxisYRange()

void Chart::setAxisYRange ( const QVariant &  min,
const QVariant &  max 
)

Set the range of the vertical axis.

Parameters
min
max

◆ setChartBackgroundBrush()

void Chart::setChartBackgroundBrush ( const QBrush &  brush = QBrush(Qt::transparent))

Sets the background brush of the QChart If no brush defined, it uses a transparent brush.

Parameters
brush

◆ setChartBackgroundPen()

void Chart::setChartBackgroundPen ( const QPen &  pen = QPen(Qt::transparent))

Sets the background pen of the QChart If no pen defined, it uses a transparent pen.

Parameters
brush

◆ setMargins()

void Chart::setMargins ( const QMargins &  margins = QMargins())

Set the margins of the QChart.

Parameters
margins

◆ setTheme()

void Chart::setTheme ( QChart::ChartTheme  theme = QChart::ChartThemeLight)

Set the theme of the QChart.

Parameters
theme

◆ setThemeSmallWidget()

void Chart::setThemeSmallWidget ( const int  minWidth,
const int  minHeight 
)

Set the theme for when our chart widget is small.

Parameters
chartHeight

◆ setTitle()

void Chart::setTitle ( const QString &  title = QString(),
const QFont &  font = QFont() 
)

Set the title of the QChart.

Parameters
title

◆ toggleLegend()

void Chart::toggleLegend ( const bool &  toggle = false)

Toggle the legend of the QChart.

Parameters
toggle

Field Documentation

◆ m_chart

QChart* Chart::m_chart
private

◆ m_series

QSplineSeries* Chart::m_series
private

The documentation for this class was generated from the following files: