From c7c8ba0bef56febafe7a5602f7a6a680ba0e21e7 Mon Sep 17 00:00:00 2001 From: Irony <892768447@qq.com> Date: Tue, 19 Dec 2017 01:47:24 +0800 Subject: [PATCH] update --- PyQtChart练习/堆叠柱状图/ChartHelper.py | 51 +++++++++++++++++++++++++ PyQtChart练习/堆叠柱状图/option.json | 41 ++++++++++++++++++++ PyQtChart练习/堆叠柱状图/堆叠柱状图.py | 38 ++++++++++++++++++ QGraphicsView练习/世界地图/README.md | 2 +- README.md | 6 +-- 5 files changed, 134 insertions(+), 4 deletions(-) create mode 100644 PyQtChart练习/堆叠柱状图/ChartHelper.py create mode 100644 PyQtChart练习/堆叠柱状图/option.json create mode 100644 PyQtChart练习/堆叠柱状图/堆叠柱状图.py diff --git a/PyQtChart练习/堆叠柱状图/ChartHelper.py b/PyQtChart练习/堆叠柱状图/ChartHelper.py new file mode 100644 index 0000000..6c0e18e --- /dev/null +++ b/PyQtChart练习/堆叠柱状图/ChartHelper.py @@ -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 diff --git a/PyQtChart练习/堆叠柱状图/option.json b/PyQtChart练习/堆叠柱状图/option.json new file mode 100644 index 0000000..8e8cbc1 --- /dev/null +++ b/PyQtChart练习/堆叠柱状图/option.json @@ -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": { + } +} diff --git a/PyQtChart练习/堆叠柱状图/堆叠柱状图.py b/PyQtChart练习/堆叠柱状图/堆叠柱状图.py new file mode 100644 index 0000000..3583409 --- /dev/null +++ b/PyQtChart练习/堆叠柱状图/堆叠柱状图.py @@ -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_()) diff --git a/QGraphicsView练习/世界地图/README.md b/QGraphicsView练习/世界地图/README.md index b25219f..0a6c6db 100644 --- a/QGraphicsView练习/世界地图/README.md +++ b/QGraphicsView练习/世界地图/README.md @@ -1,4 +1,4 @@ -# QGraphicsView练习 +# 描绘世界地图 # 截图 世界地图-使用Ctrl+滑轮进行放大缩小 diff --git a/README.md b/README.md index 2cce6e9..4b44d88 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,8 @@ ### 11.浏览器获取Cookie
-### 12.截图画矩形
+### 12.全局热键
-### 13.全局热键
+### 13.QGraphicsView练习
-### 14.QGraphicsView练习
\ No newline at end of file +### 14.PyQtDataVisualization练习
\ No newline at end of file