Qwt開發(fā)筆記(二):Qwt基礎(chǔ)框架介紹、折線圖介紹、折線圖Demo以及代碼詳解
前言
??QWT開發(fā)筆記系列整理集合,這是目前使用最為廣泛的Qt圖表類(Qt的QWidget代碼方向只有QtCharts,Qwt,QCustomPlot),使用多年,系統(tǒng)性的整理,本系列旨在系統(tǒng)解說并逐步更新其各種Demo示例
??本片文章主要講解折線圖,借助折線圖展現(xiàn)一個(gè)基礎(chǔ)流程框架。
Demo
??

??

??

QwtPlot
簡介
??QwtPlot是一個(gè)用于繪制二維圖形的小部件。畫布上可以顯示無限數(shù)量的繪圖項(xiàng)目。繪圖項(xiàng)目可以是曲線(QwtPlotCurve)、標(biāo)記(QwtPlotMarker)、網(wǎng)格(QwtPrintGrid)或從QwtPlotItem派生的任何其他內(nèi)容。一個(gè)繪圖最多可以有四個(gè)軸,每個(gè)繪圖項(xiàng)目都連接到一個(gè)x軸和一個(gè)y軸。軸上的比例可以顯式設(shè)置(QwtScaleDiv),或使用算法(QwtScale Engine)根據(jù)繪圖項(xiàng)計(jì)算,該算法可以為每個(gè)軸單獨(dú)配置。
枚舉
enum QwtPlot::LegendPosition:圖例相對(duì)于畫布的位置。
??此枚舉描述圖表中啟用的動(dòng)畫。
??

成員函數(shù)(列舉常用的)
autoReplot():自動(dòng)刷新
bool QwtPlot::autoReplot () const
??如果設(shè)置了autoReplot選項(xiàng),則為true。
axisAutoScale():自動(dòng)縮放
bool QwtPlot::axisAutoScale(QwtAxisId axisId) const
??如果啟用了自動(dòng)縮放,則為true。
axisFont():軸的刻度標(biāo)簽的字體
QFont QwtPlot::axisFont (QwtAxisId axisId) const
??返回指定軸刻度的字體。
axisInterval():軸的當(dāng)前間隔
QwtInterval QwtPlot::axisInterval(QwtAxisId axisId) const
??返回指定軸的當(dāng)前間隔。同axiscaleDiv(axisId)->interval()類似。
axisMaxMajor():軸的最大主刻度數(shù)
int QwtPlot::axisMaxMajor(QwtAxisId axisId) const
??指定軸的最大主刻度數(shù)。
axisMaxMinor():軸的最大次刻度數(shù)
int QwtPlot::axisMaxMinor (QwtAxisId axisId) const
??指定軸的最大次刻度數(shù)。
axisScaleDiv():軸的比例分割
const QwtScaleDiv & QwtPlot::axisScaleDiv(QwtAxisId axisId) const
??返回指定軸的比例分割。
??axiscaleDiv(axisId).lowerBound()和axiscaleDiv(axisId).upperBound()是軸比例的當(dāng)前限制。
axisScaleDraw():軸的比例繪制
QwtScaleDraw * QwtPlot::axisScaleDraw(QwtAxisId axisId)const QwtScaleDraw * QwtPlot::axisScaleDraw (QwtAxisId axisId) const
??返回指定軸的比例繪制。
axisScaleEngine():軸的縮放引擎
QwtScaleEngine * QwtPlot::axisScaleEngine(QwtAxisId axisId)const QwtScaleEngine * QwtPlot::axisScaleEngine(QwtAxisId axisId) const
??返回軸的縮放引擎
axisStepSize():軸的步長
double QwtPlot::axisStepSize(QwtAxisId axisId) const
??返回在setAxisScale中設(shè)置的步長參數(shù)。這不一定是當(dāng)前比例的步長。
axisTitle():軸標(biāo)題
QwtText QwtPlot::axisTitle(QwtAxisId axisId) const
axisWidget():縮放控件
QwtScaleWidget * QwtPlot::axisWidget(QwtAxisId axisId)const QwtScaleWidget * QwtPlot::axisWidget(QwtAxisId axisId) const
??指定軸的縮放控件,如果axisId無效,則為NULL。
canvasBackground():畫布背景
QBrush QwtPlot::canvasBackground() const
??繪圖區(qū)域的背景畫筆。
canvasMap():畫布貼圖
  QwtScaleMap QwtPlot::canvasMap(QwtAxisId axisId) const virtual
??返回畫布上軸的貼圖。使用該貼圖,像素坐標(biāo)可以轉(zhuǎn)換為繪圖坐標(biāo),反之亦然。
drawCanvas():重繪畫布
void QwtPlot::drawCanvas(QPainter * painter) virtual
??重新繪制畫布。drawCanvas調(diào)用同樣用于打印的drawItems。喜歡添加單個(gè)繪圖項(xiàng)的應(yīng)用程序更好地重載drawItems()。
drawItems():重繪指定區(qū)域畫布元素
void QwtPlot::drawItems(QPainter * painter,
? ? ? ? ? ? ? ? ? ? const QRectF &canvasRect,
? ? ? ? ? ? ? ? ? ? const QwtScaleMap
? ? ? ? ? ? ? ? ? ? maps[QwtAxis::AxisPositions]) const virtual
??通常canvasRect是繪圖畫布的contentsRect()。由于Qt中的錯(cuò)誤,此矩形對(duì)于某些框架樣式(例如QFrame::Box)可能是錯(cuò)誤的,可能需要使用QWidget::setContentsMargins()手動(dòng)修復(fù)邊距
footer():頁腳文本
QwtText QwtPlot::footer() const
??頁腳文本
footerLabel():頁腳標(biāo)簽
QwtTextLabel * QwtPlot::footerLabel()
const QwtTextLabel * QwtPlot::footerLabel() const
??頁腳標(biāo)簽小部件。
getCanvasMarginsHint():獲取畫布邊距
void QwtPlot::getCanvasMarginsHint(const QwtScaleMap maps[],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const QRectF & canvasRect,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? double & left,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? double & top,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? double & right,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? double & bottom) const virtual
??計(jì)算畫布邊距。
insertLegend():插入圖例
void QwtPlot::insertLegend(QwtAbstractLegend * legend,
? ? ? ? ? ? ? ? ? ? ? ?QwtPlot::LegendPosition pos = wtPlot::RightLegend,
? ? ? ? ? ? ? ? ? ? ? ?double ratio = -1.0)
??插入圖例。
??如果位置圖例是QwtPlot::LeftLegend或QwtPlot::RightLegend,則圖例將從上到下組織在一列中。否則,圖例項(xiàng)將放置在從左到右具有最佳列數(shù)的表中。
insertLegend()將把繪圖小部件設(shè)置為圖例的父項(xiàng)。圖例將在繪圖的析構(gòu)函數(shù)中刪除,或在插入另一個(gè)圖例時(shí)刪除。
??未插入繪圖小部件布局的圖例需要連接到legendDataChanged()信號(hào)。調(diào)用updateLegend()將為初始更新啟動(dòng)此信號(hào)。當(dāng)應(yīng)用程序代碼想要實(shí)現(xiàn)自己的布局時(shí),也需要將繪圖渲染到文檔中。
invTransform():軸坐標(biāo)轉(zhuǎn)換
double QwtPlot::invTransform(QwtAxisId axisId, double pos ) const
??將繪圖區(qū)域中位置的x或y坐標(biāo)轉(zhuǎn)換為值。
isAxisValid():軸有效
bool QwtPlot::isAxisValid (QwtAxisId axisId) const
isAxisVisible():軸可見
bool isAxisVisible (QwtAxisId) const
replot():重繪
void QwtPlot::replot() virtual slot
QwtPlotGrid
簡介
??繪制坐標(biāo)網(wǎng)格的類。
??QwtPlotGrid類可用于繪制坐標(biāo)網(wǎng)格。坐標(biāo)軸網(wǎng)由主要和次要的垂直和水平軸網(wǎng)線組成。網(wǎng)格線的位置由X和Y比例劃分確定,可以使用setXDiv()和setYDiv()指定。draw()成員在邊界矩形內(nèi)繪制網(wǎng)格。
成員函數(shù)(列舉常用的)
enableX():啟用或禁用垂直網(wǎng)格線。
void QwtPlotGrid::enableX(bool on)
enableY():啟用或禁用水平網(wǎng)格線。
void QwtPlotGrid::enableY(bool on)
enableXMin():啟用或禁用次要垂直網(wǎng)格線。
void QwtPlotGrid::enableXMin(bool on)
enableYMin():啟用或禁用次要水平網(wǎng)格線。
void QwtPlotGrid::enableYMin(bool on)
majorPen():主要網(wǎng)格線的筆
const QPen & QwtPlotGrid::majorPen() const
minorPen():用于次要網(wǎng)格線的筆
const QPen & QwtPlotGrid::minorPen() const
QwtLegend
簡介
??圖例小部件。
??QwtLegend小部件是圖例項(xiàng)的表格排列。圖例項(xiàng)可以是任何類型的小部件,但通常它們都是QwtLegendLabel。
??可設(shè)置只顯示、顯示可選擇,顯示可點(diǎn)擊并拋出對(duì)應(yīng)的信號(hào)。
??使用時(shí),直接new即可,沒啥可說的。
QwtSymbol
簡介
??用于繪制符號(hào)的類,作用于實(shí)際數(shù)據(jù)點(diǎn)。
枚舉
enum QwtSymbol::Style:繪制的數(shù)據(jù)點(diǎn)符號(hào)樣式
??

成員函數(shù)(列舉常用的)
setStyle() :設(shè)置點(diǎn)樣式(配合上面枚舉Style)
void QwtSymbol::setStyle (QwtSymbol::Style style)
setSize():設(shè)置點(diǎn)大小
void QwtSymbol::setSize(const QSize & size)void QwtSymbol::setSize(int width, int height = -1)
??指定符號(hào)的大小。
??如果“h”參數(shù)被忽略或小于0,而“w”參數(shù)大于或等于0,則符號(hào)大小將設(shè)置為(w,w)。
QwtPlotCurve
??(注意:本文只列Demo舉用到的,下一篇文章將會(huì)著重講解QwtPlotCurve類)
簡介
??表示一系列點(diǎn)的繪圖項(xiàng)。
??曲線是x-y平面中一系列點(diǎn)的表示。它支持不同的顯示樣式、插值(例如樣條曲線)和符號(hào)。
指定曲線特性
??創(chuàng)建曲線時(shí),將配置為使用QwtPlotCurve::lines樣式繪制黑色實(shí)線,而不使用符號(hào)。您可以通過調(diào)用setPen()、setStyle()和setSymbol()來更改此符號(hào),使用QwtSymbol類來實(shí)現(xiàn)。
連接/分配數(shù)據(jù)
??QwtPlotCurve使用QwtSeriesData對(duì)象獲取其點(diǎn),該對(duì)象為點(diǎn)的實(shí)際存儲(chǔ)提供橋梁(如QAbstractItemModel)。
??有幾個(gè)從QwtSeriesData派生的便利類,它們也在內(nèi)部存儲(chǔ)點(diǎn)(如QStandardItemModel)。
??QwtPlotCurve還提供了setSamples()的一些變體,它們從內(nèi)部數(shù)組構(gòu)建QwtSeriesData對(duì)象。
將曲線附加到繪圖
??將QwtPlotItem附加到QwtPlot。它將首先將QwtPlotItem從任何繪圖中分離出來(如果需要)。如果傳遞了NULL參數(shù),它將從它所附加的任何QwtPlot分離。(可以判斷出,它只能附屬一個(gè)繪圖)
成員函數(shù)
setTitle():設(shè)置曲線的名稱
void QwtPlotItem::setTitle(const QString & title) void QwtPlotItem::setTitle(const QwtText & title)
setPen():設(shè)置曲線的畫筆
void QwtPlotCurve::setPen(const QColor & color,
? ? ? ? ? ? ? ? ? ? ? qreal width = 0.0,
? ? ? ? ? ? ? ? ? ? ? Qt::PenStyle style = Qt::SolidLine)void QwtPlotCurve::setPen(const QPen & pen)
??指定畫筆,寬度,線型等。
setXAxis():關(guān)聯(lián)X軸
void QwtPlotItem::setXAxis(QwtAxisId axisId)
??該項(xiàng)目將根據(jù)其坐標(biāo)軸繪制。
setYAxis():關(guān)聯(lián)Y軸
void QwtPlotItem::setYAxis(QwtAxisId axisId)
??該項(xiàng)目將根據(jù)其坐標(biāo)軸繪制。
setRenderHint():設(shè)置曲線渲染模式
void QwtGraphic::setRenderHint(RenderHint hint,
? ? ? ? ? ? ? ? ? ? ? ? ? ?bool on = true);
??只能設(shè)置QwtPlotItem::RenderAntialiased,然后參數(shù)為開啟或者關(guān)閉。
setSamples():設(shè)置曲線數(shù)據(jù)
void QwtPlotCurve::setSamples(const QVector< double > & xData,
? ? ? ? ? ? ? ? ? ? ? ? ? const QVector< double > & yData)
??使用x和y數(shù)組初始化數(shù)據(jù)(顯式共享)。
void QwtPlotCurve::setSamples(const double * xData,
? ? ? ? ? ? ? ? ? ? ? ? ? const double * yData,
? ? ? ? ? ? ? ? ? ? ? ? ? int size)
??通過從指定的內(nèi)存塊復(fù)制x和y值來設(shè)置數(shù)據(jù)。與setRawSamples()相反,此函數(shù)生成數(shù)據(jù)的“深度副本”。
attach():關(guān)聯(lián)曲線到繪圖
void QwtPlotItem::attach(QwtPlot * plot)
??將項(xiàng)目附著到繪圖。
??此方法將QwtPlotItem附加到QwtPlot參數(shù)。它將首先將QwtPlotItem從任何繪圖中分離出來(如果需要)。如果傳遞了NULL參數(shù),它將從它所附加的任何QwtPlot分離。
Demo源碼
LineChartWidget.h
#ifndef LINECHARTWIDGET_H#define LINECHARTWIDGET_H#include <QWidget>#include <QTimer>#include "qwt.h"#include "qwt_plot.h"#include "qwt_plot_grid.h"#include "qwt_legend.h"#include "qwt_plot_curve.h"#include "qwt_symbol.h"#include "qwt_spline_curve_fitter.h"namespace Ui {class LineChartWidget;}class LineChartWidget : public QWidget{
? ?Q_OBJECTpublic:
? ?explicit LineChartWidget(QWidget *parent = 0);
? ?~LineChartWidget();public:
? ?QColor getBackgroundColor() const;public:
? ?void setBackgroundColor(const QColor &backgroundColor);protected:
? ?void initControl();
? ?void initQwtPlot();protected slots:
? ?void slot_addDataTimeOut();protected:
? ?void resizeEvent(QResizeEvent *event);
? ?void timerEvent(QTimerEvent *event);private:
? ?Ui::LineChartWidget *ui;private:
? ?int _timerId;
? ?qint64 _startTime; ? ? ? ? ? ? ?// 啟動(dòng)時(shí)間private:
? ?QColor _backgroundColor; ? ? ? ?// 背景顏色private:
? ?QwtPlot *_pQwtPlot; ? ? ? ? ? ? // qwt圖
? ?QwtPlotGrid *_pGrid; ? ? ? ? ? ?// 虛線框
? ?QwtLegend *_pLegend; ? ? ? ? ? ?// 圖例
? ?QwtPlotCurve *_pCurve1; ? ? ? ? // 曲線1
? ?QwtSymbol *_pSymbol1; ? ? ? ? ? // 曲線1點(diǎn)符號(hào)
? ?QwtPlotCurve *_pCurve2; ? ? ? ? // 曲線2
? ?QVector<double> _vectorX1; ? ? ?// 曲線1緩存數(shù)據(jù)
? ?QVector<double> _vectorY1; ? ? ?// 曲線1緩存數(shù)據(jù)
? ?QVector<double> _vectorX2; ? ? ?// 曲線2緩存數(shù)據(jù)
? ?QVector<double> _vectorY2; ? ? ?// 曲線2緩存數(shù)據(jù)
? ?double _rangeX; ? ? ? ? ? ? ? ? // 范圍
? ?QTimer *_pTimerAddData; ? ? ? ? // 添加數(shù)據(jù)定時(shí)器};#endif // LINECHARTWIDGET_H
LineChartWidget.cpp
#include "LineChartWidget.h"#include "ui_LineChartWidget.h"#include <QDebug>#include <QDateTime>//#define LOG qDebug()<<__FILE__<<__LINE__//#define LOG qDebug()<<__FILE__<<__LINE__<<__FUNCTION__//#define LOG qDebug()<<__FILE__<<__LINE__<<QThread()::currentThread()//#define LOG qDebug()<<__FILE__<<__LINE__<<QDateTime::currentDateTime().toString("yyyy-MM-dd")#define LOG qDebug()<<__FILE__<<__LINE__<<QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss:zzz")LineChartWidget::LineChartWidget(QWidget *parent) :
? ?QWidget(parent),
? ?ui(new Ui::LineChartWidget),
? ?_pQwtPlot(0),
? ?_pGrid(0),
? ?_pLegend(0),
? ?_pCurve1(0),
? ?_pSymbol1(0),
? ?_pCurve2(0),
? ?_timerId(-1),
? ?_pTimerAddData(0),
? ?_rangeX(10){
? ?ui->setupUi(this);
? ?// 背景透明,在界面構(gòu)架時(shí),若為本窗口為其他窗口提升為本窗口時(shí),
? ?// 則再qss會(huì)在主窗口第一級(jí)添加frame_all,防止其他窗口提升本窗口而沖掉qss設(shè)置// ? ?setWindowFlag(Qt::FramelessWindowHint);// ? ?setAttribute(Qt::WA_TranslucentBackground, true);
? ?initControl();
? ?initQwtPlot();
? ?_startTime = QDateTime::currentDateTime().toMSecsSinceEpoch();
? ?_timerId = startTimer(16);
? ?timerEvent(0);}LineChartWidget::~LineChartWidget(){
? ?delete ui;}void LineChartWidget::initControl(){
? ?_pTimerAddData = new QTimer(this);
? ?connect(_pTimerAddData, SIGNAL(timeout()),
? ? ? ? ? ?this, SLOT(slot_addDataTimeOut()));
? ?_pTimerAddData->setInterval(1000);
? ?_pTimerAddData->start();}void LineChartWidget::initQwtPlot(){
? ?_pQwtPlot = new QwtPlot(this);
? ?// 設(shè)置背景色
? ?_pQwtPlot->setCanvasBackground(QBrush(QColor(255, 255, 255)));
? ?// 設(shè)置x1坐標(biāo)軸
? ?{
? ? ? ?_pQwtPlot->setAxisTitle(QwtPlot::xBottom, "x");
? ? ? ?_pQwtPlot->setAxisAutoScale(QwtPlot::xBottom, true);
? ?}
? ?// 設(shè)置y1坐標(biāo)軸
? ?{
? ? ? ?_pQwtPlot->setAxisTitle(QwtPlot::yLeft, "y");
? ? ? ?_pQwtPlot->setAxisAutoScale(QwtPlot::yLeft, true);
? ?}
? ?// 設(shè)置y2坐標(biāo)軸
? ?{
? ? ? ?_pQwtPlot->setAxisTitle(QwtPlot::yRight, "y");
? ? ? ?_pQwtPlot->setAxisVisible(QwtPlot::yRight, true);
? ? ? ?_pQwtPlot->setAxisAutoScale(QwtPlot::yRight, true);
? ?}
? ?// 設(shè)置繪圖區(qū)域網(wǎng)格
? ?{
? ? ? ?_pGrid = new QwtPlotGrid();
? ? ? ?_pGrid->setMajorPen(Qt::gray, 1, Qt::SolidLine);
? ? ? ?_pGrid->attach(_pQwtPlot);
? ?}
? ?// 設(shè)置圖例
? ?{
? ? ? ?_pLegend = new QwtLegend();
? ? ? ?_pLegend->setDefaultItemMode(QwtLegendData::ReadOnly);
? ? ? ?_pQwtPlot->insertLegend(_pLegend);
? ?}
? ?// 設(shè)置曲線1
? ?{
? ? ? ?_pCurve1 = new QwtPlotCurve();
? ? ? ?_pCurve1->setTitle("y1");
? ? ? ?_pCurve1->setPen(Qt::blue, 1);
? ? ? ?_pCurve1->setRenderHint(QwtPlotItem::RenderAntialiased, true);
? ? ? ?// 關(guān)聯(lián)軸
? ? ? ?_pCurve1->setXAxis(QwtPlot::xBottom);
? ? ? ?_pCurve1->setYAxis(QwtPlot::yLeft);
? ?}
? ?// 曲1符號(hào)對(duì)象
? ?{
? ? ? ?_pSymbol1 = new QwtSymbol(QwtSymbol::Ellipse);
? ? ? ?_pSymbol1->setPen(Qt::red);
? ? ? ?_pSymbol1->setBrush(Qt::red);
? ? ? ?_pSymbol1->setSize(2);
? ? ? ?_pCurve1->setSymbol(_pSymbol1);
? ?}
? ?// 曲線1數(shù)據(jù)
? ?{
? ? ? ?// 這是采用顯示共享的方式
? ? ? ?_pCurve1->setSamples(_vectorX1, _vectorY1);
? ? ? ?// 將曲線添加到繪圖
? ? ? ?_pCurve1->attach(_pQwtPlot);
? ?}
? ?// 曲線2
? ?{
? ? ? ?_pCurve2 = new QwtPlotCurve();
? ? ? ?_pCurve2->setTitle("y2");
? ? ? ?_pCurve2->setPen(Qt::red, 1);
? ? ? ?_pCurve2->setRenderHint(QwtPlotItem::RenderAntialiased, true);
? ? ? ?// 關(guān)聯(lián)軸
? ? ? ?_pCurve2->setXAxis(QwtPlot::xBottom);
? ? ? ?_pCurve2->setYAxis(QwtPlot::yRight);
? ?}
? ?// 曲線2數(shù)據(jù)
? ?{
? ? ? ?// 這是采用顯示共享的方式
? ? ? ?_pCurve2->setSamples(_vectorX2, _vectorY2);
? ? ? ?// 將曲線添加到繪圖
? ? ? ?_pCurve2->attach(_pQwtPlot);
? ?}}void LineChartWidget::slot_addDataTimeOut(){
? ?// 計(jì)算時(shí)間
? ?double currentTime = QDateTime::currentDateTime().toMSecsSinceEpoch();
? ?currentTime -= _startTime;
? ?currentTime /= 1000;
? ?// 添加曲線1數(shù)據(jù)
? ?_vectorX1.append(currentTime);
? ?_vectorY1.append(qrand() % 20 - 10);
? ?// 添加曲線2數(shù)據(jù)
? ?_vectorX2.append(currentTime);
? ?_vectorY2.append(qrand() % 50);
? ?// 數(shù)據(jù)置換(不知換數(shù)據(jù)進(jìn)不去,顯示共享無效?)
? ?_pCurve1->setSamples(_vectorX1, _vectorY1);
? ?_pCurve2->setSamples(_vectorX2, _vectorY2);}void LineChartWidget::resizeEvent(QResizeEvent *event){
? ?if(_pQwtPlot)
? ?{
? ? ? ?_pQwtPlot->setGeometry(rect());
? ?}
? ?QWidget::resizeEvent(event);}void LineChartWidget::timerEvent(QTimerEvent *event){
? ?// 計(jì)算時(shí)間
? ?double currentTime = QDateTime::currentDateTime().toMSecsSinceEpoch();
? ?currentTime -= _startTime;
? ?currentTime /= 1000;
? ?if(currentTime < 10.0)
? ?{
? ? ? ?_pQwtPlot->setAxisScale(QwtPlot::xBottom, 0, _rangeX, 1);
? ?}else{
? ? ? ?_pQwtPlot->setAxisScale(QwtPlot::xBottom, currentTime - _rangeX, currentTime, 1);
? ?}
? ?_pQwtPlot->replot();}QColor LineChartWidget::getBackgroundColor() const{
? ?return _backgroundColor;}void LineChartWidget::setBackgroundColor(const QColor &backgroundColor){
? ?_backgroundColor = backgroundColor;}
Demo工程模板v1.1.0
??

入坑
入坑一:使用顯示setSample關(guān)聯(lián)QVector失敗
問題
??顯示共享理解為共用數(shù)據(jù),但是數(shù)據(jù)不繪制到圖。
??

嘗試
??查看曲線是否有更新數(shù)據(jù)到圖的實(shí)現(xiàn),是沒有的。
??直接設(shè)置可刷新數(shù)據(jù)
解決
??直接setSample一次來解決。
??
