@@ -58,66 +58,31 @@ export class UCharts {
5858 this . chartRenderer ?. off ( type ) ;
5959 }
6060
61- /**
62- * 处理触摸开始事件
63- * @param e 触摸事件对象
64- */
65- touchStart ( e : any ) {
66- if ( e . touches && e . touches . length > 0 ) {
67- const touch = e . touches [ 0 ] ;
68- const p : Point = {
69- x : touch . x ,
70- y : touch . y
71- } ;
72- this . chartRenderer ?. scrollStart ( p ) ;
73- }
61+ touchLegend ( p : Point ) {
62+ this . chartRenderer ?. touchLegend ( p ) ;
7463 }
7564
76- /**
77- * 处理触摸移动事件
78- * @param e 触摸事件对象
79- */
80- touchMove ( e : any ) {
81- if ( e . touches && e . touches . length > 0 ) {
82- const touch = e . touches [ 0 ] ;
83- const p : Point = {
84- x : touch . x ,
85- y : touch . y
86- } ;
87- this . chartRenderer ?. scroll ( p ) ;
88- this . chartRenderer ?. showToolTip ( p ) ;
89- }
65+ showToolTip ( p : Point ) {
66+ this . chartRenderer ?. showToolTip ( p ) ;
9067 }
9168
92- /**
93- * 处理触摸结束事件
94- * @param e 触摸事件对象
95- */
96- touchEnd ( e : any ) {
97- this . chartRenderer ?. scrollEnd ( ) ;
98-
99- // 处理点击事件
100- if ( e . changedTouches && e . changedTouches . length > 0 ) {
101- const touch = e . changedTouches [ 0 ] ;
102- const p : Point = {
103- x : touch . x ,
104- y : touch . y
105- } ;
106- this . chartRenderer ?. touchLegend ( p ) ;
107- this . chartRenderer ?. showToolTip ( p ) ;
108- }
69+ getLegendDataIndex ( p : Point ) {
70+ return this . chartRenderer ?. getLegendDataIndex ( p ) ;
10971 }
11072
111- /**
112- * 处理点击事件
113- * @param e 点击事件对象
114- */
115- tap ( e : any ) {
116- const p : Point = {
117- x : e . detail . x ,
118- y : e . detail . y
119- } ;
120- this . chartRenderer ?. touchLegend ( p ) ;
121- this . chartRenderer ?. showToolTip ( p ) ;
73+ getCurrentDataIndex ( p : Point ) {
74+ return this . chartRenderer ?. getCurrentDataIndex ( p ) ;
75+ }
76+
77+ scrollStart ( p : Point ) {
78+ this . chartRenderer ?. scrollStart ( p ) ;
79+ }
80+
81+ scroll ( p : Point ) {
82+ this . chartRenderer ?. scroll ( p ) ;
83+ }
84+
85+ scrollEnd ( ) {
86+ this . chartRenderer ?. scrollEnd ( ) ;
12287 }
12388}
0 commit comments