@nativescript-community/ui-chart 2.0.7 → 2.0.10

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 (404) hide show
  1. package/animation/ChartAnimator.d.ts +61 -0
  2. package/animation/ChartAnimator.js +95 -0
  3. package/animation/ChartAnimator.js.map +1 -0
  4. package/animation/Tween.d.ts +4 -0
  5. package/animation/Tween.js +25 -0
  6. package/animation/Tween.js.map +1 -0
  7. package/buffer/AbstractBuffer.d.ts +40 -0
  8. package/buffer/AbstractBuffer.js +49 -0
  9. package/buffer/AbstractBuffer.js.map +1 -0
  10. package/buffer/BarBuffer.d.ts +15 -0
  11. package/buffer/BarBuffer.js +109 -0
  12. package/buffer/BarBuffer.js.map +1 -0
  13. package/buffer/HorizontalBarBuffer.d.ts +6 -0
  14. package/buffer/HorizontalBarBuffer.js +81 -0
  15. package/buffer/HorizontalBarBuffer.js.map +1 -0
  16. package/charts/BarChart.d.ts +96 -0
  17. package/charts/BarChart.js +143 -0
  18. package/charts/BarChart.js.map +1 -0
  19. package/charts/BarLineChartBase.d.ts +583 -0
  20. package/charts/BarLineChartBase.js +1231 -0
  21. package/charts/BarLineChartBase.js.map +1 -0
  22. package/charts/BubbleChart.d.ts +27 -0
  23. package/charts/BubbleChart.js +20 -0
  24. package/charts/BubbleChart.js.map +1 -0
  25. package/charts/CandleStickChart.d.ts +29 -0
  26. package/charts/CandleStickChart.js +19 -0
  27. package/charts/CandleStickChart.js.map +1 -0
  28. package/charts/Chart.d.ts +498 -0
  29. package/charts/Chart.js +799 -0
  30. package/charts/Chart.js.map +1 -0
  31. package/charts/CombinedChart.d.ts +78 -0
  32. package/charts/CombinedChart.js +119 -0
  33. package/charts/CombinedChart.js.map +1 -0
  34. package/charts/HorizontalBarChart.d.ts +54 -0
  35. package/charts/HorizontalBarChart.js +180 -0
  36. package/charts/HorizontalBarChart.js.map +1 -0
  37. package/charts/LineChart.d.ts +20 -0
  38. package/charts/LineChart.js +19 -0
  39. package/charts/LineChart.js.map +1 -0
  40. package/charts/PieChart.d.ts +247 -0
  41. package/charts/PieChart.js +453 -0
  42. package/charts/PieChart.js.map +1 -0
  43. package/charts/PieRadarChartBase.d.ts +130 -0
  44. package/charts/PieRadarChartBase.js +360 -0
  45. package/charts/PieRadarChartBase.js.map +1 -0
  46. package/charts/RadarChart.d.ts +101 -0
  47. package/charts/RadarChart.js +172 -0
  48. package/charts/RadarChart.js.map +1 -0
  49. package/charts/ScatterChart.d.ts +36 -0
  50. package/charts/ScatterChart.js +31 -0
  51. package/charts/ScatterChart.js.map +1 -0
  52. package/charts/index.d.ts +9 -0
  53. package/charts/index.js +10 -0
  54. package/charts/index.js.map +1 -0
  55. package/components/AxisBase.d.ts +299 -0
  56. package/components/AxisBase.js +352 -0
  57. package/components/AxisBase.js.map +1 -0
  58. package/components/ComponentBase.d.ts +60 -0
  59. package/components/ComponentBase.js +77 -0
  60. package/components/ComponentBase.js.map +1 -0
  61. package/components/Description.d.ts +22 -0
  62. package/components/Description.js +21 -0
  63. package/components/Description.js.map +1 -0
  64. package/components/IMarker.d.ts +39 -0
  65. package/components/IMarker.js +2 -0
  66. package/components/IMarker.js.map +1 -0
  67. package/components/Legend.d.ts +198 -0
  68. package/components/Legend.js +386 -0
  69. package/components/Legend.js.map +1 -0
  70. package/components/LegendEntry.d.ts +50 -0
  71. package/components/LegendEntry.js +51 -0
  72. package/components/LegendEntry.js.map +1 -0
  73. package/components/LimitLine.d.ts +55 -0
  74. package/components/LimitLine.js +62 -0
  75. package/components/LimitLine.js.map +1 -0
  76. package/components/MarkerImage.d.ts +1 -0
  77. package/components/MarkerImage.js +97 -0
  78. package/components/MarkerImage.js.map +1 -0
  79. package/components/XAxis.d.ts +55 -0
  80. package/components/XAxis.js +59 -0
  81. package/components/XAxis.js.map +1 -0
  82. package/components/YAxis.d.ts +135 -0
  83. package/components/YAxis.js +205 -0
  84. package/components/YAxis.js.map +1 -0
  85. package/data/BarData.d.ts +39 -0
  86. package/data/BarData.js +126 -0
  87. package/data/BarData.js.map +1 -0
  88. package/data/BarDataSet.d.ts +47 -0
  89. package/data/BarDataSet.js +109 -0
  90. package/data/BarDataSet.js.map +1 -0
  91. package/data/BarEntry.d.ts +11 -0
  92. package/data/BarEntry.js +2 -0
  93. package/data/BarEntry.js.map +1 -0
  94. package/data/BarLineScatterCandleBubbleData.d.ts +10 -0
  95. package/data/BarLineScatterCandleBubbleData.js +9 -0
  96. package/data/BarLineScatterCandleBubbleData.js.map +1 -0
  97. package/data/BarLineScatterCandleBubbleDataSet.d.ts +17 -0
  98. package/data/BarLineScatterCandleBubbleDataSet.js +18 -0
  99. package/data/BarLineScatterCandleBubbleDataSet.js.map +1 -0
  100. package/data/BaseDataSet.d.ts +180 -0
  101. package/data/BaseDataSet.js +220 -0
  102. package/data/BaseDataSet.js.map +1 -0
  103. package/data/BaseEntry.d.ts +10 -0
  104. package/data/BaseEntry.js +2 -0
  105. package/data/BaseEntry.js.map +1 -0
  106. package/data/BubbleData.d.ts +12 -0
  107. package/data/BubbleData.js +15 -0
  108. package/data/BubbleData.js.map +1 -0
  109. package/data/BubbleDataSet.d.ts +18 -0
  110. package/data/BubbleDataSet.js +36 -0
  111. package/data/BubbleDataSet.js.map +1 -0
  112. package/data/BubbleEntry.d.ts +5 -0
  113. package/data/BubbleEntry.js +2 -0
  114. package/data/BubbleEntry.js.map +1 -0
  115. package/data/CandleData.d.ts +5 -0
  116. package/data/CandleData.js +4 -0
  117. package/data/CandleData.js.map +1 -0
  118. package/data/CandleDataSet.d.ts +76 -0
  119. package/data/CandleDataSet.js +116 -0
  120. package/data/CandleDataSet.js.map +1 -0
  121. package/data/CandleEntry.d.ts +11 -0
  122. package/data/CandleEntry.js +2 -0
  123. package/data/CandleEntry.js.map +1 -0
  124. package/data/ChartData.d.ts +320 -0
  125. package/data/ChartData.js +702 -0
  126. package/data/ChartData.js.map +1 -0
  127. package/data/CombinedData.d.ts +61 -0
  128. package/data/CombinedData.js +153 -0
  129. package/data/CombinedData.js.map +1 -0
  130. package/data/DataSet.d.ts +98 -0
  131. package/data/DataSet.js +424 -0
  132. package/data/DataSet.js.map +1 -0
  133. package/data/Entry.d.ts +3 -0
  134. package/data/Entry.js +2 -0
  135. package/data/Entry.js.map +1 -0
  136. package/data/LineData.d.ts +10 -0
  137. package/data/LineData.js +9 -0
  138. package/data/LineData.js.map +1 -0
  139. package/data/LineDataSet.d.ts +106 -0
  140. package/data/LineDataSet.js +148 -0
  141. package/data/LineDataSet.js.map +1 -0
  142. package/data/LineRadarDataSet.d.ts +32 -0
  143. package/data/LineRadarDataSet.js +29 -0
  144. package/data/LineRadarDataSet.js.map +1 -0
  145. package/data/LineScatterCandleRadarDataSet.d.ts +36 -0
  146. package/data/LineScatterCandleRadarDataSet.js +44 -0
  147. package/data/LineScatterCandleRadarDataSet.js.map +1 -0
  148. package/data/PieData.d.ts +39 -0
  149. package/data/PieData.js +55 -0
  150. package/data/PieData.js.map +1 -0
  151. package/data/PieDataSet.d.ts +52 -0
  152. package/data/PieDataSet.js +54 -0
  153. package/data/PieDataSet.js.map +1 -0
  154. package/data/PieEntry.d.ts +7 -0
  155. package/data/PieEntry.js +2 -0
  156. package/data/PieEntry.js.map +1 -0
  157. package/data/RadarData.d.ts +17 -0
  158. package/data/RadarData.js +15 -0
  159. package/data/RadarData.js.map +1 -0
  160. package/data/RadarDataSet.d.ts +14 -0
  161. package/data/RadarDataSet.js +20 -0
  162. package/data/RadarDataSet.js.map +1 -0
  163. package/data/RadarEntry.d.ts +3 -0
  164. package/data/RadarEntry.js +2 -0
  165. package/data/RadarEntry.js.map +1 -0
  166. package/data/ScatterData.d.ts +9 -0
  167. package/data/ScatterData.js +17 -0
  168. package/data/ScatterData.js.map +1 -0
  169. package/data/ScatterDataSet.d.ts +40 -0
  170. package/data/ScatterDataSet.js +61 -0
  171. package/data/ScatterDataSet.js.map +1 -0
  172. package/formatter/DefaultAxisValueFormatter.d.ts +23 -0
  173. package/formatter/DefaultAxisValueFormatter.js +30 -0
  174. package/formatter/DefaultAxisValueFormatter.js.map +1 -0
  175. package/formatter/DefaultFillFormatter.d.ts +6 -0
  176. package/formatter/DefaultFillFormatter.js +29 -0
  177. package/formatter/DefaultFillFormatter.js.map +1 -0
  178. package/formatter/DefaultValueFormatter.d.ts +3 -0
  179. package/formatter/DefaultValueFormatter.js +4 -0
  180. package/formatter/DefaultValueFormatter.js.map +1 -0
  181. package/formatter/IAxisValueFormatter.d.ts +23 -0
  182. package/formatter/IAxisValueFormatter.js +2 -0
  183. package/formatter/IAxisValueFormatter.js.map +1 -0
  184. package/formatter/IFillFormatter.d.ts +30 -0
  185. package/formatter/IFillFormatter.js +2 -0
  186. package/formatter/IFillFormatter.js.map +1 -0
  187. package/formatter/IValueFormatter.d.ts +25 -0
  188. package/formatter/IValueFormatter.js +2 -0
  189. package/formatter/IValueFormatter.js.map +1 -0
  190. package/formatter/ValueFormatter.d.ts +81 -0
  191. package/formatter/ValueFormatter.js +90 -0
  192. package/formatter/ValueFormatter.js.map +1 -0
  193. package/highlight/BarHighlighter.d.ts +33 -0
  194. package/highlight/BarHighlighter.js +89 -0
  195. package/highlight/BarHighlighter.js.map +1 -0
  196. package/highlight/ChartHighlighter.d.ts +102 -0
  197. package/highlight/ChartHighlighter.js +220 -0
  198. package/highlight/ChartHighlighter.js.map +1 -0
  199. package/highlight/CombinedHighlighter.d.ts +17 -0
  200. package/highlight/CombinedHighlighter.js +59 -0
  201. package/highlight/CombinedHighlighter.js.map +1 -0
  202. package/highlight/Highlight.d.ts +69 -0
  203. package/highlight/Highlight.js +8 -0
  204. package/highlight/Highlight.js.map +1 -0
  205. package/highlight/HorizontalBarHighlighter.d.ts +10 -0
  206. package/highlight/HorizontalBarHighlighter.js +54 -0
  207. package/highlight/HorizontalBarHighlighter.js.map +1 -0
  208. package/highlight/IHighlighter.d.ts +15 -0
  209. package/highlight/IHighlighter.js +2 -0
  210. package/highlight/IHighlighter.js.map +1 -0
  211. package/highlight/PieHighlighter.d.ts +9 -0
  212. package/highlight/PieHighlighter.js +21 -0
  213. package/highlight/PieHighlighter.js.map +1 -0
  214. package/highlight/PieRadarHighlighter.d.ts +25 -0
  215. package/highlight/PieRadarHighlighter.js +33 -0
  216. package/highlight/PieRadarHighlighter.js.map +1 -0
  217. package/highlight/RadarHighlighter.d.ts +20 -0
  218. package/highlight/RadarHighlighter.js +59 -0
  219. package/highlight/RadarHighlighter.js.map +1 -0
  220. package/index.d.ts +11 -0
  221. package/index.js +15 -0
  222. package/index.js.map +1 -0
  223. package/interfaces/dataprovider/BarDataProvider.d.ts +9 -0
  224. package/interfaces/dataprovider/BarLineScatterCandleBubbleDataProvider.d.ts +19 -0
  225. package/interfaces/dataprovider/BubbleDataProvider.d.ts +6 -0
  226. package/interfaces/dataprovider/CandleDataProvider.d.ts +6 -0
  227. package/interfaces/dataprovider/ChartInterface.d.ts +60 -0
  228. package/interfaces/dataprovider/CombinedDataProvider.d.ts +13 -0
  229. package/interfaces/dataprovider/LineDataProvider.d.ts +9 -0
  230. package/interfaces/dataprovider/ScatterDataProvider.d.ts +6 -0
  231. package/interfaces/datasets/IBarDataSet.d.ts +47 -0
  232. package/interfaces/datasets/IBarLineScatterCandleBubbleDataSet.d.ts +12 -0
  233. package/interfaces/datasets/IBubbleDataSet.d.ts +19 -0
  234. package/interfaces/datasets/ICandleDataSet.d.ts +81 -0
  235. package/interfaces/datasets/IDataSet.d.ts +385 -0
  236. package/interfaces/datasets/ILineDataSet.d.ts +67 -0
  237. package/interfaces/datasets/ILineRadarDataSet.d.ts +35 -0
  238. package/interfaces/datasets/ILineScatterCandleRadarDataSet.d.ts +32 -0
  239. package/interfaces/datasets/IPieDataSet.d.ts +49 -0
  240. package/interfaces/datasets/IRadarDataSet.d.ts +21 -0
  241. package/interfaces/datasets/IScatterDataSet.d.ts +37 -0
  242. package/jobs/AnimatedMoveViewJob.d.ts +15 -0
  243. package/jobs/AnimatedMoveViewJob.js +42 -0
  244. package/jobs/AnimatedMoveViewJob.js.map +1 -0
  245. package/jobs/AnimatedViewPortJob.d.ts +31 -0
  246. package/jobs/AnimatedViewPortJob.js +52 -0
  247. package/jobs/AnimatedViewPortJob.js.map +1 -0
  248. package/jobs/AnimatedZoomJob.d.ts +23 -0
  249. package/jobs/AnimatedZoomJob.js +63 -0
  250. package/jobs/AnimatedZoomJob.js.map +1 -0
  251. package/jobs/MoveViewJob.d.ts +14 -0
  252. package/jobs/MoveViewJob.js +36 -0
  253. package/jobs/MoveViewJob.js.map +1 -0
  254. package/jobs/ViewPortJob.d.ts +13 -0
  255. package/jobs/ViewPortJob.js +14 -0
  256. package/jobs/ViewPortJob.js.map +1 -0
  257. package/jobs/ZoomJob.d.ts +15 -0
  258. package/jobs/ZoomJob.js +48 -0
  259. package/jobs/ZoomJob.js.map +1 -0
  260. package/listener/BarLineChartTouchListener.d.ts +187 -0
  261. package/listener/BarLineChartTouchListener.js +544 -0
  262. package/listener/BarLineChartTouchListener.js.map +1 -0
  263. package/listener/ChartTouchListener.d.ts +69 -0
  264. package/listener/ChartTouchListener.js +81 -0
  265. package/listener/ChartTouchListener.js.map +1 -0
  266. package/listener/PieRadarChartTouchListener.d.ts +100 -0
  267. package/listener/PieRadarChartTouchListener.js +282 -0
  268. package/listener/PieRadarChartTouchListener.js.map +1 -0
  269. package/model/GradientColor.d.ts +9 -0
  270. package/model/GradientColor.js +19 -0
  271. package/model/GradientColor.js.map +1 -0
  272. package/package.json +2 -2
  273. package/renderer/AxisRenderer.d.ts +103 -0
  274. package/renderer/AxisRenderer.js +215 -0
  275. package/renderer/AxisRenderer.js.map +1 -0
  276. package/renderer/BarChartRenderer.d.ts +40 -0
  277. package/renderer/BarChartRenderer.js +362 -0
  278. package/renderer/BarChartRenderer.js.map +1 -0
  279. package/renderer/BarLineScatterCandleBubbleRenderer.d.ts +57 -0
  280. package/renderer/BarLineScatterCandleBubbleRenderer.js +63 -0
  281. package/renderer/BarLineScatterCandleBubbleRenderer.js.map +1 -0
  282. package/renderer/BubbleChartRenderer.d.ts +22 -0
  283. package/renderer/BubbleChartRenderer.js +204 -0
  284. package/renderer/BubbleChartRenderer.js.map +1 -0
  285. package/renderer/CandleStickChartRenderer.d.ts +18 -0
  286. package/renderer/CandleStickChartRenderer.js +268 -0
  287. package/renderer/CandleStickChartRenderer.js.map +1 -0
  288. package/renderer/CombinedChartRenderer.d.ts +40 -0
  289. package/renderer/CombinedChartRenderer.js +133 -0
  290. package/renderer/CombinedChartRenderer.js.map +1 -0
  291. package/renderer/DataRenderer.d.ts +103 -0
  292. package/renderer/DataRenderer.js +110 -0
  293. package/renderer/DataRenderer.js.map +1 -0
  294. package/renderer/HorizontalBarChartRenderer.d.ts +20 -0
  295. package/renderer/HorizontalBarChartRenderer.js +303 -0
  296. package/renderer/HorizontalBarChartRenderer.js.map +1 -0
  297. package/renderer/LegendRenderer.d.ts +54 -0
  298. package/renderer/LegendRenderer.js +336 -0
  299. package/renderer/LegendRenderer.js.map +1 -0
  300. package/renderer/LineChartRenderer.d.ts +100 -0
  301. package/renderer/LineChartRenderer.js +745 -0
  302. package/renderer/LineChartRenderer.js.map +1 -0
  303. package/renderer/LineRadarRenderer.d.ts +30 -0
  304. package/renderer/LineRadarRenderer.js +76 -0
  305. package/renderer/LineRadarRenderer.js.map +1 -0
  306. package/renderer/LineScatterCandleRadarRenderer.d.ts +20 -0
  307. package/renderer/LineScatterCandleRadarRenderer.js +45 -0
  308. package/renderer/LineScatterCandleRadarRenderer.js.map +1 -0
  309. package/renderer/PieChartRenderer.d.ts +86 -0
  310. package/renderer/PieChartRenderer.js +714 -0
  311. package/renderer/PieChartRenderer.js.map +1 -0
  312. package/renderer/RadarChartRenderer.d.ts +33 -0
  313. package/renderer/RadarChartRenderer.js +290 -0
  314. package/renderer/RadarChartRenderer.js.map +1 -0
  315. package/renderer/Renderer.d.ts +13 -0
  316. package/renderer/Renderer.js +11 -0
  317. package/renderer/Renderer.js.map +1 -0
  318. package/renderer/ScatterChartRenderer.d.ts +16 -0
  319. package/renderer/ScatterChartRenderer.js +147 -0
  320. package/renderer/ScatterChartRenderer.js.map +1 -0
  321. package/renderer/XAxisRenderer.d.ts +58 -0
  322. package/renderer/XAxisRenderer.js +458 -0
  323. package/renderer/XAxisRenderer.js.map +1 -0
  324. package/renderer/XAxisRendererHorizontalBarChart.d.ts +31 -0
  325. package/renderer/XAxisRendererHorizontalBarChart.js +264 -0
  326. package/renderer/XAxisRendererHorizontalBarChart.js.map +1 -0
  327. package/renderer/XAxisRendererRadarChart.d.ts +17 -0
  328. package/renderer/XAxisRendererRadarChart.js +51 -0
  329. package/renderer/XAxisRendererRadarChart.js.map +1 -0
  330. package/renderer/YAxisRenderer.d.ts +60 -0
  331. package/renderer/YAxisRenderer.js +379 -0
  332. package/renderer/YAxisRenderer.js.map +1 -0
  333. package/renderer/YAxisRendererHorizontalBarChart.d.ts +33 -0
  334. package/renderer/YAxisRendererHorizontalBarChart.js +258 -0
  335. package/renderer/YAxisRendererHorizontalBarChart.js.map +1 -0
  336. package/renderer/YAxisRendererRadarChart.d.ts +14 -0
  337. package/renderer/YAxisRendererRadarChart.js +180 -0
  338. package/renderer/YAxisRendererRadarChart.js.map +1 -0
  339. package/renderer/scatter/ChevronDownShapeRenderer.d.ts +11 -0
  340. package/renderer/scatter/ChevronDownShapeRenderer.js +15 -0
  341. package/renderer/scatter/ChevronDownShapeRenderer.js.map +1 -0
  342. package/renderer/scatter/ChevronUpShapeRenderer.d.ts +11 -0
  343. package/renderer/scatter/ChevronUpShapeRenderer.js +15 -0
  344. package/renderer/scatter/ChevronUpShapeRenderer.js.map +1 -0
  345. package/renderer/scatter/CircleShapeRenderer.d.ts +11 -0
  346. package/renderer/scatter/CircleShapeRenderer.js +31 -0
  347. package/renderer/scatter/CircleShapeRenderer.js.map +1 -0
  348. package/renderer/scatter/CrossShapeRenderer.d.ts +11 -0
  349. package/renderer/scatter/CrossShapeRenderer.js +15 -0
  350. package/renderer/scatter/CrossShapeRenderer.js.map +1 -0
  351. package/renderer/scatter/IShapeRenderer.d.ts +20 -0
  352. package/renderer/scatter/IShapeRenderer.js +2 -0
  353. package/renderer/scatter/IShapeRenderer.js.map +1 -0
  354. package/renderer/scatter/SquareShapeRenderer.d.ts +11 -0
  355. package/renderer/scatter/SquareShapeRenderer.js +31 -0
  356. package/renderer/scatter/SquareShapeRenderer.js.map +1 -0
  357. package/renderer/scatter/TriangleShapeRenderer.d.ts +12 -0
  358. package/renderer/scatter/TriangleShapeRenderer.js +43 -0
  359. package/renderer/scatter/TriangleShapeRenderer.js.map +1 -0
  360. package/renderer/scatter/XShapeRenderer.d.ts +11 -0
  361. package/renderer/scatter/XShapeRenderer.js +15 -0
  362. package/renderer/scatter/XShapeRenderer.js.map +1 -0
  363. package/utils/ColorTemplate.d.ts +34 -0
  364. package/utils/ColorTemplate.js +51 -0
  365. package/utils/ColorTemplate.js.map +1 -0
  366. package/utils/HorizontalViewPortHandler.d.ts +6 -0
  367. package/utils/HorizontalViewPortHandler.js +7 -0
  368. package/utils/HorizontalViewPortHandler.js.map +1 -0
  369. package/utils/MPPointD.d.ts +5 -0
  370. package/utils/MPPointF.d.ts +7 -0
  371. package/utils/MPSize.d.ts +7 -0
  372. package/utils/ObjectPool.d.ts +81 -0
  373. package/utils/ObjectPool.js +183 -0
  374. package/utils/ObjectPool.js.map +1 -0
  375. package/utils/Transformer.d.ts +175 -0
  376. package/utils/Transformer.js +356 -0
  377. package/utils/Transformer.js.map +1 -0
  378. package/utils/TransformerHorizontalBarChart.d.ts +14 -0
  379. package/utils/TransformerHorizontalBarChart.js +30 -0
  380. package/utils/TransformerHorizontalBarChart.js.map +1 -0
  381. package/utils/Utils.d.ts +203 -0
  382. package/utils/Utils.js +653 -0
  383. package/utils/Utils.js.map +1 -0
  384. package/utils/ViewPortHandler.d.ts +299 -0
  385. package/utils/ViewPortHandler.js +585 -0
  386. package/utils/ViewPortHandler.js.map +1 -0
  387. package/utils/colors/colorful.d.ts +1 -0
  388. package/utils/colors/colorful.js +2 -0
  389. package/utils/colors/colorful.js.map +1 -0
  390. package/utils/colors/joyful.d.ts +1 -0
  391. package/utils/colors/joyful.js +2 -0
  392. package/utils/colors/joyful.js.map +1 -0
  393. package/utils/colors/liberty.d.ts +1 -0
  394. package/utils/colors/liberty.js +2 -0
  395. package/utils/colors/liberty.js.map +1 -0
  396. package/utils/colors/material.d.ts +1 -0
  397. package/utils/colors/material.js +2 -0
  398. package/utils/colors/material.js.map +1 -0
  399. package/utils/colors/pastel.d.ts +1 -0
  400. package/utils/colors/pastel.js +2 -0
  401. package/utils/colors/pastel.js.map +1 -0
  402. package/utils/colors/vordiplom.d.ts +1 -0
  403. package/utils/colors/vordiplom.js +2 -0
  404. package/utils/colors/vordiplom.js.map +1 -0
