update
This commit is contained in:
parent
6fd54202ac
commit
c7c8ba0bef
5 changed files with 134 additions and 4 deletions
51
PyQtChart练习/堆叠柱状图/ChartHelper.py
Normal file
51
PyQtChart练习/堆叠柱状图/ChartHelper.py
Normal file
|
@ -0,0 +1,51 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
'''
|
||||
Created on 2017年12月18日
|
||||
@author: Irony."[讽刺]
|
||||
@site: http://alyl.vip, http://orzorz.vip, http://coding.net/u/892768447, http://github.com/892768447
|
||||
@email: 892768447@qq.com
|
||||
@file: ChartHelper
|
||||
@description:
|
||||
'''
|
||||
import json
|
||||
|
||||
from PyQt5.QtChart import QChart
|
||||
import chardet
|
||||
|
||||
|
||||
__version__ = "0.0.1"
|
||||
|
||||
|
||||
class OptionAnalysis:
|
||||
|
||||
def __init__(self, chart, file):
|
||||
self._chart = chart
|
||||
with open(file, "rb") as fp:
|
||||
data = fp.read()
|
||||
encoding = chardet.detect(data) or {}
|
||||
data = data.decode(encoding.get("encoding") or "utf-8")
|
||||
self.__analysis(json.loads(data))
|
||||
|
||||
def __getAnimation(self, value):
|
||||
'''
|
||||
get animation type
|
||||
:param value: all|grid|series|no
|
||||
:rtype: QChart.AnimationOption
|
||||
'''
|
||||
if value == "all":
|
||||
return QChart.AllAnimations
|
||||
elif value == "grid":
|
||||
return QChart.GridAxisAnimations
|
||||
elif value == "series":
|
||||
return QChart.SeriesAnimations
|
||||
else:
|
||||
return QChart.NoAnimation
|
||||
|
||||
def __analysis(self, datas):
|
||||
'''
|
||||
analysis json data
|
||||
:param datas: json data
|
||||
'''
|
||||
pass
|
41
PyQtChart练习/堆叠柱状图/option.json
Normal file
41
PyQtChart练习/堆叠柱状图/option.json
Normal file
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"title": {
|
||||
"text": "堆叠柱状图",
|
||||
"brush": "",
|
||||
"font": ""
|
||||
},
|
||||
"antialiasing": true,
|
||||
"theme": "",
|
||||
"animation": {
|
||||
"duration": 1000,
|
||||
"curve": "Linear",
|
||||
"options": "all"
|
||||
},
|
||||
"BackgroundBrush": "",
|
||||
"BackgroundPen": "",
|
||||
"BackgroundRoundness": "",
|
||||
"BackgroundVisible": true,
|
||||
"DropShadowEnabled": true,
|
||||
"Margins": "",
|
||||
"PlotAreaBackgroundBrush": "",
|
||||
"PlotAreaBackgroundPen": "",
|
||||
"PlotAreaBackgroundVisible": true,
|
||||
"legend": {
|
||||
"alignment": "center",
|
||||
"backgroundVisible": true,
|
||||
"BorderColor": "#00FF00",
|
||||
"Brush": "",
|
||||
"Color": "black",
|
||||
"font": "微软雅黑",
|
||||
"LabelBrush": "",
|
||||
"LabelColor": "red",
|
||||
"MarkerShape": "",
|
||||
"Pen": "",
|
||||
"reverseMarkers": true,
|
||||
"showToolTips": true
|
||||
},
|
||||
"axisx": {
|
||||
},
|
||||
"axisy": {
|
||||
}
|
||||
}
|
38
PyQtChart练习/堆叠柱状图/堆叠柱状图.py
Normal file
38
PyQtChart练习/堆叠柱状图/堆叠柱状图.py
Normal file
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
'''
|
||||
Created on 2017年12月18日
|
||||
@author: Irony."[讽刺]
|
||||
@site: http://alyl.vip, http://orzorz.vip, https://coding.net/u/892768447, https://github.com/892768447
|
||||
@email: 892768447@qq.com
|
||||
@file: 堆叠柱状图
|
||||
@description:
|
||||
'''
|
||||
import sys
|
||||
|
||||
from PyQt5.QtChart import QChartView, QChart
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
|
||||
|
||||
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
|
||||
__Copyright__ = "Copyright (c) 2017 Irony.\"[讽刺]"
|
||||
__Version__ = "Version 1.0"
|
||||
|
||||
|
||||
class StackBarChart(QChartView):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(StackBarChart, self).__init__(*args, **kwargs)
|
||||
self._chart = QChart()
|
||||
self.setChart(self._chart)
|
||||
|
||||
def initUi(self, file):
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = QApplication(sys.argv)
|
||||
w = StackBarChart()
|
||||
w.show()
|
||||
sys.exit(app.exec_())
|
|
@ -1,4 +1,4 @@
|
|||
# QGraphicsView练习
|
||||
# 描绘世界地图
|
||||
|
||||
# 截图
|
||||
世界地图-使用Ctrl+滑轮进行放大缩小
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
|
||||
### 11.<a href="浏览器获取Cookie">浏览器获取Cookie</a><br />
|
||||
|
||||
### 12.<a href="截图画矩形">截图画矩形</a><br />
|
||||
### 12.<a href="全局热键">全局热键</a><br />
|
||||
|
||||
### 13.<a href="全局热键">全局热键</a><br />
|
||||
### 13.<a href="QGraphicsView练习">QGraphicsView练习</a><br />
|
||||
|
||||
### 14.<a href="QGraphicsView练习">QGraphicsView练习</a><br />
|
||||
### 14.<a href="PyQtDataVisualization练习">PyQtDataVisualization练习</a><br />
|
Loading…
Reference in a new issue