Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

柱状体点击之后。再点击就不走方法了 #1332

Closed
wtg934614282 opened this issue May 19, 2022 · 8 comments
Closed

柱状体点击之后。再点击就不走方法了 #1332

wtg934614282 opened this issue May 19, 2022 · 8 comments

Comments

@wtg934614282
Copy link

No description provided.

@wtg934614282
Copy link
Author

wtg934614282 commented May 19, 2022

- (void)aaChartView:(AAChartView *)aaChartView moveOverEventWithMessage:(AAMoveOverEventMessageModel *)message { ... ... }

点击第一次走了,第二次走不了点击相同的数据

@wtg934614282
Copy link
Author

wecom-temp-a7fbd98ff1ad6365a5f09be41b3177b6 这样再点击第一的的时候 不走代理方法,发现网络的web的代理方言也不走

@wtg934614282
Copy link
Author

wtg934614282 commented May 20, 2022

#pragma mark - WKScriptMessageHandler
- (void)userContentController:(WKUserContentController *)userContentController
      didReceiveScriptMessage:(WKScriptMessage *)message {
}

这个方法在第二次点击相同的祝状不走

@wtg934614282
Copy link
Author

大佬,有没有方法重置选中状态

@AAChartModel
Copy link
Owner

AAChartView 的 这个 delegate 方法

/// The delegate method of getting move over event message model
/// @param aaChartView The instance object of chart view
/// @param message User finger move over event message model
- (void)aaChartView:(AAChartView *)aaChartView moveOverEventWithMessage:(AAMoveOverEventMessageModel *)message;

或者说这个 block 方法

/// Chart view getting move over event message model
/// @param handler event handler
- (void)moveOverEventHandler:(AAMoveOverEventBlock)handler;

实际上是获取的手指✋🏻或鼠标🖱的滑动方法, 所以重复点击相同的位置, 无法获得交互事件回调.

@AAChartModel
Copy link
Owner

所以为 AAChartView 新增了专门获取用户点击事件的方法:

  • block 方法(方法 1):
/// Chart view getting click event message model
/// @param handler event handler
- (void)clickEventHandler:(AAClickEventBlock)handler;
  • delegate 方法(方法 2):
/// The delegate method of getting click event message model
/// @param aaChartView The instance object of chart view
/// @param message User finger click event message model
- (void)aaChartView:(AAChartView *)aaChartView clickEventWithMessage:(AAClickEventMessageModel *)message;

推荐使用 block 方式来获取点击事件回调.

@AAChartModel
Copy link
Owner

AAChartModel commented May 22, 2022

    [_aaChartView clickEventHandler:^(AAChartView *aaChartView,
                                      AAClickEventMessageModel *message) {
            NSDictionary *messageDic = @{
                @"category":message.category,
                @"index":@(message.index),
                @"name":message.name,
                @"offset":message.offset,
                @"x":message.x,
                @"y":message.y
            };
            
            NSString *str1 = [NSString stringWithFormat:@"🖱🖱🖱🖱 clicked point series element name: %@\n",
                              message.name];
            NSString *str2 = [NSString stringWithFormat:@"user finger clicked!!!,get the click event BLOCK message: %@",
                              messageDic];
            NSLog(@"%@%@",str1, str2);
    }];

如上即可获取用户的点击交互事件回调. 回调信息在控制台打印效果大致如下:

2022-05-22 14:00:46.759099+0800 AAChartKitDemo[38107:1314821] 🖱🖱🖱🖱 clicked point series element name: 2018
user finger clicked!!!,get the click event BLOCK message: {
    category = Go;
    index = 5;
    name = 2018;
    offset =     {
        plotX = "271.79166666667";
        plotY = "73.06109613656781";
    };
    x = 5;
    y = 22;
}

demo 中已新增此示例. 下载运行查看即可.

@AAChartModel
Copy link
Owner

AAChartModel commented May 22, 2022

参考:

更新 AAChartKit 至最新内容, 即可新增的点击事件回调方法.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants