20#include <QtCharts/QChartGlobal>
21#include <QtCharts/QChartView>
31 explicit Chart(QWidget *parent = Q_NULLPTR);
35 void setTitle(
const QString &title = QString(),
const QFont &font = QFont());
36 void addSeries(QAbstractSeries *series = Q_NULLPTR);
41 QList<QAbstractAxis *>
axes(Qt::Orientations orientation = Qt::Horizontal | Qt::Vertical,
42 QAbstractSeries *series = Q_NULLPTR)
const;
45 void addAxis(QAbstractAxis *axis, Qt::Alignment alignment);
47 void setAxisX(QAbstractAxis *axis, QAbstractSeries *series = Q_NULLPTR);
48 void setAxisY(QAbstractAxis *axis, QAbstractSeries *series = Q_NULLPTR);
62 void setAxisXLinePen(
const QPen &pen = QPen(QColor(
"#d0d0d0"), 1, Qt::SolidLine));
63 void setAxisYLinePen(
const QPen &pen = QPen(QColor(
"#d0d0d0"), 1, Qt::SolidLine));
68 void setTheme(QChart::ChartTheme theme = QChart::ChartThemeLight);
73 void setMargins(
const QMargins &margins = QMargins());
void setThemeSmallWidget(const int minWidth, const int minHeight)
Set the theme for when our chart widget is small.
Definition chart.cpp:379
void setAxisXLinePen(const QPen &pen=QPen(QColor("#d0d0d0"), 1, Qt::SolidLine))
Set the line pen of the horizontal axis.
Definition chart.cpp:284
void setAxisYLinePen(const QPen &pen=QPen(QColor("#d0d0d0"), 1, Qt::SolidLine))
Set the line pen of the vertical axis.
Definition chart.cpp:295
void removeAllSeries()
Removes and deletes all series objects that have been added to the chart.
Definition chart.cpp:97
void setAxisYRange(const QVariant &min, const QVariant &max)
Set the range of the vertical axis.
Definition chart.cpp:233
void setAxisXLabelFont(const QFont &font=QFont("Helvetica", 6))
Set the label font of the horizontal axis.
Definition chart.cpp:261
void appendToSeries(const QPointF &p)
Adds the data point p(qreal,qreal) to the series.
Definition chart.cpp:88
QChart * m_chart
Definition chart.h:79
void setAxesThemeDefault()
Applies a simple theme to axes (default label fonts, line and grid line pen). WARNING: Axes must be a...
Definition chart.cpp:422
QSplineSeries * m_series
Definition chart.h:80
void setAxisYMin(const QVariant &min)
Sets the minimum value shown on the vertical axis.
Definition chart.cpp:244
void setMargins(const QMargins &margins=QMargins())
Set the margins of the QChart.
Definition chart.cpp:401
void setChartBackgroundBrush(const QBrush &brush=QBrush(Qt::transparent))
Sets the background brush of the QChart If no brush defined, it uses a transparent brush.
Definition chart.cpp:348
~Chart()
Definition chart.cpp:48
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 axi...
Definition chart.cpp:182
void setAxisXRange(const QVariant &min, const QVariant &max)
Set the range of the (first) horizontal axis.
Definition chart.cpp:211
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 a...
Definition chart.cpp:167
void setAxisXGridLinePen(const QPen &pen=QPen(QColor("#e0e0e0"), 1, Qt::DotLine))
Set the grid line pen of the horizontal axis.
Definition chart.cpp:308
void removeAllAxes()
Removes all previously attached X,Y axes from the QChart.
Definition chart.cpp:137
void setChartBackgroundPen(const QPen &pen=QPen(Qt::transparent))
Sets the background pen of the QChart If no pen defined, it uses a transparent pen.
Definition chart.cpp:359
void addAxis(QAbstractAxis *axis, Qt::Alignment alignment)
Add Axis axis to the QChart. Does not delete previously attached axis.
Definition chart.cpp:197
void setAxisXMin(const QVariant &min)
Sets the minimum value shown on the horizontal axis.
Definition chart.cpp:221
void createDefaultAxes()
Creates default axes. Must be called AFTER loading a series to the chart.
Definition chart.cpp:113
void setAxisYGridLinePen(const QPen &pen=QPen(QColor("#e0e0e0"), 1, Qt::DotLine))
Set the grid line pen of the vertical axis.
Definition chart.cpp:319
void setTitle(const QString &title=QString(), const QFont &font=QFont())
Set the title of the QChart.
Definition chart.cpp:411
void setTheme(QChart::ChartTheme theme=QChart::ChartThemeLight)
Set the theme of the QChart.
Definition chart.cpp:369
void setAxisXLabelsAngle(const int &angle)
Definition chart.cpp:251
QList< QAbstractAxis * > axes(Qt::Orientations orientation=Qt::Horizontal|Qt::Vertical, QAbstractSeries *series=Q_NULLPTR) const
Definition chart.cpp:120
void resetToTrivial()
Definition chart.cpp:436
void addSeries(QAbstractSeries *series=Q_NULLPTR)
Adds QAbstractSeries series to chart If no series are passed, a new QSplineSeries is created with 1 p...
Definition chart.cpp:63
void toggleLegend(const bool &toggle=false)
Toggle the legend of the QChart.
Definition chart.cpp:333
void setAxisYLabelFont(const QFont &font=QFont("Helvetica", 6))
Set the label font of the vertical axis.
Definition chart.cpp:272