@@ -0,0 +1,799 @@
1
+ import { Align, Canvas, CanvasView } from '@nativescript-community/ui-canvas';
2
+ import { Utils as NUtils, Trace } from '@nativescript/core';
3
+ import { ChartAnimator } from '../animation/ChartAnimator';
4
+ import { Description } from '../components/Description';
5
+ import { Legend } from '../components/Legend';
6
+ import { XAxis } from '../components/XAxis';
7
+ import { DefaultValueFormatter } from '../formatter/DefaultValueFormatter';
8
+ import { LegendRenderer } from '../renderer/LegendRenderer';
9
+ import { CLog, CLogTypes, Utils } from '../utils/Utils';
10
+ import { ViewPortHandler } from '../utils/ViewPortHandler';
11
+ const LOG_TAG = 'NSChart';
12
+ /**
13
+ * Baseclass of all Chart-Views.
14
+ *
15
+
16
+ */
17
+ export class Chart extends CanvasView {
18
+ /**
19
+ * default constructor for initialization in code
20
+ */
21
+ constructor() {
22
+ super();
23
+ /**
24
+ * object that holds all data that was originally set for the chart, before
25
+ * it was modified or any filtering algorithms had been applied
26
+ */
27
+ this.mData = null;
28
+ /**
29
+ * If set to true, chart continues to scroll after touch up
30
+ */
31
+ this.dragDecelerationEnabled = true;
32
+ /**
33
+ * Deceleration friction coefficient in [0 ; 1] interval, higher values
34
+ * indicate that speed will decrease slowly, for example if it set to 0, it
35
+ * will stop immediately. value must be < 1.0
36
+ */
37
+ this.dragDecelerationFrictionCoef = 0.9;
38
+ /**
39
+ * the default IValueFormatter that has been determined by the chart
40
+ * considering the provided minimum and maximum values, number of digits depends on provided chart-data
41
+ */
42
+ this.defaultValueFormatter = new DefaultValueFormatter(0);
43
+ /**
44
+ * text that is displayed when the chart is empty
45
+ */
46
+ this.noDataText = null;
47
+ /**
48
+ * object that manages the bounds and drawing constraints of the chart
49
+ */
50
+ this.viewPortHandler = new ViewPortHandler();
51
+ /**
52
+ * Extra offsets to be appended to the viewport
53
+ */
54
+ this.extraTopOffset = 0;
55
+ this.extraRightOffset = 0;
56
+ this.extraBottomOffset = 0;
57
+ this.extraLeftOffset = 0;
58
+ /**
59
+ * let the chart know it does not need to compute autoScale
60
+ * (it can used the cached ones)
61
+ */
62
+ this.noComputeAutoScaleOnNextDraw = false;
63
+ /**
64
+ * let the chart know it does not need to compute axis and legends
65
+ * (it can used the cached ones)
66
+ */
67
+ this.noComputeAxisOnNextDraw = false;
68
+ /**
69
+ * The maximum distance in dp away from an entry causing it to highlight.
70
+ */
71
+ this.maxHighlightDistance = 500;
72
+ /**
73
+ * Wether to filter highlights by axis. Default is true
74
+ */
75
+ this.highlightsFilterByAxis = true;
76
+ /**
77
+ * tasks to be done after the view is setup
78
+ */
79
+ this.jobs = [];
80
+ // for performance tracking
81
+ this.totalTime = 0;
82
+ this.drawCycles = 0;
83
+ // /**
84
+ // * Set a new (e.g. custom) ChartTouchListener NOTE: make sure to
85
+ // * setTouchEnabled(true); if you need touch gestures on the chart
86
+ // *
87
+ // * @param l
88
+ // */
89
+ // public setOnTouchListener(ChartTouchListener l) {
90
+ // this.chartTouchListener = l;
91
+ // }
92
+ // /**
93
+ // * Returns an instance of the currently active touch listener.
94
+ // *
95
+ // * @return
96
+ // */
97
+ // public ChartTouchListener getOnTouchListener() {
98
+ // return this.chartTouchListener;
99
+ // }
100
+ /**
101
+ * ################ ################ ################ ################
102
+ */
103
+ /** BELOW CODE IS FOR THE MARKER VIEW */
104
+ /**
105
+ * if set to true, the marker view is drawn when a value is clicked
106
+ */
107
+ this.drawMarkersEnabled = true;
108
+ this.init();
109
+ }
110
+ initNativeView() {
111
+ super.initNativeView();
112
+ this.chartTouchListener && this.chartTouchListener.init();
113
+ }
114
+ disposeNativeView() {
115
+ super.disposeNativeView();
116
+ this.chartTouchListener && this.chartTouchListener.dispose();
117
+ }
118
+ /**
119
+ * initialize all paints and stuff
120
+ */
121
+ init() {
122
+ this.animator = new ChartAnimator((state) => {
123
+ // during animations we dont need to compute autoScale nor axis things
124
+ this.noComputeAutoScaleOnNextDraw = true;
125
+ this.noComputeAxisOnNextDraw = true;
126
+ this.invalidate();
127
+ });
128
+ this.xAxis = new XAxis(new WeakRef(this));
129
+ if (Trace.isEnabled()) {
130
+ CLog(CLogTypes.log, this.constructor.name, 'init()');
131
+ }
132
+ }
133
+ get infoPaint() {
134
+ if (!this.mInfoPaint) {
135
+ this.mInfoPaint = Utils.getTemplatePaint('black-fill');
136
+ this.mInfoPaint.setTextAlign(Align.CENTER);
137
+ this.mInfoPaint.setTextSize(12);
138
+ }
139
+ return this.mInfoPaint;
140
+ }
141
+ /**
142
+ * Sets a new data object for the chart. The data object contains all values
143
+ * and information needed for displaying.
144
+ *
145
+ * @param data
146
+ */
147
+ set data(data) {
148
+ this.mData = data;
149
+ this.offsetsCalculated = false;
150
+ if (!data) {
151
+ return;
152
+ }
153
+ // Calculate how many digits are needed
154
+ this.setupDefaultFormatter(data.yMin, data.yMax);
155
+ for (const set of this.mData.dataSets) {
156
+ if (set.needsFormatter || set.valueFormatter === this.defaultValueFormatter) {
157
+ set.valueFormatter = this.defaultValueFormatter;
158
+ }
159
+ }
160
+ // let the chart know there is new data
161
+ this.notifyDataSetChanged();
162
+ }
163
+ /**
164
+ * Returns the ChartData object that has been set for the chart.
165
+ */
166
+ get data() {
167
+ return this.mData;
168
+ }
169
+ get viewPortScaleX() {
170
+ return this.viewPortHandler.scaleX;
171
+ }
172
+ get viewPortScaleY() {
173
+ return this.viewPortHandler.scaleY;
174
+ }
175
+ /**
176
+ * Clears the chart from all data (sets it to null) and refreshes it (by
177
+ * calling invalidate()).
178
+ */
179
+ clear() {
180
+ this.mData = null;
181
+ this.offsetsCalculated = false;
182
+ this.indicesToHighlight = null;
183
+ if (this.chartTouchListener) {
184
+ this.chartTouchListener.lastHighlighted = null;
185
+ }
186
+ this.invalidate();
187
+ }
188
+ /**
189
+ * Removes all DataSets (and thereby Entries) from the chart. Does not set the data object to null. Also refreshes the
190
+ * chart by calling invalidate().
191
+ */
192
+ clearValues() {
193
+ this.mData.clearValues();
194
+ this.invalidate();
195
+ }
196
+ /**
197
+ * Returns true if the chart is empty (meaning it's data object is either
198
+ * null or contains no entries).
199
+ */
200
+ get length() {
201
+ if (!this.mData)
202
+ return true;
203
+ else {
204
+ if (this.mData.entryCount <= 0)
205
+ return true;
206
+ else
207
+ return false;
208
+ }
209
+ }
210
+ /**
211
+ * Calculates the required number of digits for the values that might be
212
+ * drawn in the chart (if enabled), and creates the default-value-formatter
213
+ */
214
+ setupDefaultFormatter(min, max) {
215
+ let reference = 0;
216
+ if (!this.mData || this.mData.entryCount < 2) {
217
+ reference = Math.max(Math.abs(min), Math.abs(max));
218
+ }
219
+ else {
220
+ reference = Math.abs(max - min);
221
+ }
222
+ const digits = Utils.getDecimals(reference);
223
+ // setup the formatter with a new number of digits
224
+ this.defaultValueFormatter.setup(digits);
225
+ }
226
+ draw(canvas) {
227
+ if (!this.mData) {
228
+ const hasText = this.noDataText && this.noDataText.length > 0;
229
+ if (hasText) {
230
+ const c = this.center;
231
+ canvas.drawText(this.noDataText, c.x, c.y, this.infoPaint);
232
+ }
233
+ }
234
+ }
235
+ onDraw(canvas) {
236
+ const startTime = Date.now();
237
+ super.onDraw(canvas);
238
+ this.draw(canvas);
239
+ if (Trace.isEnabled()) {
240
+ const drawtime = Date.now() - startTime;
241
+ this.totalTime += drawtime;
242
+ this.drawCycles += 1;
243
+ const average = this.totalTime / this.drawCycles;
244
+ CLog(CLogTypes.log, this.constructor.name, 'Drawtime: ' + drawtime + ' ms, average: ' + average + ' ms, cycles: ' + this.drawCycles);
245
+ }
246
+ this.notify({ eventName: 'postDraw', canvas, object: this });
247
+ }
248
+ /**
249
+ * RESET PERFORMANCE TRACKING FIELDS
250
+ */
251
+ resetTracking() {
252
+ this.totalTime = 0;
253
+ this.drawCycles = 0;
254
+ }
255
+ /**
256
+ * Draws the description text in the bottom right corner of the chart (per default)
257
+ */
258
+ drawDescription(c) {
259
+ // check if description should be drawn
260
+ if (this.mDescription?.enabled) {
261
+ const position = this.mDescription.position;
262
+ const paint = Utils.getTempPaint();
263
+ paint.setFont(this.mDescription.typeface);
264
+ paint.setColor(this.mDescription.textColor);
265
+ paint.setTextAlign(this.mDescription.textAlign);
266
+ let x, y;
267
+ const vph = this.viewPortHandler;
268
+ // if no position specified, draw on default position
269
+ if (!position) {
270
+ x = vph.chartWidth - vph.offsetRight - this.mDescription.xOffset;
271
+ y = vph.chartHeight - vph.offsetBottom - this.mDescription.yOffset;
272
+ }
273
+ else {
274
+ x = position.x;
275
+ y = position.y;
276
+ }
277
+ c.drawText(this.mDescription.text, x, y, paint);
278
+ }
279
+ }
280
+ /**
281
+ * Returns the array of currently highlighted values. This might a null or
282
+ * empty array if nothing is highlighted.
283
+ */
284
+ get highlighted() {
285
+ return this.indicesToHighlight;
286
+ }
287
+ /**
288
+ * Returns true if there are values to highlight, false if there are no
289
+ * values to highlight. Checks if the highlight array is null, has a length
290
+ * of zero or if the first object is null.
291
+ *
292
+ */
293
+ get hasValuesToHighlight() {
294
+ return this.indicesToHighlight?.[0] !== undefined;
295
+ }
296
+ /**
297
+ * Sets the last highlighted value for the touchlistener.
298
+ *
299
+ * @param highs
300
+ */
301
+ set lastHighlighted(highs) {
302
+ if (!this.chartTouchListener) {
303
+ return;
304
+ }
305
+ if (highs?.[0] === undefined) {
306
+ this.chartTouchListener.lastHighlighted = null;
307
+ }
308
+ else {
309
+ this.chartTouchListener.lastHighlighted = highs[0];
310
+ }
311
+ }
312
+ /**
313
+ * Highlights the values at the given indices in the given DataSets. Provide
314
+ * null or an empty array to undo all highlighting. This should be used to
315
+ * programmatically highlight values.
316
+ * This method *will not* call the listener.
317
+ *
318
+ * @param highs
319
+ */
320
+ highlightValues(highs) {
321
+ // set the indices to highlight
322
+ this.indicesToHighlight = highs;
323
+ this.lastHighlighted = highs;
324
+ // redraw the chart
325
+ this.noComputeAutoScaleOnNextDraw = true;
326
+ this.noComputeAxisOnNextDraw = true;
327
+ this.invalidate();
328
+ }
329
+ // /**
330
+ // * Highlights any y-value at the given x-value in the given DataSet.
331
+ // * Provide -1 as the dataSetIndex to undo all highlighting.
332
+ // * This method will call the listener.
333
+ // * @param x The x-value to highlight
334
+ // * @param dataSetIndex The dataset index to search in
335
+ // */
336
+ // public highlightValue( x, dataSetIndex) {
337
+ // this.highlightValue(x, dataSetIndex, true);
338
+ // }
339
+ // /**
340
+ // * Highlights the value at the given x-value and y-value in the given DataSet.
341
+ // * Provide -1 as the dataSetIndex to undo all highlighting.
342
+ // * This method will call the listener.
343
+ // * @param x The x-value to highlight
344
+ // * @param y The y-value to highlight. Supply `NaN` for "any"
345
+ // * @param dataSetIndex The dataset index to search in
346
+ // */
347
+ // public highlightValue(x, y, dataSetIndex) {
348
+ // this.highlightValue(x, y, dataSetIndex, true);
349
+ // }
350
+ // /**
351
+ // * Highlights any y-value at the given x-value in the given DataSet.
352
+ // * Provide -1 as the dataSetIndex to undo all highlighting.
353
+ // * @param x The x-value to highlight
354
+ // * @param dataSetIndex The dataset index to search in
355
+ // * @param callListener Should the listener be called for this change
356
+ // */
357
+ // public highlightValue(x, dataSetIndex, callListener = true) {
358
+ // this.highlightValue(x, NaN, dataSetIndex, callListener);
359
+ // }
360
+ /**
361
+ * Highlights any y-value at the given x-value in the given DataSet.
362
+ * Provide -1 as the dataSetIndex to undo all highlighting.
363
+ * @param x The x-value to highlight
364
+ * @param y The y-value to highlight. Supply `NaN` for "any"
365
+ * @param dataSetIndex The dataset index to search in
366
+ * @param callListener Should the listener be called for this change
367
+ */
368
+ highlightValue(x, y, dataSetIndex, callListener = false) {
369
+ if (dataSetIndex < 0 || dataSetIndex >= this.mData.dataSetCount) {
370
+ this.highlight(null, callListener);
371
+ }
372
+ else {
373
+ this.highlight({ x, y, dataSetIndex }, callListener);
374
+ }
375
+ }
376
+ /**
377
+ * Highlights the value selected by touch gesture. Unlike
378
+ * highlightValues(...), this generates a callback to the
379
+ * OnChartValueSelectedListener.
380
+ *
381
+ * @param high - the highlight object
382
+ * @param callListener - call the listener
383
+ */
384
+ highlight(high, callListener = false) {
385
+ let e = null;
386
+ let highlight = Array.isArray(high) ? high[0] : high;
387
+ if (!high) {
388
+ this.indicesToHighlight = null;
389
+ }
390
+ else {
391
+ e = this.mData.getEntryForHighlight(highlight);
392
+ if (!e) {
393
+ this.indicesToHighlight = null;
394
+ highlight = null;
395
+ }
396
+ else {
397
+ highlight.entry = e;
398
+ // set the indices to highlight
399
+ this.indicesToHighlight = [highlight];
400
+ }
401
+ }
402
+ this.lastHighlighted = this.indicesToHighlight;
403
+ if (callListener) {
404
+ this.notify({ eventName: 'highlight', object: this, entry: e, highlight, highlights: Array.isArray(high) ? high : [highlight] });
405
+ }
406
+ // redraw the chart
407
+ this.noComputeAutoScaleOnNextDraw = true;
408
+ this.noComputeAxisOnNextDraw = true;
409
+ this.invalidate();
410
+ }
411
+ /**
412
+ * Highlights the value selected by touch gesture. Unlike
413
+ * highlightValues(...), this generates a callback to the
414
+ * OnChartValueSelectedListener.
415
+ *
416
+ * @param high - the highlight object
417
+ * @param callListener - call the listener
418
+ */
419
+ highlights(highs, callListener = false) {
420
+ const e = null;
421
+ if (highs.length === 0) {
422
+ this.indicesToHighlight = null;
423
+ }
424
+ else {
425
+ highs = highs
426
+ .map((h) => {
427
+ if (!h.entry) {
428
+ h.entry = this.mData.getEntryForHighlight(h);
429
+ }
430
+ return h;
431
+ })
432
+ .filter((h) => !!h.entry);
433
+ this.indicesToHighlight = highs.length ? highs : null;
434
+ }
435
+ this.lastHighlighted = this.indicesToHighlight;
436
+ if (callListener) {
437
+ this.notify({ eventName: 'highlight', object: this, entry: highs?.[0]?.entry, highlight: highs?.[0], highlights: highs });
438
+ }
439
+ // redraw the chart
440
+ this.noComputeAutoScaleOnNextDraw = true;
441
+ this.noComputeAxisOnNextDraw = true;
442
+ this.invalidate();
443
+ }
444
+ /**
445
+ * Returns the Highlights (contains x-index and DataSet index) of the
446
+ * selected value at the given touch polet inside the Line-, Scatter-, or
447
+ * CandleStick-Chart.
448
+ *
449
+ * @param x
450
+ * @param y
451
+ * @return
452
+ */
453
+ getHighlightsByTouchPoint(x, y) {
454
+ return this.highlighter.getHighlight(x, y);
455
+ }
456
+ /**
457
+ * Returns the Highlight object (contains x-index and DataSet index) of the
458
+ * selected value at the given touch polet inside the Line-, Scatter-, or
459
+ * CandleStick-Chart.
460
+ *
461
+ * @param x
462
+ * @param y
463
+ * @return
464
+ */
465
+ getHighlightByTouchPoint(x, y) {
466
+ return this.getHighlightsByTouchPoint(x, y)?.[0];
467
+ }
468
+ /**
469
+ * Returns the Highlight object (contains x-index and DataSet index) of the
470
+ * selected value at the given touch polet inside the Line-, Scatter-, or
471
+ * CandleStick-Chart.
472
+ *
473
+ * @param x
474
+ * @param y
475
+ * @return
476
+ */
477
+ getHighlightByXValue(xValue) {
478
+ if (!this.mData) {
479
+ return null;
480
+ }
481
+ else {
482
+ return this.highlighter.getHighlightsAtXValue(xValue);
483
+ }
484
+ }
485
+ /**
486
+ * draws all MarkerViews on the highlighted positions
487
+ */
488
+ drawMarkers(canvas) {
489
+ // if there is no marker view or drawing marker is disabled
490
+ if (!this.marker || !this.drawMarkersEnabled || !this.hasValuesToHighlight)
491
+ return;
492
+ for (let i = 0; i < this.indicesToHighlight.length; i++) {
493
+ const highlight = this.indicesToHighlight[i];
494
+ const set = this.mData.getDataSetByIndex(highlight.dataSetIndex);
495
+ const e = highlight.entry || this.mData.getEntryForHighlight(highlight);
496
+ const entryIndex = set.getEntryIndex(e);
497
+ // make sure entry not null
498
+ if (!e || entryIndex > set.entryCount * this.animator.phaseX)
499
+ continue;
500
+ const pos = this.getMarkerPosition(highlight);
501
+ // check bounds
502
+ if (!this.viewPortHandler.isInBounds(pos[0], pos[1]))
503
+ continue;
504
+ // callbacks to update the content
505
+ this.marker.refreshContent(e, highlight);
506
+ // draw the marker
507
+ this.marker.draw(canvas, pos[0], pos[1]);
508
+ }
509
+ }
510
+ /**
511
+ * Returns the actual position in pixels of the MarkerView for the given
512
+ * Highlight object.
513
+ *
514
+ * @param high
515
+ * @return
516
+ */
517
+ getMarkerPosition(high) {
518
+ return [high.drawX, high.drawY];
519
+ }
520
+ /**
521
+ * ################ ################ ################ ################
522
+ * ANIMATIONS ONLY WORK FOR API LEVEL 11 (Android 3.0.x) AND HIGHER.
523
+ */
524
+ /** CODE BELOW THIS RELATED TO ANIMATION */
525
+ /**
526
+ * Returns the animator responsible for animating chart values.
527
+ */
528
+ get description() {
529
+ if (!this.mDescription) {
530
+ this.mDescription = new Description();
531
+ }
532
+ return this.mDescription;
533
+ }
534
+ /**
535
+ * ################ ################ ################ ################
536
+ * ANIMATIONS ONLY WORK FOR API LEVEL 11 (Android 3.0.x) AND HIGHER.
537
+ */
538
+ /** CODE BELOW FOR PROVIDING EASING FUNCTIONS */
539
+ /**
540
+ * Animates the drawing / rendering of the chart on both x- and y-axis with
541
+ * the specified animation time. If animate(...) is called, no further
542
+ * calling of invalidate() is necessary to refresh the chart. ANIMATIONS
543
+ * ONLY WORK FOR API LEVEL 11 (Android 3.0.x) AND HIGHER.
544
+ *
545
+ * @param durationMillisX
546
+ * @param durationMillisY
547
+ * @param easingX a custom easing function to be used on the animation phase
548
+ * @param easingY a custom easing function to be used on the animation phase
549
+ */
550
+ animateXY(durationMillisX, durationMillisY, easingX, easingY) {
551
+ this.animator.animateXY(durationMillisX, durationMillisY, easingX, easingY);
552
+ }
553
+ /**
554
+ * Animates the rendering of the chart on the x-axis with the specified
555
+ * animation time. If animate(...) is called, no further calling of
556
+ * invalidate() is necessary to refresh the chart. ANIMATIONS ONLY WORK FOR
557
+ * API LEVEL 11 (Android 3.0.x) AND HIGHER.
558
+ *
559
+ * @param durationMillis
560
+ * @param easing a custom easing function to be used on the animation phase
561
+ */
562
+ animateX(durationMillis, easing) {
563
+ this.animator.animateX(durationMillis, easing);
564
+ }
565
+ /**
566
+ * Animates the rendering of the chart on the y-axis with the specified
567
+ * animation time. If animate(...) is called, no further calling of
568
+ * invalidate() is necessary to refresh the chart. ANIMATIONS ONLY WORK FOR
569
+ * API LEVEL 11 (Android 3.0.x) AND HIGHER.
570
+ *
571
+ * @param durationMillis
572
+ * @param easing a custom easing function to be used on the animation phase
573
+ */
574
+ animateY(durationMillis, easing) {
575
+ this.animator.animateY(durationMillis, easing);
576
+ }
577
+ /**
578
+ * ################ ################ ################ ################
579
+ */
580
+ /** BELOW THIS ONLY GETTERS AND SETTERS */
581
+ /**
582
+ * returns the current y-max value across all DataSets
583
+ */
584
+ get yMax() {
585
+ return this.mData.yMax;
586
+ }
587
+ /**
588
+ * returns the current y-min value across all DataSets
589
+ */
590
+ get yMin() {
591
+ return this.mData.yMin;
592
+ }
593
+ get xChartMax() {
594
+ return this.xAxis.axisMaximum;
595
+ }
596
+ get xChartMin() {
597
+ return this.xAxis.axisMinimum;
598
+ }
599
+ get xRange() {
600
+ return this.xAxis.axisRange;
601
+ }
602
+ /**
603
+ * Returns a recyclable MPPointF instance.
604
+ * Returns the center polet of the chart (the whole View) in pixels.
605
+ */
606
+ get center() {
607
+ return { x: this.viewPortHandler.chartWidth / 2, y: this.viewPortHandler.chartHeight / 2 };
608
+ }
609
+ /**
610
+ * Returns a recyclable MPPointF instance.
611
+ * Returns the center of the chart taking offsets under consideration.
612
+ * (returns the center of the content rectangle)
613
+ */
614
+ get centerOffsets() {
615
+ return this.viewPortHandler.contentCenter;
616
+ }
617
+ /**
618
+ * Sets extra offsets (around the chart view) to be appended to the
619
+ * auto-calculated offsets.
620
+ *
621
+ * @param left
622
+ * @param top
623
+ * @param right
624
+ * @param bottom
625
+ */
626
+ setExtraOffsets(left, top, right, bottom) {
627
+ this.extraLeftOffset = left;
628
+ this.extraTopOffset = top;
629
+ this.extraRightOffset = right;
630
+ this.extraBottomOffset = bottom;
631
+ }
632
+ /**
633
+ * Sets extra offsets (around the chart view) to be appended to the
634
+ * auto-calculated offsets.
635
+ *
636
+ * @param left
637
+ * @param top
638
+ * @param right
639
+ * @param bottom
640
+ */
641
+ set extraOffsets(value) {
642
+ this.extraLeftOffset = value[0];
643
+ this.extraTopOffset = value[1];
644
+ this.extraRightOffset = value[2];
645
+ this.extraBottomOffset = value[3];
646
+ }
647
+ /**
648
+ * Sets the color of the no data text.
649
+ *
650
+ * @param color
651
+ */
652
+ set noDataTextColor(color) {
653
+ this.infoPaint.setColor(color);
654
+ }
655
+ /**
656
+ * Sets the typeface to be used for the no data text.
657
+ */
658
+ set noDataTextTypeface(tf) {
659
+ this.infoPaint.setTypeface(tf);
660
+ }
661
+ /**
662
+ * Returns the Legend object of the chart. This method can be used to get an
663
+ * instance of the legend in order to customize the automatically generated
664
+ * Legend.
665
+ */
666
+ get legend() {
667
+ if (!this.mLegend) {
668
+ this.mLegend = new Legend();
669
+ this.legendRenderer = new LegendRenderer(this.viewPortHandler, this.mLegend);
670
+ }
671
+ return this.mLegend;
672
+ }
673
+ /**
674
+ * Returns the rectangle that defines the borders of the chart-value surface
675
+ * (into which the actual values are drawn).
676
+ */
677
+ get contentRect() {
678
+ return this.viewPortHandler.contentRect;
679
+ }
680
+ /**
681
+ * Returns a recyclable MPPointF instance.
682
+ */
683
+ get centerOfView() {
684
+ return this.center;
685
+ }
686
+ /**
687
+ * Returns the bitmap that represents the chart.
688
+ */
689
+ get chartBitmap() {
690
+ //Define a bitmap with the same size as the view
691
+ const canvas = new Canvas(this.getMeasuredWidth(), this.getMeasuredHeight());
692
+ canvas.drawColor(this.backgroundColor);
693
+ // draw the view on the canvas
694
+ this.onDraw(canvas);
695
+ // return the bitmap
696
+ return canvas.getImage();
697
+ }
698
+ removeViewportJob(job) {
699
+ const index = this.jobs.indexOf(job);
700
+ if (index >= 0) {
701
+ this.jobs.splice(index, 1);
702
+ }
703
+ }
704
+ clearAllViewportJobs() {
705
+ this.jobs = [];
706
+ }
707
+ /**
708
+ * Either posts a job immediately if the chart has already setup it's
709
+ * dimensions or adds the job to the execution queue.
710
+ *
711
+ * @param job
712
+ */
713
+ addViewportJob(job) {
714
+ if (this.viewPortHandler.hasChartDimens) {
715
+ setTimeout(() => {
716
+ job.run();
717
+ }, 0);
718
+ }
719
+ else {
720
+ this.jobs.push(job);
721
+ }
722
+ }
723
+ /**
724
+ * Returns all jobs that are scheduled to be executed after
725
+ * onSizeChanged(...).
726
+ */
727
+ getJobs() {
728
+ return this.jobs;
729
+ }
730
+ onSetWidthHeight(w, h) {
731
+ const needsDataSetChanged = !this.viewPortHandler.hasChartDimens;
732
+ if (Trace.isEnabled()) {
733
+ CLog(CLogTypes.info, LOG_TAG, 'onSetWidthHeight', w, h, needsDataSetChanged);
734
+ }
735
+ if (w > 0 && h > 0) {
736
+ if (Trace.isEnabled()) {
737
+ CLog(CLogTypes.info, LOG_TAG, 'Setting chart dimens, width: ' + w + ', height: ' + h);
738
+ }
739
+ this.viewPortHandler.setChartDimens(w, h);
740
+ }
741
+ // This may cause the chart view to mutate properties affecting the view port --
742
+ // lets do this before we try to run any pending jobs on the view port itself
743
+ // this.notifyDataSetChanged();
744
+ if (needsDataSetChanged) {
745
+ this.notifyDataSetChanged();
746
+ }
747
+ else {
748
+ this.offsetsCalculated = false;
749
+ this.invalidate(); // needs chart size
750
+ }
751
+ for (const r of this.jobs) {
752
+ setTimeout(() => {
753
+ r.run();
754
+ }, 0);
755
+ }
756
+ this.jobs = [];
757
+ this.notify({ eventName: 'sizeChanged', object: this });
758
+ }
759
+ onLayout(left, top, right, bottom) {
760
+ super.onLayout(left, top, right, bottom);
761
+ if (__IOS__) {
762
+ this.onSetWidthHeight(Math.round(NUtils.layout.toDeviceIndependentPixels(right - left)), Math.round(NUtils.layout.toDeviceIndependentPixels(bottom - top)));
763
+ }
764
+ }
765
+ onSizeChanged(w, h, oldw, oldh) {
766
+ super.onSizeChanged(w, h, oldw, oldh);
767
+ if (__ANDROID__) {
768
+ this.onSetWidthHeight(Math.round(w), Math.round(h));
769
+ }
770
+ }
771
+ /**
772
+ * Setting this to true will set the layer-type HARDWARE for the view, false
773
+ * will set layer-type SOFTWARE.
774
+ *
775
+ * @param enabled
776
+ */
777
+ set hardwareAccelerationEnabled(enabled) {
778
+ this.hardwareAccelerated = enabled;
779
+ }
780
+ /**
781
+ * disables intercept touchevents
782
+ */
783
+ disableScroll() {
784
+ if (__ANDROID__) {
785
+ const parent = this.nativeViewProtected?.getParent();
786
+ parent?.requestDisallowInterceptTouchEvent(true);
787
+ }
788
+ }
789
+ /**
790
+ * enables intercept touchevents
791
+ */
792
+ enableScroll() {
793
+ if (__ANDROID__) {
794
+ const parent = this.nativeViewProtected?.getParent();
795
+ parent?.requestDisallowInterceptTouchEvent(false);
796
+ }
797
+ }
798
+ }
799
+ //# sourceMappingURL=Chart.js.map