qml: QtChart横纵轴label设置;
在qml中,使用ChartView作为图表展示区域, 但是并没有给定接口用来设置xlabel,ylabel。
没得办法,只能采用笨方案: (我的方法如下)
import QtQuick 2.0
import MaterialUI 1.0
import QtCharts 2.0 as CHARTS
CHARTS.ChartView{
id: chart;
property alias xlabel: xlabel.text;
property alias ylabel: ylabel.text;
property int rotation: -90;
Rectangle{
id: xlabelArea;
height: chart.margins.bottom;
anchors{
left: chart.left;
right:chart.right;
bottom: chart.bottom;
} Text{id: xlabel; anchors.centerIn: parent;}
} Rectangle{
id: ylabelArea;
width: chart.margins.left;
anchors{
left: chart.left;
top: chart.top;
bottom: chart.bottom;
}
Text{
id: ylabel;anchors.centerIn: parent; rotation: -90;
}
}
}
该方法需要了解两个知识点:
1) 文字旋转; ------------ Item自带rotation属性,可以实现任意角度的旋转;
2) margin大小(ChartView与图表之间的间隔); --------------------- QChartView与Chart之间的大小可以从margins属性中获取;
注: 若哪位知道其他实现的方法,望能不吝相告!
qml: QtChart横纵轴label设置;的更多相关文章
- Label设置行间距--b
内容摘要 UILabel显示多行文本 UILabel设置行间距 解决单行文本 & 多行文本显示的问题 场景描述 众所周知,UILabel显示多行的话,默认行间距为0,但实际开发中,如果显示多行 ...
- C# 、winform 添加皮肤后(IrisSkin2) label设置的颜色 无法显示
C# .winform 添加皮肤后(IrisSkin2) label设置的颜色 无法显示 解决方法一:设置label的Tag属性值与skinEngine的DisableTag属性值相同即可.默认值是9 ...
- Label设置行间距
内容摘要 UILabel显示多行文本 UILabel设置行间距 解决单行文本 & 多行文本显示的问题 场景描述 众所周知,UILabel显示多行的话,默认行间距为0,但实际开发中,如果显示多行 ...
- pixmap和label设置图片自适应大小
在label中添加pixmap来显示图片时,当图片过大时图片显示不全. 1.这时可以使用pixmap的scared()方法,来设置图片缩放. QPixmap QPixmap.scaled (self, ...
- Leaflet使用vector tiles 标注label设置
JS //简单的标注 var marker = L.marker([ 31.2, 114.5 ], { // icon:myIcon }).addTo(map) // 设置label .bindToo ...
- label设置渐变时不显示纯英文纯数字字符串
提出问题: 当对UILabel设置渐变color时,有点小问题.即:text为中文或中英混合字符串时显示正常,纯英文字符串不显示!!! 剖析问题: 经搜索了解到:在显示中文时,绘制渐变color的 ...
- echart 折线渐变 加柱形图结合图形,左右纵轴自设置格式,现行图北京渐变 ,x轴字体倾斜
app.title = '折柱混合'; option = { grid: { left: '5%', //距离左边的距离 right: '5%', //距离右边的距离 top:'8%', bottom ...
- R语言学习 - 热图绘制heatmap
生成测试数据 绘图首先需要数据.通过生成一堆的向量,转换为矩阵,得到想要的数据. data <- c(1:6, 6:1, 6:1, 1:6, (6:1)/10, (1:6)/10, (1:6)/ ...
- FacertGrid()的使用
查看数据的前五行 tips = sns.load_dataset("tips") tips.head() 引入数据,布置横向画布 g = sns.FacetGrid(tips, c ...
随机推荐
- Jenkins+PowerShell持续集成环境搭建(一)前期准备
0. 系统要求 Windows Server:本文章使用的为Windows Server 2012 JDK:本文章使用为JDK 1.8 Windows PowerShell:本文章使用为PowerSh ...
- Span<T>
Introduction Span<T> is a new type we are adding to the platform to represent contiguous regio ...
- Xamarin + MvvmCross 安装 Part 1
前言 最近,由于工作需要,公司准备开发移动端APP.临近年底,公司不准备大面招人,由于公司一直基于.net平台进行开发,本人自告奋勇,准备先用xamarin做下移动开发.开始了在网上不停的google ...
- Asp.Net Core 输出 Word
In one of the ASP.NET Core projects we did in the last year, we created an OutputFormatter to provid ...
- dom定位的三种元素
1.通过id #XXX 2.通过标签 xxx 3.通过类 .xxx
- luogu3391
P3391 [模板]文艺平衡树(Splay) 题目背景 这是一道经典的Splay模板题——文艺平衡树. 题目描述 您需要写一种数据结构(可参考题目标题),来维护一个有序数列,其中需要提供以下操作:翻转 ...
- python----re正则模块详解
今天介绍一下Python中常用的正则表达式处理函数.Python的正则表达式主要有两种方法完成模式匹配:『搜索』和『匹配』 re.match re.match 尝试从字符串的开始全部或者部分匹配某个模 ...
- kubernetes 外部访问集群暴露端口服务
在yaml文件中多个不同类型资源可以用“---”在划分 name: httpd2-svc namespace: kube-public #给资源分配网络 所用资源将在 kube-public ...
- 洛谷3705 [SDOI2017] 新生舞会 【01分数规划】【KM算法】
题目分析: 裸题.怀疑$ O(n^4log{n}) $跑不过,考虑Edmonds-Karp优化. 代码: #include<bits/stdc++.h> using namespace s ...
- Hibernate查询以及优化策略04
一. HQL查询 1. HQL(hibernate query language)单表查询 1.1 准备项目 创建项目: hinernate-03-query 引入jar,同前一个项目 复制实体(订单 ...