上传缺失文件
This commit is contained in:
parent
f7550112e4
commit
8860553d6e
|
|
@ -0,0 +1,10 @@
|
||||||
|
#include "dpBaseWidget.h"
|
||||||
|
|
||||||
|
dpBaseWidget::dpBaseWidget(QWidget* parent)
|
||||||
|
:QWidget(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
dpBaseWidget::~dpBaseWidget()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
#ifndef DPBASEWIDGET_H
|
||||||
|
#define DPBASEWIDGET_H
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** DataPanel-BaseWidget
|
||||||
|
** author dsc
|
||||||
|
**
|
||||||
|
** 用来嵌入到dataPanel中进行数据展示的widget基类,定义了一些通用的函数接口
|
||||||
|
** 具体实现在继承类中完成
|
||||||
|
**
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QDateTime>
|
||||||
|
#include "global.h"
|
||||||
|
|
||||||
|
class dpBaseWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
dpBaseWidget(QWidget *parent = nullptr);
|
||||||
|
~dpBaseWidget();
|
||||||
|
|
||||||
|
virtual void setTimeRange(TimeUnit) {}
|
||||||
|
virtual void viewHistoricalData(QDateTime) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
#include "dpLineChart.h"
|
||||||
|
#include "util/Chart/qcustomplot.h"
|
||||||
|
|
||||||
|
dpLineChart::dpLineChart(QWidget* parent)
|
||||||
|
:dpBaseWidget(parent)
|
||||||
|
{
|
||||||
|
setAttribute(Qt::WA_TranslucentBackground,true);
|
||||||
|
|
||||||
|
m_pCustomPlot = new QCustomPlot(this);
|
||||||
|
initQCP();
|
||||||
|
|
||||||
|
QBoxLayout* mainLayout = new QBoxLayout(QBoxLayout::LeftToRight);
|
||||||
|
mainLayout->setContentsMargins(0, 1, 0, 0);
|
||||||
|
mainLayout->addWidget(m_pCustomPlot);
|
||||||
|
setLayout(mainLayout);
|
||||||
|
}
|
||||||
|
|
||||||
|
dpLineChart::~dpLineChart()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void dpLineChart::initQCP()
|
||||||
|
{
|
||||||
|
m_pCustomPlot->axisRect()->setupFullAxesBox();
|
||||||
|
m_pCustomPlot->xAxis->setSubTicks(false);
|
||||||
|
m_pCustomPlot->xAxis2->setTicks(false);
|
||||||
|
m_pCustomPlot->xAxis2->setSubTicks(false);
|
||||||
|
m_pCustomPlot->yAxis->setSubTicks(false);
|
||||||
|
m_pCustomPlot->yAxis2->setTicks(false);
|
||||||
|
m_pCustomPlot->yAxis2->setSubTicks(false);
|
||||||
|
//背景颜色
|
||||||
|
m_pCustomPlot->setBackground(QBrush(Qt::transparent));
|
||||||
|
//坐标轴颜色
|
||||||
|
QColor axisColor(100, 100, 100);
|
||||||
|
m_pCustomPlot->xAxis->setBasePen(axisColor);
|
||||||
|
m_pCustomPlot->xAxis->setTickPen(axisColor);
|
||||||
|
m_pCustomPlot->xAxis2->setBasePen(axisColor);
|
||||||
|
m_pCustomPlot->xAxis2->setTickPen(axisColor);
|
||||||
|
m_pCustomPlot->yAxis->setBasePen(axisColor);
|
||||||
|
m_pCustomPlot->yAxis->setTickPen(axisColor);
|
||||||
|
m_pCustomPlot->yAxis2->setBasePen(axisColor);
|
||||||
|
m_pCustomPlot->yAxis2->setTickPen(axisColor);
|
||||||
|
//坐标刻度颜色
|
||||||
|
QColor tickColor(100, 100, 100);
|
||||||
|
m_pCustomPlot->xAxis->setTickPen(QPen(tickColor));
|
||||||
|
m_pCustomPlot->yAxis->setTickPen(QPen(tickColor));
|
||||||
|
//坐标刻度Label颜色
|
||||||
|
QColor tickLabelColor(250, 250, 250);
|
||||||
|
m_pCustomPlot->xAxis->setTickLabelColor(tickLabelColor);
|
||||||
|
m_pCustomPlot->xAxis->setTickLabelFont(QFont(QString::fromWCharArray(L"黑体"), 10));
|
||||||
|
m_pCustomPlot->yAxis->setTickLabelColor(tickLabelColor);
|
||||||
|
m_pCustomPlot->yAxis->setTickLabelFont(QFont(QString::fromWCharArray(L"黑体"), 10));
|
||||||
|
//网格线颜色
|
||||||
|
QColor gridColor(100, 100, 100);
|
||||||
|
m_pCustomPlot->xAxis->grid()->setPen(QPen(gridColor, 1, Qt::DotLine));
|
||||||
|
m_pCustomPlot->xAxis->grid()->setZeroLinePen(QPen(gridColor, 1, Qt::DotLine));
|
||||||
|
m_pCustomPlot->yAxis->grid()->setPen(QPen(gridColor, 1, Qt::DotLine));
|
||||||
|
m_pCustomPlot->yAxis->grid()->setZeroLinePen(QPen(gridColor, 1, Qt::DotLine));
|
||||||
|
}
|
||||||
|
|
||||||
|
void dpLineChart::setTimeRange(TimeUnit unit)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void dpLineChart::viewHistoricalData(QDateTime dateTime)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
#ifndef DPLINECHART_H
|
||||||
|
#define DPLINECHART_H
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** DataPanel-LineChart
|
||||||
|
** author dsc
|
||||||
|
**
|
||||||
|
** 折线图展示面板,用来展示带有时序数据,可以和TimeLine等组件进行时间属性的交互
|
||||||
|
** 采用QCustomPlot实现
|
||||||
|
**
|
||||||
|
******************************************************************************/
|
||||||
|
|
||||||
|
#include "dpBaseWidget.h"
|
||||||
|
|
||||||
|
class QCustomPlot;
|
||||||
|
|
||||||
|
class dpLineChart : public dpBaseWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
dpLineChart(QWidget *parent = nullptr);
|
||||||
|
~dpLineChart();
|
||||||
|
|
||||||
|
void setTimeRange(TimeUnit);
|
||||||
|
void viewHistoricalData(QDateTime);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void initQCP();
|
||||||
|
|
||||||
|
QCustomPlot* m_pCustomPlot;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
** TimeLine-TimeLineItem
|
** TimeLine-TimeLineItem
|
||||||
** author 段胜超
|
** author dsc
|
||||||
**
|
**
|
||||||
** TimeLine的核心组件,用于展现时间刻度线、时间点文字等信息,通过重绘来模拟
|
** TimeLine的核心组件,用于展现时间刻度线、时间点文字等信息,通过重绘来模拟
|
||||||
** 鼠标的拖拽、缩放等操作。
|
** 鼠标的拖拽、缩放等操作。
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue