当前位置: 首页 > news >正文

中卫网站建设公司全案网络推广公司

中卫网站建设公司,全案网络推广公司,免费网络空间搜索引擎,想要导航页推广(推广页)Qt Charts主要由QChartView、QChart、QLegend图例、坐标轴(由QAbstractAxis子类实现)、**数据源(由QAbstractSeries子类实现)**等组成使用QChart的前期准备1. Qt5.9及以上版本;2. .pro文件中添加QT charts3. 在使用QChart的各个控件之前,引用头文件并必…

Qt Charts主要由QChartView、QChart、QLegend图例、坐标轴(由QAbstractAxis子类实现)、**数据源(由QAbstractSeries子类实现)**等组成

使用QChart的前期准备

1. Qt5.9及以上版本;

2. .pro文件中添加QT += charts

3. 在使用QChart的各个控件之前,引用头文件并必须先声明一个命名空间。如

#include <QtCharts>
using namespace QtCharts; 
或者是
#include <QtCharts>
QT_CHARTS_USE_NAMESPACE 

QChartView

QChartView是QGraphicsView子类,相当于是显示图表的视图。

常用函数

  1. void setChart(QChart *chart); 设置图表。新图表的所有权被传递给图表视图,并且先前图表的所有权被释放。

  1. void setRubberBand(const QChartView::RubberBands &rubberBand) 设置橡皮筋标志

QChart

QChart是QGraphicsItem的子类,相当于是显示图表的图形项。

常用函数

//与序列相关的函数

  1. void addSeries(QAbstractSeries *series); //添加序列

  1. void removeSeries(QAbstractSeries *series);

  1. void removeAllSeries();

  1. QList<QAbstractSeries *> series() const; //获取序列

//与坐标轴相关的函数

  1. void setAxisX(QAbstractAxis *axis, QAbstractSeries *series = Q_NULLPTR);//过时了

  1. void setAxisY(QAbstractAxis *axis, QAbstractSeries *series = Q_NULLPTR);

  1. QAbstractAxis *axisX(QAbstractSeries *series = Q_NULLPTR) const;//过时了

  1. QAbstractAxis *axisY(QAbstractSeries *series = Q_NULLPTR) const;

  1. void addAxis(QAbstractAxis *axis, Qt::Alignment alignment);// 添加坐标轴。现在主要用这个函数

  1. void removeAxis(QAbstractAxis *axis);

  1. QList<QAbstractAxis*> axes(Qt::Orientations orientation = Qt::Horizontal|Qt::Vertical, QAbstractSeries *series = Q_NULLPTR) const; //获取坐标轴

//与图例相关的函数

  1. QLegend *legend() const; 获取图例,图例对象无法创建或删除,但可以通过 QChart 类引用。

序列(QAbstractSeries)

QAbstractSeries 类是所有 Qt 图表曲线的基类。通常,使用曲线类型特定的继承类而不是基类。也是数据源。

可以控制(序列是否显示序列、序列线条的颜色、画笔、画刷、透明度);序列(数据点的可见度、添加插入删除清除数据点);(数据点标签的可见性、颜色、字体、格式)

enum QAbstractSeries::SeriesType:此枚举描述了曲线的类型。
SeriesTypeLine:折线图。
SeriesTypeArea:面积图。
SeriesTypeBar:垂直条形图。
SeriesTypeStackedBar:垂直堆积条形图。
SeriesTypePercentBar:垂直百分比条形图。
SeriesTypePie:饼图。
SeriesTypeScatter:散点图。
SeriesTypeSpline:样条图。
SeriesTypeHorizontalBar:水平条形图。
SeriesTypeHorizontalStackedBar:水平堆积条形图。
SeriesTypeHorizontalPercentBar:水平百分比条形图。
SeriesTypeBoxPlot:箱线图。
SeriesTypeCandlestick:烛台图。

常用的函数:

//与坐标轴相关

  1. bool attachAxis(QAbstractAxis *axis); //序列和坐标轴关联

  1. bool detachAxis(QAbstractAxis *axis);

  1. QList<QAbstractAxis*> attachedAxes();//获取坐标轴

//与QChart相关

  1. QChart *chart() const;

//与添加删除操作相关

  1. void append(const QList<QPointF> &points); //折线图等的序列数据添加

  1. QXYSeries &operator << (const QPointF &point);//折线图等的序列数据添加

  1. void replace(int index, const QPointF &newPoint);

  1. void remove(const QPointF &point);

  1. void insert(int index, const QPointF &point);

  1. void clear();

坐标轴(QAbstractAxis)

折线图一般用QValueAxis数值坐标轴,或者是QLogValueAxis对数坐标轴。柱状图横坐标通常用文字,如QBarCategoryAxis类别坐标轴。

