@v587d/capital-generation 2.29.0 → 2.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (299) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +3 -3
  3. package/THIRD_PARTY_NOTICES.md +16 -0
  4. package/automation/package.json +1 -1
  5. package/chart-ui/package.json +1 -1
  6. package/config/package.json +1 -1
  7. package/lib/collector-runtime.js +56 -1
  8. package/lib/data-collector/catalog-taxonomy.d.ts +1 -1
  9. package/lib/data-collector/catalog-taxonomy.js +33 -0
  10. package/lib/data-collector/tools.js +7 -7
  11. package/lib/python-runtime/errors.d.ts +1 -1
  12. package/lib/python-runtime/errors.js +2 -0
  13. package/lib/python-runtime/manager.d.ts +28 -1
  14. package/lib/python-runtime/manager.js +141 -5
  15. package/lib/python-runtime/probe.d.ts +24 -0
  16. package/lib/python-runtime/probe.js +66 -50
  17. package/lib/sources/csindex-http.d.ts +4 -0
  18. package/lib/sources/csindex-http.js +233 -0
  19. package/lib/sources/eastmoney-http.js +1504 -1
  20. package/lib/sources/fuyao-rest.js +168 -8
  21. package/lib/sources/official-http.d.ts +4 -0
  22. package/lib/sources/official-http.js +477 -0
  23. package/lib/sources/python-remote.d.ts +25 -0
  24. package/lib/sources/python-remote.js +461 -0
  25. package/lib/sources/sina-http.d.ts +2 -0
  26. package/lib/sources/sina-http.js +484 -0
  27. package/lib/sources/tencent-http.js +23 -8
  28. package/lib/sources/ths-http.d.ts +2 -0
  29. package/lib/sources/ths-http.js +514 -0
  30. package/lib/time/tools.js +19 -0
  31. package/lib/web-retriever/local-fetch.d.ts +1 -1
  32. package/lib/web-retriever/local-fetch.js +1 -1
  33. package/lib/web-retriever/sources.d.ts +7 -0
  34. package/lib/web-retriever/sources.js +46 -21
  35. package/lib/web-retriever/throttle.d.ts +8 -0
  36. package/lib/web-retriever/throttle.js +13 -0
  37. package/lib/web-retriever/tools.js +1 -1
  38. package/lib/web-retriever/wind-client.d.ts +1 -1
  39. package/lib/web-retriever/wind-client.js +1 -1
  40. package/package.json +1 -1
  41. package/preset/capital-generation/agent.patch.yml +7 -5
  42. package/preset/capital-generation/skills/capital-data-protocol/SKILL.md +16 -16
  43. package/python/scripts/baostock_stock_basic.py +129 -0
  44. package/python/scripts/baostock_valuation_history.py +141 -0
  45. package/python/scripts/pbc_social_financing.py +291 -0
  46. package/python/vendor/baostock/LICENSE +19 -0
  47. package/python/vendor/baostock/__init__.py +42 -0
  48. package/python/vendor/baostock/common/__init__.py +0 -0
  49. package/python/vendor/baostock/common/contants.py +189 -0
  50. package/python/vendor/baostock/common/context.py +4 -0
  51. package/python/vendor/baostock/corpreport/__init__.py +0 -0
  52. package/python/vendor/baostock/corpreport/corp_performance.py +202 -0
  53. package/python/vendor/baostock/data/__init__.py +0 -0
  54. package/python/vendor/baostock/data/messageheader.py +17 -0
  55. package/python/vendor/baostock/data/msg.py +21 -0
  56. package/python/vendor/baostock/data/resultset.py +200 -0
  57. package/python/vendor/baostock/demo/__init__.py +0 -0
  58. package/python/vendor/baostock/demo/demo_A_stock_5mk-data.py +34 -0
  59. package/python/vendor/baostock/demo/demo_A_stock_k_data.py +36 -0
  60. package/python/vendor/baostock/demo/demo_AllStock.py +27 -0
  61. package/python/vendor/baostock/demo/demo_Balance_data.py +22 -0
  62. package/python/vendor/baostock/demo/demo_CashFlow_data.py +22 -0
  63. package/python/vendor/baostock/demo/demo_Dividend_data.py +35 -0
  64. package/python/vendor/baostock/demo/demo_Dupont_data.py +25 -0
  65. package/python/vendor/baostock/demo/demo_Forecast_report.py +24 -0
  66. package/python/vendor/baostock/demo/demo_Growth_data.py +22 -0
  67. package/python/vendor/baostock/demo/demo_Index_k_data.py +39 -0
  68. package/python/vendor/baostock/demo/demo_Operation_data.py +22 -0
  69. package/python/vendor/baostock/demo/demo_PerformanceExpress_report.py +25 -0
  70. package/python/vendor/baostock/demo/demo_Profit_data.py +22 -0
  71. package/python/vendor/baostock/demo/demo_TradeDates.py +27 -0
  72. package/python/vendor/baostock/demo/demo_adjust_factor_data.py +23 -0
  73. package/python/vendor/baostock/demo/demo_assignDayData.py +23 -0
  74. package/python/vendor/baostock/demo/demo_daily_adjust_factor_data.py +28 -0
  75. package/python/vendor/baostock/demo/demo_daily_k_4_AStock.py +28 -0
  76. package/python/vendor/baostock/demo/demo_daily_k_4_ETF.py +28 -0
  77. package/python/vendor/baostock/demo/demo_depositRate_data.py +26 -0
  78. package/python/vendor/baostock/demo/demo_hs300_stocks.py +26 -0
  79. package/python/vendor/baostock/demo/demo_loanRate_data.py +26 -0
  80. package/python/vendor/baostock/demo/demo_moneySupplyDataMonth_data.py +26 -0
  81. package/python/vendor/baostock/demo/demo_moneySupplyDataYear_data.py +26 -0
  82. package/python/vendor/baostock/demo/demo_requiredReserveRatio_data.py +26 -0
  83. package/python/vendor/baostock/demo/demo_set_API_key.py +37 -0
  84. package/python/vendor/baostock/demo/demo_stockBasic_data.py +27 -0
  85. package/python/vendor/baostock/demo/demo_stock_Valuation_indicator_data.py +34 -0
  86. package/python/vendor/baostock/demo/demo_stock_industry.py +26 -0
  87. package/python/vendor/baostock/demo/demo_sz50stocks.py +26 -0
  88. package/python/vendor/baostock/demo/demo_zz500_stock.py +26 -0
  89. package/python/vendor/baostock/evaluation/__init__.py +0 -0
  90. package/python/vendor/baostock/evaluation/season_index.py +758 -0
  91. package/python/vendor/baostock/login/__init__.py +0 -0
  92. package/python/vendor/baostock/login/loginout.py +230 -0
  93. package/python/vendor/baostock/macroscopic/__init__.py +0 -0
  94. package/python/vendor/baostock/macroscopic/economic_data.py +723 -0
  95. package/python/vendor/baostock/metadata/__init__.py +0 -0
  96. package/python/vendor/baostock/metadata/stock_metadata.py +207 -0
  97. package/python/vendor/baostock/security/__init__.py +0 -0
  98. package/python/vendor/baostock/security/history.py +265 -0
  99. package/python/vendor/baostock/security/sectorinfo.py +1024 -0
  100. package/python/vendor/baostock/util/__init__.py +0 -0
  101. package/python/vendor/baostock/util/socketutil.py +97 -0
  102. package/python/vendor/baostock/util/stringutil.py +83 -0
  103. package/python/vendor/et_xmlfile/LICENSE +23 -0
  104. package/python/vendor/et_xmlfile/LICENSE.python +298 -0
  105. package/python/vendor/et_xmlfile/__init__.py +8 -0
  106. package/python/vendor/et_xmlfile/incremental_tree.py +917 -0
  107. package/python/vendor/et_xmlfile/xmlfile.py +158 -0
  108. package/python/vendor/openpyxl/LICENSE +23 -0
  109. package/python/vendor/openpyxl/__init__.py +19 -0
  110. package/python/vendor/openpyxl/_constants.py +13 -0
  111. package/python/vendor/openpyxl/cell/__init__.py +4 -0
  112. package/python/vendor/openpyxl/cell/_writer.py +136 -0
  113. package/python/vendor/openpyxl/cell/cell.py +332 -0
  114. package/python/vendor/openpyxl/cell/read_only.py +136 -0
  115. package/python/vendor/openpyxl/cell/rich_text.py +202 -0
  116. package/python/vendor/openpyxl/cell/text.py +184 -0
  117. package/python/vendor/openpyxl/chart/_3d.py +105 -0
  118. package/python/vendor/openpyxl/chart/__init__.py +19 -0
  119. package/python/vendor/openpyxl/chart/_chart.py +199 -0
  120. package/python/vendor/openpyxl/chart/area_chart.py +106 -0
  121. package/python/vendor/openpyxl/chart/axis.py +401 -0
  122. package/python/vendor/openpyxl/chart/bar_chart.py +144 -0
  123. package/python/vendor/openpyxl/chart/bubble_chart.py +67 -0
  124. package/python/vendor/openpyxl/chart/chartspace.py +195 -0
  125. package/python/vendor/openpyxl/chart/data_source.py +246 -0
  126. package/python/vendor/openpyxl/chart/descriptors.py +43 -0
  127. package/python/vendor/openpyxl/chart/error_bar.py +62 -0
  128. package/python/vendor/openpyxl/chart/label.py +127 -0
  129. package/python/vendor/openpyxl/chart/layout.py +74 -0
  130. package/python/vendor/openpyxl/chart/legend.py +75 -0
  131. package/python/vendor/openpyxl/chart/line_chart.py +129 -0
  132. package/python/vendor/openpyxl/chart/marker.py +90 -0
  133. package/python/vendor/openpyxl/chart/picture.py +35 -0
  134. package/python/vendor/openpyxl/chart/pie_chart.py +177 -0
  135. package/python/vendor/openpyxl/chart/pivot.py +65 -0
  136. package/python/vendor/openpyxl/chart/plotarea.py +162 -0
  137. package/python/vendor/openpyxl/chart/print_settings.py +57 -0
  138. package/python/vendor/openpyxl/chart/radar_chart.py +55 -0
  139. package/python/vendor/openpyxl/chart/reader.py +32 -0
  140. package/python/vendor/openpyxl/chart/reference.py +124 -0
  141. package/python/vendor/openpyxl/chart/scatter_chart.py +53 -0
  142. package/python/vendor/openpyxl/chart/series.py +197 -0
  143. package/python/vendor/openpyxl/chart/series_factory.py +41 -0
  144. package/python/vendor/openpyxl/chart/shapes.py +89 -0
  145. package/python/vendor/openpyxl/chart/stock_chart.py +54 -0
  146. package/python/vendor/openpyxl/chart/surface_chart.py +119 -0
  147. package/python/vendor/openpyxl/chart/text.py +78 -0
  148. package/python/vendor/openpyxl/chart/title.py +76 -0
  149. package/python/vendor/openpyxl/chart/trendline.py +98 -0
  150. package/python/vendor/openpyxl/chart/updown_bars.py +31 -0
  151. package/python/vendor/openpyxl/chartsheet/__init__.py +3 -0
  152. package/python/vendor/openpyxl/chartsheet/chartsheet.py +107 -0
  153. package/python/vendor/openpyxl/chartsheet/custom.py +61 -0
  154. package/python/vendor/openpyxl/chartsheet/properties.py +28 -0
  155. package/python/vendor/openpyxl/chartsheet/protection.py +41 -0
  156. package/python/vendor/openpyxl/chartsheet/publish.py +58 -0
  157. package/python/vendor/openpyxl/chartsheet/relation.py +97 -0
  158. package/python/vendor/openpyxl/chartsheet/views.py +51 -0
  159. package/python/vendor/openpyxl/comments/__init__.py +4 -0
  160. package/python/vendor/openpyxl/comments/author.py +21 -0
  161. package/python/vendor/openpyxl/comments/comment_sheet.py +211 -0
  162. package/python/vendor/openpyxl/comments/comments.py +62 -0
  163. package/python/vendor/openpyxl/comments/shape_writer.py +112 -0
  164. package/python/vendor/openpyxl/compat/__init__.py +54 -0
  165. package/python/vendor/openpyxl/compat/abc.py +8 -0
  166. package/python/vendor/openpyxl/compat/numbers.py +43 -0
  167. package/python/vendor/openpyxl/compat/product.py +17 -0
  168. package/python/vendor/openpyxl/compat/singleton.py +40 -0
  169. package/python/vendor/openpyxl/compat/strings.py +25 -0
  170. package/python/vendor/openpyxl/descriptors/__init__.py +58 -0
  171. package/python/vendor/openpyxl/descriptors/base.py +272 -0
  172. package/python/vendor/openpyxl/descriptors/container.py +41 -0
  173. package/python/vendor/openpyxl/descriptors/excel.py +112 -0
  174. package/python/vendor/openpyxl/descriptors/namespace.py +12 -0
  175. package/python/vendor/openpyxl/descriptors/nested.py +129 -0
  176. package/python/vendor/openpyxl/descriptors/sequence.py +136 -0
  177. package/python/vendor/openpyxl/descriptors/serialisable.py +240 -0
  178. package/python/vendor/openpyxl/descriptors/slots.py +18 -0
  179. package/python/vendor/openpyxl/drawing/__init__.py +4 -0
  180. package/python/vendor/openpyxl/drawing/colors.py +435 -0
  181. package/python/vendor/openpyxl/drawing/connector.py +144 -0
  182. package/python/vendor/openpyxl/drawing/drawing.py +92 -0
  183. package/python/vendor/openpyxl/drawing/effect.py +407 -0
  184. package/python/vendor/openpyxl/drawing/fill.py +425 -0
  185. package/python/vendor/openpyxl/drawing/geometry.py +584 -0
  186. package/python/vendor/openpyxl/drawing/graphic.py +177 -0
  187. package/python/vendor/openpyxl/drawing/image.py +65 -0
  188. package/python/vendor/openpyxl/drawing/line.py +144 -0
  189. package/python/vendor/openpyxl/drawing/picture.py +144 -0
  190. package/python/vendor/openpyxl/drawing/properties.py +174 -0
  191. package/python/vendor/openpyxl/drawing/relation.py +17 -0
  192. package/python/vendor/openpyxl/drawing/spreadsheet_drawing.py +382 -0
  193. package/python/vendor/openpyxl/drawing/text.py +717 -0
  194. package/python/vendor/openpyxl/drawing/xdr.py +33 -0
  195. package/python/vendor/openpyxl/formatting/__init__.py +3 -0
  196. package/python/vendor/openpyxl/formatting/formatting.py +114 -0
  197. package/python/vendor/openpyxl/formatting/rule.py +291 -0
  198. package/python/vendor/openpyxl/formula/__init__.py +3 -0
  199. package/python/vendor/openpyxl/formula/tokenizer.py +446 -0
  200. package/python/vendor/openpyxl/formula/translate.py +166 -0
  201. package/python/vendor/openpyxl/packaging/__init__.py +3 -0
  202. package/python/vendor/openpyxl/packaging/core.py +115 -0
  203. package/python/vendor/openpyxl/packaging/custom.py +289 -0
  204. package/python/vendor/openpyxl/packaging/extended.py +137 -0
  205. package/python/vendor/openpyxl/packaging/interface.py +56 -0
  206. package/python/vendor/openpyxl/packaging/manifest.py +194 -0
  207. package/python/vendor/openpyxl/packaging/relationship.py +158 -0
  208. package/python/vendor/openpyxl/packaging/workbook.py +185 -0
  209. package/python/vendor/openpyxl/pivot/__init__.py +1 -0
  210. package/python/vendor/openpyxl/pivot/cache.py +965 -0
  211. package/python/vendor/openpyxl/pivot/fields.py +326 -0
  212. package/python/vendor/openpyxl/pivot/record.py +111 -0
  213. package/python/vendor/openpyxl/pivot/table.py +1261 -0
  214. package/python/vendor/openpyxl/reader/__init__.py +1 -0
  215. package/python/vendor/openpyxl/reader/drawings.py +71 -0
  216. package/python/vendor/openpyxl/reader/excel.py +349 -0
  217. package/python/vendor/openpyxl/reader/strings.py +44 -0
  218. package/python/vendor/openpyxl/reader/workbook.py +133 -0
  219. package/python/vendor/openpyxl/styles/__init__.py +11 -0
  220. package/python/vendor/openpyxl/styles/alignment.py +62 -0
  221. package/python/vendor/openpyxl/styles/borders.py +103 -0
  222. package/python/vendor/openpyxl/styles/builtins.py +1397 -0
  223. package/python/vendor/openpyxl/styles/cell_style.py +206 -0
  224. package/python/vendor/openpyxl/styles/colors.py +172 -0
  225. package/python/vendor/openpyxl/styles/differential.py +95 -0
  226. package/python/vendor/openpyxl/styles/fills.py +224 -0
  227. package/python/vendor/openpyxl/styles/fonts.py +113 -0
  228. package/python/vendor/openpyxl/styles/named_styles.py +282 -0
  229. package/python/vendor/openpyxl/styles/numbers.py +200 -0
  230. package/python/vendor/openpyxl/styles/protection.py +17 -0
  231. package/python/vendor/openpyxl/styles/proxy.py +62 -0
  232. package/python/vendor/openpyxl/styles/styleable.py +151 -0
  233. package/python/vendor/openpyxl/styles/stylesheet.py +274 -0
  234. package/python/vendor/openpyxl/styles/table.py +94 -0
  235. package/python/vendor/openpyxl/utils/__init__.py +17 -0
  236. package/python/vendor/openpyxl/utils/bound_dictionary.py +26 -0
  237. package/python/vendor/openpyxl/utils/cell.py +240 -0
  238. package/python/vendor/openpyxl/utils/dataframe.py +87 -0
  239. package/python/vendor/openpyxl/utils/datetime.py +140 -0
  240. package/python/vendor/openpyxl/utils/escape.py +43 -0
  241. package/python/vendor/openpyxl/utils/exceptions.py +34 -0
  242. package/python/vendor/openpyxl/utils/formulas.py +24 -0
  243. package/python/vendor/openpyxl/utils/indexed_list.py +49 -0
  244. package/python/vendor/openpyxl/utils/inference.py +60 -0
  245. package/python/vendor/openpyxl/utils/protection.py +22 -0
  246. package/python/vendor/openpyxl/utils/units.py +108 -0
  247. package/python/vendor/openpyxl/workbook/__init__.py +4 -0
  248. package/python/vendor/openpyxl/workbook/_writer.py +197 -0
  249. package/python/vendor/openpyxl/workbook/child.py +166 -0
  250. package/python/vendor/openpyxl/workbook/defined_name.py +189 -0
  251. package/python/vendor/openpyxl/workbook/external_link/__init__.py +3 -0
  252. package/python/vendor/openpyxl/workbook/external_link/external.py +190 -0
  253. package/python/vendor/openpyxl/workbook/external_reference.py +18 -0
  254. package/python/vendor/openpyxl/workbook/function_group.py +36 -0
  255. package/python/vendor/openpyxl/workbook/properties.py +151 -0
  256. package/python/vendor/openpyxl/workbook/protection.py +163 -0
  257. package/python/vendor/openpyxl/workbook/smart_tags.py +56 -0
  258. package/python/vendor/openpyxl/workbook/views.py +155 -0
  259. package/python/vendor/openpyxl/workbook/web.py +98 -0
  260. package/python/vendor/openpyxl/workbook/workbook.py +438 -0
  261. package/python/vendor/openpyxl/worksheet/__init__.py +1 -0
  262. package/python/vendor/openpyxl/worksheet/_read_only.py +190 -0
  263. package/python/vendor/openpyxl/worksheet/_reader.py +472 -0
  264. package/python/vendor/openpyxl/worksheet/_write_only.py +160 -0
  265. package/python/vendor/openpyxl/worksheet/_writer.py +390 -0
  266. package/python/vendor/openpyxl/worksheet/cell_range.py +512 -0
  267. package/python/vendor/openpyxl/worksheet/cell_watch.py +34 -0
  268. package/python/vendor/openpyxl/worksheet/controls.py +107 -0
  269. package/python/vendor/openpyxl/worksheet/copier.py +70 -0
  270. package/python/vendor/openpyxl/worksheet/custom.py +35 -0
  271. package/python/vendor/openpyxl/worksheet/datavalidation.py +202 -0
  272. package/python/vendor/openpyxl/worksheet/dimensions.py +306 -0
  273. package/python/vendor/openpyxl/worksheet/drawing.py +14 -0
  274. package/python/vendor/openpyxl/worksheet/errors.py +93 -0
  275. package/python/vendor/openpyxl/worksheet/filters.py +486 -0
  276. package/python/vendor/openpyxl/worksheet/formula.py +51 -0
  277. package/python/vendor/openpyxl/worksheet/header_footer.py +270 -0
  278. package/python/vendor/openpyxl/worksheet/hyperlink.py +46 -0
  279. package/python/vendor/openpyxl/worksheet/merge.py +141 -0
  280. package/python/vendor/openpyxl/worksheet/ole.py +133 -0
  281. package/python/vendor/openpyxl/worksheet/page.py +174 -0
  282. package/python/vendor/openpyxl/worksheet/pagebreak.py +94 -0
  283. package/python/vendor/openpyxl/worksheet/picture.py +8 -0
  284. package/python/vendor/openpyxl/worksheet/print_settings.py +184 -0
  285. package/python/vendor/openpyxl/worksheet/properties.py +97 -0
  286. package/python/vendor/openpyxl/worksheet/protection.py +120 -0
  287. package/python/vendor/openpyxl/worksheet/related.py +17 -0
  288. package/python/vendor/openpyxl/worksheet/scenario.py +105 -0
  289. package/python/vendor/openpyxl/worksheet/smart_tag.py +78 -0
  290. package/python/vendor/openpyxl/worksheet/table.py +385 -0
  291. package/python/vendor/openpyxl/worksheet/views.py +155 -0
  292. package/python/vendor/openpyxl/worksheet/worksheet.py +907 -0
  293. package/python/vendor/openpyxl/writer/__init__.py +1 -0
  294. package/python/vendor/openpyxl/writer/excel.py +295 -0
  295. package/python/vendor/openpyxl/writer/theme.py +291 -0
  296. package/python/vendor/openpyxl/xml/__init__.py +42 -0
  297. package/python/vendor/openpyxl/xml/constants.py +129 -0
  298. package/python/vendor/openpyxl/xml/functions.py +87 -0
  299. package/watchlist/package.json +1 -1
