我有一个滚动的动态图表。当新数据到来时,我看不到图表大小。我可以自动化吗?qt 图表有这样的属性吗?在此处输入图像描述
void MainWindow::initChartView()
{
QChart *chart = new QChart();
chart->addSeries(series);
qDebug()<< series;
QPen green(Qt::red);
green.setWidth(2);
series->setPen(green);
chart->legend()->hide();
chart->setTitle("deneme");
chart->setAnimationOptions(QChart::AllAnimations);
QValueAxis *axisX=new QValueAxis;
axisX->setTickCount(5);
axisX->setRange(0, 2);
chart->addAxis(axisX, Qt::AlignBottom);
series->attachAxis(axisX);
QValueAxis *axisY = new QValueAxis;
axisY->setTickCount(5);
axisY->setRange(0,2);
chart->addAxis(axisY, Qt::AlignLeft);
series->attachAxis(axisY);
QChartView *chartView = new QChartView(chart);
chartView->setRenderHint(QPainter::Antialiasing);
this->setCentralWidget(chartView);
}