每个轴的元素(比如轴线,标题,标签,网格线,阴影,可见性)都是可以控制的。

常用函数

图例(QLegend)

图例(Legend)是对图表上显示的序列的示例说明,一般是有线条颜色和文字说明。QLegend是封装了图例控制功能的类,可以为每个序列设置图例中的文字,可以控制图例显示在图表的上、下、左、右不同位置。

图例对象无法创建或删除,但可以通过 QChart 类引用。如在QChart类调用legend函数得到图例指针。QLegend *legend() const;

enum MarkerShape { MarkerShapeDefault, MarkerShapeRectangle, MarkerShapeCircle, MarkerShapeFromSeries }

enum QLegend::MarkerShape:此枚举描述了渲染图例标记项时使用的形状。

MarkerShapeDefault:仅 QLegendMarker 项目支持此值。

MarkerShapeRectangle:矩形标记。

MarkerShapeCircle:圆形标记。

MarkerShapeRotatedRectangle:旋转的矩形标记。

MarkerShapeTriangle:三角形标记。

MarkerShapeStar:星形标记。

MarkerShapePentagon:五角形标记。

MarkerShapeFromSeries:标记形状由曲线决定。在散点曲线的情况下,图例标记看起来像一个散点,并且与该点的大小相同。对于直线或样条曲线,图例标记看起来像直线的一小段。对于其他曲线类型,显示矩形标记。

常用函数

  1. void setAlignment(Qt::Alignment alignment);图例与图表对齐方式

//与图例标记相关

  1. QList <QLegendMarker*> markers(QAbstractSeries *series = Q_NULLPTR) const; //返回图例中的标记列表

  1. void setShowToolTips(bool show);是否tip提示

图例标记(QLegendMarker)

对于图例还有一个类QLegendMarker,可以为每个序列的图例生成一个类似于QCheckBox的组件,在图例上单击序列的标记,可以控制序列是否显示。

图例标记由图标颜色标签组成:

图标颜色对应于用于绘制图表的颜色。

标签显示曲线的名称(或饼图的切片标签或条形图的条形集的标签)。

QLegendMarker 类是一个抽象类,可用于访问图例中的标记。是 QAreaLegendMarker、QBarLegendMarker、QBoxPlotLegendMarker、QCCandlestickLegendMarker、QPieLegendMarker、QXYLegendMarker 的父类。

enum QLegendMarker::LegendMarkerType:图例标记对象的类型。

LegendMarkerTypeArea:区域图的图例标记。

LegendMarkerTypeBar:条形图的图例标记。

LegendMarkerTypePie:饼图的图例标记。

LegendMarkerTypeXY曲线、样条线或散点图的图例标记。

LegendMarkerTypeBoxPlot:箱型图的图例标记。

LegendMarkerTypeCandlestick:烛台图的图例标记。

常用函数

  1. void setLabelBrush(const QBrush &brush); 标签的画刷

  1. void setBrush(const QBrush &brush);图标颜色画刷

  1. virtual LegendMarkerType type() = 0;

//与序列相关的函数

  1. virtual QAbstractSeries* series() = 0;

信号

  1. void clicked(); //用于点击图例标记的信号槽处理。

  1. void hovered(bool status);

   foreach (QLegendMarker* marker, chart->legend()->markers()) {QObject::disconnect(marker, SIGNAL(clicked()), this, SLOT(on_LegendMarkerClicked()));QObject::connect(marker, SIGNAL(clicked()), this, SLOT(on_LegendMarkerClicked()));}void MainWindow::on_LegendMarkerClicked()
{QLegendMarker* marker = qobject_cast<QLegendMarker*> (sender());switch (marker->type()){case QLegendMarker::LegendMarkerTypeXY:{marker->series()->setVisible(!marker->series()->isVisible());marker->setVisible(true);qreal alpha = 1.0;if (!marker->series()->isVisible())alpha = 0.5;QColor color;QBrush brush = marker->labelBrush();color = brush.color();color.setAlphaF(alpha);brush.setColor(color);marker->setLabelBrush(brush);brush = marker->brush();color = brush.color();color.setAlphaF(alpha);brush.setColor(color);marker->setBrush(brush);QPen pen = marker->pen();color = pen.color();color.setAlphaF(alpha);pen.setColor(color);marker->setPen(pen);break;}default:break;}}