@@ -0,0 +1,53 @@
1
+ # Copyright (c) 2010-2024 openpyxl
2
+
3
+ from openpyxl.descriptors.serialisable import Serialisable
4
+ from openpyxl.descriptors import (
5
+ Typed,
6
+ Sequence,
7
+ Alias
8
+ )
9
+ from openpyxl.descriptors.excel import ExtensionList
10
+ from openpyxl.descriptors.nested import (
11
+ NestedNoneSet,
12
+ NestedBool,
13
+ )
14
+
15
+ from ._chart import ChartBase
16
+ from .axis import NumericAxis, TextAxis
17
+ from .series import XYSeries
18
+ from .label import DataLabelList
19
+
20
+
21
+ class ScatterChart(ChartBase):
22
+
23
+ tagname = "scatterChart"
24
+
25
+ scatterStyle = NestedNoneSet(values=(['line', 'lineMarker', 'marker', 'smooth', 'smoothMarker']))
26
+ varyColors = NestedBool(allow_none=True)
27
+ ser = Sequence(expected_type=XYSeries, allow_none=True)
28
+ dLbls = Typed(expected_type=DataLabelList, allow_none=True)
29
+ dataLabels = Alias("dLbls")
30
+ extLst = Typed(expected_type=ExtensionList, allow_none=True)
31
+
32
+ x_axis = Typed(expected_type=(NumericAxis, TextAxis))
33
+ y_axis = Typed(expected_type=NumericAxis)
34
+
35
+ _series_type = "scatter"
36
+
37
+ __elements__ = ('scatterStyle', 'varyColors', 'ser', 'dLbls', 'axId',)
38
+
39
+ def __init__(self,
40
+ scatterStyle=None,
41
+ varyColors=None,
42
+ ser=(),
43
+ dLbls=None,
44
+ extLst=None,
45
+ **kw
46
+ ):
47
+ self.scatterStyle = scatterStyle
48
+ self.varyColors = varyColors
49
+ self.ser = ser
50
+ self.dLbls = dLbls
51
+ self.x_axis = NumericAxis(axId=10, crossAx=20)
52
+ self.y_axis = NumericAxis(axId=20, crossAx=10)
53
+ super().__init__(**kw)
@@ -0,0 +1,197 @@
1
+ # Copyright (c) 2010-2024 openpyxl
2
+
3
+
4
+ from openpyxl.descriptors.serialisable import Serialisable
5
+ from openpyxl.descriptors import (
6
+ Typed,
7
+ String,
8
+ Integer,
9
+ Bool,
10
+ Alias,
11
+ Sequence,
12
+ )
13
+ from openpyxl.descriptors.excel import ExtensionList
14
+ from openpyxl.descriptors.nested import (
15
+ NestedInteger,
16
+ NestedBool,
17
+ NestedNoneSet,
18
+ NestedText,
19
+ )
20
+
21
+ from .shapes import GraphicalProperties
22
+ from .data_source import (
23
+ AxDataSource,
24
+ NumDataSource,
25
+ NumRef,
26
+ StrRef,
27
+ )
28
+ from .error_bar import ErrorBars
29
+ from .label import DataLabelList
30
+ from .marker import DataPoint, PictureOptions, Marker
31
+ from .trendline import Trendline
32
+
33
+ attribute_mapping = {
34
+ 'area': ('idx', 'order', 'tx', 'spPr', 'pictureOptions', 'dPt', 'dLbls', 'errBars',
35
+ 'trendline', 'cat', 'val',),
36
+ 'bar':('idx', 'order','tx', 'spPr', 'invertIfNegative', 'pictureOptions', 'dPt',
37
+ 'dLbls', 'trendline', 'errBars', 'cat', 'val', 'shape'),
38
+ 'bubble':('idx','order', 'tx', 'spPr', 'invertIfNegative', 'dPt', 'dLbls',
39
+ 'trendline', 'errBars', 'xVal', 'yVal', 'bubbleSize', 'bubble3D'),
40
+ 'line':('idx', 'order', 'tx', 'spPr', 'marker', 'dPt', 'dLbls', 'trendline',
41
+ 'errBars', 'cat', 'val', 'smooth'),
42
+ 'pie':('idx', 'order', 'tx', 'spPr', 'explosion', 'dPt', 'dLbls', 'cat', 'val'),
43
+ 'radar':('idx', 'order', 'tx', 'spPr', 'marker', 'dPt', 'dLbls', 'cat', 'val'),
44
+ 'scatter':('idx', 'order', 'tx', 'spPr', 'marker', 'dPt', 'dLbls', 'trendline',
45
+ 'errBars', 'xVal', 'yVal', 'smooth'),
46
+ 'surface':('idx', 'order', 'tx', 'spPr', 'cat', 'val'),
47
+ }
48
+
49
+
50
+ class SeriesLabel(Serialisable):
51
+
52
+ tagname = "tx"
53
+
54
+ strRef = Typed(expected_type=StrRef, allow_none=True)
55
+ v = NestedText(expected_type=str, allow_none=True)
56
+ value = Alias('v')
57
+
58
+ __elements__ = ('strRef', 'v')
59
+
60
+ def __init__(self,
61
+ strRef=None,
62
+ v=None):
63
+ self.strRef = strRef
64
+ self.v = v
65
+
66
+
67
+ class Series(Serialisable):
68
+
69
+ """
70
+ Generic series object. Should not be instantiated directly.
71
+ User the chart.Series factory instead.
72
+ """
73
+
74
+ tagname = "ser"
75
+
76
+ idx = NestedInteger()
77
+ order = NestedInteger()
78
+ tx = Typed(expected_type=SeriesLabel, allow_none=True)
79
+ title = Alias('tx')
80
+ spPr = Typed(expected_type=GraphicalProperties, allow_none=True)
81
+ graphicalProperties = Alias('spPr')
82
+
83
+ # area chart
84
+ pictureOptions = Typed(expected_type=PictureOptions, allow_none=True)
85
+ dPt = Sequence(expected_type=DataPoint, allow_none=True)
86
+ data_points = Alias("dPt")
87
+ dLbls = Typed(expected_type=DataLabelList, allow_none=True)
88
+ labels = Alias("dLbls")
89
+ trendline = Typed(expected_type=Trendline, allow_none=True)
90
+ errBars = Typed(expected_type=ErrorBars, allow_none=True)
91
+ cat = Typed(expected_type=AxDataSource, allow_none=True)
92
+ identifiers = Alias("cat")
93
+ val = Typed(expected_type=NumDataSource, allow_none=True)
94
+ extLst = Typed(expected_type=ExtensionList, allow_none=True)
95
+
96
+ #bar chart
97
+ invertIfNegative = NestedBool(allow_none=True)
98
+ shape = NestedNoneSet(values=(['cone', 'coneToMax', 'box', 'cylinder', 'pyramid', 'pyramidToMax']))
99
+
100
+ #bubble chart
101
+ xVal = Typed(expected_type=AxDataSource, allow_none=True)
102
+ yVal = Typed(expected_type=NumDataSource, allow_none=True)
103
+ bubbleSize = Typed(expected_type=NumDataSource, allow_none=True)
104
+ zVal = Alias("bubbleSize")
105
+ bubble3D = NestedBool(allow_none=True)
106
+
107
+ #line chart
108
+ marker = Typed(expected_type=Marker, allow_none=True)
109
+ smooth = NestedBool(allow_none=True)
110
+
111
+ #pie chart
112
+ explosion = NestedInteger(allow_none=True)
113
+
114
+ __elements__ = ()
115
+
116
+
117
+ def __init__(self,
118
+ idx=0,
119
+ order=0,
120
+ tx=None,
121
+ spPr=None,
122
+ pictureOptions=None,
123
+ dPt=(),
124
+ dLbls=None,
125
+ trendline=None,
126
+ errBars=None,
127
+ cat=None,
128
+ val=None,
129
+ invertIfNegative=None,
130
+ shape=None,
131
+ xVal=None,
132
+ yVal=None,
133
+ bubbleSize=None,
134
+ bubble3D=None,
135
+ marker=None,
136
+ smooth=None,
137
+ explosion=None,
138
+ extLst=None,
139
+ ):
140
+ self.idx = idx
141
+ self.order = order
142
+ self.tx = tx
143
+ if spPr is None:
144
+ spPr = GraphicalProperties()
145
+ self.spPr = spPr
146
+ self.pictureOptions = pictureOptions
147
+ self.dPt = dPt
148
+ self.dLbls = dLbls
149
+ self.trendline = trendline
150
+ self.errBars = errBars
151
+ self.cat = cat
152
+ self.val = val
153
+ self.invertIfNegative = invertIfNegative
154
+ self.shape = shape
155
+ self.xVal = xVal
156
+ self.yVal = yVal
157
+ self.bubbleSize = bubbleSize
158
+ self.bubble3D = bubble3D
159
+ if marker is None:
160
+ marker = Marker()
161
+ self.marker = marker
162
+ self.smooth = smooth
163
+ self.explosion = explosion
164
+
165
+
166
+ def to_tree(self, tagname=None, idx=None):
167
+ """The index can need rebasing"""
168
+ if idx is not None:
169
+ if self.order == self.idx:
170
+ self.order = idx # rebase the order if the index has been rebased
171
+ self.idx = idx
172
+ return super().to_tree(tagname)
173
+
174
+
175
+ class XYSeries(Series):
176
+
177
+ """Dedicated series for charts that have x and y series"""
178
+
179
+ idx = Series.idx
180
+ order = Series.order
181
+ tx = Series.tx
182
+ spPr = Series.spPr
183
+
184
+ dPt = Series.dPt
185
+ dLbls = Series.dLbls
186
+ trendline = Series.trendline
187
+ errBars = Series.errBars
188
+ xVal = Series.xVal
189
+ yVal = Series.yVal
190
+
191
+ invertIfNegative = Series.invertIfNegative
192
+
193
+ bubbleSize = Series.bubbleSize
194
+ bubble3D = Series.bubble3D
195
+
196
+ marker = Series.marker
197
+ smooth = Series.smooth
@@ -0,0 +1,41 @@
1
+ # Copyright (c) 2010-2024 openpyxl
2
+
3
+ from .data_source import NumDataSource, NumRef, AxDataSource
4
+ from .reference import Reference
5
+ from .series import Series, XYSeries, SeriesLabel, StrRef
6
+ from openpyxl.utils import rows_from_range, quote_sheetname
7
+
8
+
9
+ def SeriesFactory(values, xvalues=None, zvalues=None, title=None, title_from_data=False):
10
+ """
11
+ Convenience Factory for creating chart data series.
12
+ """
13
+
14
+ if not isinstance(values, Reference):
15
+ values = Reference(range_string=values)
16
+
17
+ if title_from_data:
18
+ cell = values.pop()
19
+ title = u"{0}!{1}".format(values.sheetname, cell)
20
+ title = SeriesLabel(strRef=StrRef(title))
21
+ elif title is not None:
22
+ title = SeriesLabel(v=title)
23
+
24
+ source = NumDataSource(numRef=NumRef(f=values))
25
+ if xvalues is not None:
26
+ if not isinstance(xvalues, Reference):
27
+ xvalues = Reference(range_string=xvalues)
28
+ series = XYSeries()
29
+ series.yVal = source
30
+ series.xVal = AxDataSource(numRef=NumRef(f=xvalues))
31
+ if zvalues is not None:
32
+ if not isinstance(zvalues, Reference):
33
+ zvalues = Reference(range_string=zvalues)
34
+ series.zVal = NumDataSource(NumRef(f=zvalues))
35
+ else:
36
+ series = Series()
37
+ series.val = source
38
+
39
+ if title is not None:
40
+ series.title = title
41
+ return series
@@ -0,0 +1,89 @@
1
+ # Copyright (c) 2010-2024 openpyxl
2
+
3
+ from openpyxl.descriptors.serialisable import Serialisable
4
+ from openpyxl.descriptors import (
5
+ Typed,
6
+ Alias
7
+ )
8
+ from openpyxl.descriptors.nested import (
9
+ EmptyTag
10
+ )
11
+ from openpyxl.drawing.colors import ColorChoiceDescriptor
12
+ from openpyxl.drawing.fill import *
13
+ from openpyxl.drawing.line import LineProperties
14
+ from openpyxl.drawing.geometry import (
15
+ Shape3D,
16
+ Scene3D,
17
+ Transform2D,
18
+ CustomGeometry2D,
19
+ PresetGeometry2D,
20
+ )
21
+
22
+
23
+ class GraphicalProperties(Serialisable):
24
+
25
+ """
26
+ Somewhat vaguely 21.2.2.197 says this:
27
+
28
+ This element specifies the formatting for the parent chart element. The
29
+ custGeom, prstGeom, scene3d, and xfrm elements are not supported. The
30
+ bwMode attribute is not supported.
31
+
32
+ This doesn't leave much. And the element is used in different places.
33
+ """
34
+
35
+ tagname = "spPr"
36
+
37
+ bwMode = NoneSet(values=(['clr', 'auto', 'gray', 'ltGray', 'invGray',
38
+ 'grayWhite', 'blackGray', 'blackWhite', 'black', 'white', 'hidden']
39
+ )
40
+ )
41
+
42
+ xfrm = Typed(expected_type=Transform2D, allow_none=True)
43
+ transform = Alias('xfrm')
44
+ custGeom = Typed(expected_type=CustomGeometry2D, allow_none=True) # either or
45
+ prstGeom = Typed(expected_type=PresetGeometry2D, allow_none=True)
46
+
47
+ # fills one of
48
+ noFill = EmptyTag(namespace=DRAWING_NS)
49
+ solidFill = ColorChoiceDescriptor()
50
+ gradFill = Typed(expected_type=GradientFillProperties, allow_none=True)
51
+ pattFill = Typed(expected_type=PatternFillProperties, allow_none=True)
52
+
53
+ ln = Typed(expected_type=LineProperties, allow_none=True)
54
+ line = Alias('ln')
55
+ scene3d = Typed(expected_type=Scene3D, allow_none=True)
56
+ sp3d = Typed(expected_type=Shape3D, allow_none=True)
57
+ shape3D = Alias('sp3d')
58
+ extLst = Typed(expected_type=OfficeArtExtensionList, allow_none=True)
59
+
60
+ __elements__ = ('xfrm', 'prstGeom', 'noFill', 'solidFill', 'gradFill', 'pattFill',
61
+ 'ln', 'scene3d', 'sp3d')
62
+
63
+ def __init__(self,
64
+ bwMode=None,
65
+ xfrm=None,
66
+ noFill=None,
67
+ solidFill=None,
68
+ gradFill=None,
69
+ pattFill=None,
70
+ ln=None,
71
+ scene3d=None,
72
+ custGeom=None,
73
+ prstGeom=None,
74
+ sp3d=None,
75
+ extLst=None,
76
+ ):
77
+ self.bwMode = bwMode
78
+ self.xfrm = xfrm
79
+ self.noFill = noFill
80
+ self.solidFill = solidFill
81
+ self.gradFill = gradFill
82
+ self.pattFill = pattFill
83
+ if ln is None:
84
+ ln = LineProperties()
85
+ self.ln = ln
86
+ self.custGeom = custGeom
87
+ self.prstGeom = prstGeom
88
+ self.scene3d = scene3d
89
+ self.sp3d = sp3d
@@ -0,0 +1,54 @@
1
+ # Copyright (c) 2010-2024 openpyxl
2
+
3
+ from openpyxl.descriptors.serialisable import Serialisable
4
+ from openpyxl.descriptors import (
5
+ Typed,
6
+ Sequence,
7
+ Alias,
8
+ )
9
+ from openpyxl.descriptors.excel import ExtensionList
10
+
11
+ from ._chart import ChartBase
12
+ from .axis import TextAxis, NumericAxis, ChartLines
13
+ from .updown_bars import UpDownBars
14
+ from .label import DataLabelList
15
+ from .series import Series
16
+
17
+
18
+ class StockChart(ChartBase):
19
+
20
+ tagname = "stockChart"
21
+
22
+ ser = Sequence(expected_type=Series) #min 3, max4
23
+ dLbls = Typed(expected_type=DataLabelList, allow_none=True)
24
+ dataLabels = Alias('dLbls')
25
+ dropLines = Typed(expected_type=ChartLines, allow_none=True)
26
+ hiLowLines = Typed(expected_type=ChartLines, allow_none=True)
27
+ upDownBars = Typed(expected_type=UpDownBars, allow_none=True)
28
+ extLst = Typed(expected_type=ExtensionList, allow_none=True)
29
+
30
+ x_axis = Typed(expected_type=TextAxis)
31
+ y_axis = Typed(expected_type=NumericAxis)
32
+
33
+ _series_type = "line"
34
+
35
+ __elements__ = ('ser', 'dLbls', 'dropLines', 'hiLowLines', 'upDownBars',
36
+ 'axId')
37
+
38
+ def __init__(self,
39
+ ser=(),
40
+ dLbls=None,
41
+ dropLines=None,
42
+ hiLowLines=None,
43
+ upDownBars=None,
44
+ extLst=None,
45
+ **kw
46
+ ):
47
+ self.ser = ser
48
+ self.dLbls = dLbls
49
+ self.dropLines = dropLines
50
+ self.hiLowLines = hiLowLines
51
+ self.upDownBars = upDownBars
52
+ self.x_axis = TextAxis()
53
+ self.y_axis = NumericAxis()
54
+ super().__init__(**kw)
@@ -0,0 +1,119 @@
1
+ # Copyright (c) 2010-2024 openpyxl
2
+
3
+ from openpyxl.descriptors.serialisable import Serialisable
4
+ from openpyxl.descriptors import (
5
+ Typed,
6
+ Integer,
7
+ Bool,
8
+ Alias,
9
+ Sequence,
10
+ )
11
+ from openpyxl.descriptors.excel import ExtensionList
12
+ from openpyxl.descriptors.nested import (
13
+ NestedInteger,
14
+ NestedBool,
15
+ )
16
+
17
+ from ._chart import ChartBase
18
+ from ._3d import _3DBase
19
+ from .axis import TextAxis, NumericAxis, SeriesAxis
20
+ from .shapes import GraphicalProperties
21
+ from .series import Series
22
+
23
+
24
+ class BandFormat(Serialisable):
25
+
26
+ tagname = "bandFmt"
27
+
28
+ idx = NestedInteger()
29
+ spPr = Typed(expected_type=GraphicalProperties, allow_none=True)
30
+ graphicalProperties = Alias("spPr")
31
+
32
+ __elements__ = ('idx', 'spPr')
33
+
34
+ def __init__(self,
35
+ idx=0,
36
+ spPr=None,
37
+ ):
38
+ self.idx = idx
39
+ self.spPr = spPr
40
+
41
+
42
+ class BandFormatList(Serialisable):
43
+
44
+ tagname = "bandFmts"
45
+
46
+ bandFmt = Sequence(expected_type=BandFormat, allow_none=True)
47
+
48
+ __elements__ = ('bandFmt',)
49
+
50
+ def __init__(self,
51
+ bandFmt=(),
52
+ ):
53
+ self.bandFmt = bandFmt
54
+
55
+
56
+ class _SurfaceChartBase(ChartBase):
57
+
58
+ wireframe = NestedBool(allow_none=True)
59
+ ser = Sequence(expected_type=Series, allow_none=True)
60
+ bandFmts = Typed(expected_type=BandFormatList, allow_none=True)
61
+
62
+ _series_type = "surface"
63
+
64
+ __elements__ = ('wireframe', 'ser', 'bandFmts')
65
+
66
+ def __init__(self,
67
+ wireframe=None,
68
+ ser=(),
69
+ bandFmts=None,
70
+ **kw
71
+ ):
72
+ self.wireframe = wireframe
73
+ self.ser = ser
74
+ self.bandFmts = bandFmts
75
+ super().__init__(**kw)
76
+
77
+
78
+ class SurfaceChart3D(_SurfaceChartBase, _3DBase):
79
+
80
+ tagname = "surface3DChart"
81
+
82
+ wireframe = _SurfaceChartBase.wireframe
83
+ ser = _SurfaceChartBase.ser
84
+ bandFmts = _SurfaceChartBase.bandFmts
85
+
86
+ extLst = Typed(expected_type=ExtensionList, allow_none=True)
87
+
88
+ x_axis = Typed(expected_type=TextAxis)
89
+ y_axis = Typed(expected_type=NumericAxis)
90
+ z_axis = Typed(expected_type=SeriesAxis)
91
+
92
+ __elements__ = _SurfaceChartBase.__elements__ + ('axId',)
93
+
94
+ def __init__(self, **kw):
95
+ self.x_axis = TextAxis()
96
+ self.y_axis = NumericAxis()
97
+ self.z_axis = SeriesAxis()
98
+ super(SurfaceChart3D, self).__init__(**kw)
99
+
100
+
101
+ class SurfaceChart(SurfaceChart3D):
102
+
103
+ tagname = "surfaceChart"
104
+
105
+ wireframe = _SurfaceChartBase.wireframe
106
+ ser = _SurfaceChartBase.ser
107
+ bandFmts = _SurfaceChartBase.bandFmts
108
+
109
+ extLst = Typed(expected_type=ExtensionList, allow_none=True)
110
+
111
+ __elements__ = SurfaceChart3D.__elements__
112
+
113
+ def __init__(self, **kw):
114
+ super().__init__(**kw)
115
+ self.y_axis.delete = True
116
+ self.view3D.x_rotation = 90
117
+ self.view3D.y_rotation = 0
118
+ self.view3D.perspective = False
119
+ self.view3D.right_angle_axes = False
@@ -0,0 +1,78 @@
1
+ # Copyright (c) 2010-2024 openpyxl
2
+ from openpyxl.descriptors.serialisable import Serialisable
3
+ from openpyxl.descriptors import (
4
+ Typed,
5
+ Alias,
6
+ Sequence,
7
+ )
8
+
9
+
10
+ from openpyxl.drawing.text import (
11
+ RichTextProperties,
12
+ ListStyle,
13
+ Paragraph,
14
+ )
15
+
16
+ from .data_source import StrRef
17
+
18
+
19
+ class RichText(Serialisable):
20
+
21
+ """
22
+ From the specification: 21.2.2.216
23
+
24
+ This element specifies text formatting. The lstStyle element is not supported.
25
+ """
26
+
27
+ tagname = "rich"
28
+
29
+ bodyPr = Typed(expected_type=RichTextProperties)
30
+ properties = Alias("bodyPr")
31
+ lstStyle = Typed(expected_type=ListStyle, allow_none=True)
32
+ p = Sequence(expected_type=Paragraph)
33
+ paragraphs = Alias('p')
34
+
35
+ __elements__ = ("bodyPr", "lstStyle", "p")
36
+
37
+ def __init__(self,
38
+ bodyPr=None,
39
+ lstStyle=None,
40
+ p=None,
41
+ ):
42
+ if bodyPr is None:
43
+ bodyPr = RichTextProperties()
44
+ self.bodyPr = bodyPr
45
+ self.lstStyle = lstStyle
46
+ if p is None:
47
+ p = [Paragraph()]
48
+ self.p = p
49
+
50
+
51
+ class Text(Serialisable):
52
+
53
+ """
54
+ The value can be either a cell reference or a text element
55
+ If both are present then the reference will be used.
56
+ """
57
+
58
+ tagname = "tx"
59
+
60
+ strRef = Typed(expected_type=StrRef, allow_none=True)
61
+ rich = Typed(expected_type=RichText, allow_none=True)
62
+
63
+ __elements__ = ("strRef", "rich")
64
+
65
+ def __init__(self,
66
+ strRef=None,
67
+ rich=None
68
+ ):
69
+ self.strRef = strRef
70
+ if rich is None:
71
+ rich = RichText()
72
+ self.rich = rich
73
+
74
+
75
+ def to_tree(self, tagname=None, idx=None, namespace=None):
76
+ if self.strRef and self.rich:
77
+ self.rich = None # can only have one
78
+ return super().to_tree(tagname, idx, namespace)