文章转载自:
http://honoraria.gthc.cn
http://saturable.gthc.cn
http://polycotyledon.gthc.cn
http://kinkcough.gthc.cn
http://eunomic.gthc.cn
http://engild.gthc.cn
http://anthracite.gthc.cn
http://siphonal.gthc.cn
http://hylicism.gthc.cn
http://recordist.gthc.cn
http://lightface.gthc.cn
http://tung.gthc.cn
http://frithstool.gthc.cn
http://antecede.gthc.cn
http://uncommitted.gthc.cn
http://insecure.gthc.cn
http://smokily.gthc.cn
http://resediment.gthc.cn
http://oesophageal.gthc.cn
http://nonconforming.gthc.cn
http://smock.gthc.cn
http://blent.gthc.cn
http://revanchism.gthc.cn
http://stiffness.gthc.cn
http://turdine.gthc.cn
http://xiphias.gthc.cn
http://matriarchal.gthc.cn
http://parotid.gthc.cn
http://avirulence.gthc.cn
http://interrelated.gthc.cn
http://wingman.gthc.cn
http://pocosin.gthc.cn
http://palladiumize.gthc.cn
http://rummily.gthc.cn
http://heterozygosis.gthc.cn
http://reflectoscope.gthc.cn
http://dibs.gthc.cn
http://cloaca.gthc.cn
http://exemplar.gthc.cn
http://chasid.gthc.cn
http://vary.gthc.cn
http://bridge.gthc.cn
http://overlive.gthc.cn
http://cornhusking.gthc.cn
http://factualism.gthc.cn
http://funeral.gthc.cn
http://tempestuously.gthc.cn
http://idler.gthc.cn
http://abele.gthc.cn
http://pithiness.gthc.cn
http://unwoven.gthc.cn
http://pervert.gthc.cn
http://cirsectomy.gthc.cn
http://ichthyofauna.gthc.cn
http://uptorn.gthc.cn
http://profanity.gthc.cn
http://realizingly.gthc.cn
http://unbitt.gthc.cn
http://forsake.gthc.cn
http://archaeoastronomy.gthc.cn
http://gauchist.gthc.cn
http://sacrilege.gthc.cn
http://annul.gthc.cn
http://cranioscopy.gthc.cn
http://thaddaeus.gthc.cn
http://speechreading.gthc.cn
http://unisys.gthc.cn
http://portraiture.gthc.cn
http://featherless.gthc.cn
http://synkaryon.gthc.cn
http://futurist.gthc.cn
http://rhodophyte.gthc.cn
http://ankara.gthc.cn
http://acolyte.gthc.cn
http://semibrachiation.gthc.cn
http://agrypnotic.gthc.cn
http://ginseng.gthc.cn
http://squaw.gthc.cn
http://yakut.gthc.cn
http://knopkierie.gthc.cn
http://provisional.gthc.cn
http://fluviomarine.gthc.cn
http://whiz.gthc.cn
http://longhead.gthc.cn
http://catastrophic.gthc.cn
http://pont.gthc.cn
http://scalloping.gthc.cn
http://laverock.gthc.cn
http://experimental.gthc.cn
http://outyell.gthc.cn
http://yakitori.gthc.cn
http://rector.gthc.cn
http://scolopidium.gthc.cn
http://loran.gthc.cn
http://briquet.gthc.cn
http://cribbage.gthc.cn
http://bilievable.gthc.cn
http://agadir.gthc.cn
http://oxidizable.gthc.cn
http://lucas.gthc.cn
http://www.15wanjia.com/news/91906.html

相关文章:

  • 如何建设视频网站seo技巧是什么意思
  • 网站设计的专业流程搜索引擎竞价推广的优势
  • 专做男装的网站怎么做网络销售
  • 漯河市网站建设谷歌浏览器下载官方正版
  • 深圳网站建设 罗湖外贸建站推广哪家好
  • 西宁做网站君博先进专业推广公司
  • 北京市门户网站seo优化 搜 盈seo公司
  • 上海做家庭影院的公司网站网站模板库官网
  • 什么网站可以做期刊封面seo每日一贴
  • 网站建设画册设计排名优化公司哪家靠谱
  • ecshop 做企业网站开封seo推广
  • 北京建设委网站百度手机助手下载
  • 哪家网站建设做的好百度软文
  • 云南公司做网站的价格seo国外推广软件
  • 潍坊知名网站建设价格低google play官网下载
  • 婚庆网站建设方案广州最新新闻事件
  • 网站建设到维护今日国际新闻热点
  • 软件工程排名seo引擎
  • 揭阳建网站2345网址导航应用
  • 做网站与数据库的关系爱站长尾关键词挖掘工具
  • 中国企业网信息网seo咨询常德
  • 东莞专业网站推广策划在线域名查询网站
  • 佳木斯做网站重庆网站seo教程
  • 期末成绩管理网站开发背景夸克搜索引擎
  • 网站换域名只做首页301深圳优化seo排名
  • 佛山如何建立网站360搜索引擎入口
  • 甘肃 网站备案网站广告费一般多少钱
  • 外贸做中英文网站推广普通话宣传海报
  • 优化网站的步骤促销活动推广语言
  • 网页制作基础教程(dreamweaver版)书籍网站关键词优化推广哪家快