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

如何显示图例,但是图例不支持点击事件 #183

Closed
deepindo opened this issue Jan 2, 2020 · 7 comments
Closed

如何显示图例,但是图例不支持点击事件 #183

deepindo opened this issue Jan 2, 2020 · 7 comments
Labels

Comments

@deepindo
Copy link

deepindo commented Jan 2, 2020

作者你好,如题

我是在swift中使用的,设置legendEnabled=true,显示图例;
但是不希望这些图例可以点击,设置touchEventEnabled=false不生效

另外allowPointSelect=false,希望表格中的每一项不可以点击,也不生效

盼回复,谢谢!

@AAChartModel
Copy link
Owner

在 AAChartKit 中 禁用图例点击事件

aaOptions.plotOptions.series.events = @{@"legendItemClick":@"false"};

在 AAChartKit-Swift 中与之类似

aaOptions.plotOptions.series.events = ["legendItemClick":false]

@AAChartModel
Copy link
Owner

参见 AAChartModel/AAChartKit#570

@deepindo
Copy link
Author

deepindo commented Jan 6, 2020

let model = dailySpineChartModel()
        //dailySpineChart?.aa_drawChartWithChartModel(model)
        let option = AAOptionsConstructor.configureChartOptions(model)
        option.plotOptions?.series?.events = ["legendItemClick": false]
        dailySpineChart?.aa_drawChartWithChartOptions(option)


    func dailySpineChartModel() -> AAChartModel {
        
        let model = AAChartModel()
            .chartType(.spline)
            .backgroundColor(AAColor.white)
            .colorsTheme(["#FFAE91"])
            .title("日收益金额")
            .yAxisVisible(true)
            .yAxisTitle("单位(元)")
            .yAxisLabelsEnabled(true)
            .tooltipValueSuffix("")
            .legendEnabled(true)
            .dataLabelsEnabled(true)
            .touchEventEnabled(false)
            .categories(dailySpineCategories)
            .series([
                AASeriesElement()
                    .name("日收益金额")
                    .allowPointSelect(false)
                    .data(dailySpineSeries)
            ])
        
        return model
    }

如上,还是支持点击

@deepindo deepindo closed this as completed Jan 7, 2020
@deepindo deepindo reopened this Jan 7, 2020
@deepindo
Copy link
Author

deepindo commented Jan 7, 2020

少机率还会触发以下报错:

☠️☠️💀☠️☠️WARNING!!!!!!!!!!!!!!!!!!!! FBI WARNING !!!!!!!!!!!!!!!!!!!! WARNING☠️☠️💀☠️☠️


code = 4;
domain = WKErrorDomain;
userInfo = {
NSLocalizedDescription = "A JavaScript exception occurred";
WKJavaScriptExceptionColumnNumber = 21;
WKJavaScriptExceptionLineNumber = 1;
WKJavaScriptExceptionMessage = ReferenceError: Can't find variable: loadTheHighChartView;
WKJavaScriptExceptionSourceURL = file:///var/containers/Bundle/Application/3A7F7CF8-E2AE-4BB2-956B-1C291CD7056F/%E5%95%86%E7%8E%96.app/Frameworks/AAInfographics.framework/AAJSFiles.bundle/AAChartView.html;

==========================================================================================
☠️☠️💀☠️☠️WARNING!!!!!!!!!!!!!!!!!!!! FBI WARNING !!!!!!!!!!!!!!!!!!!! WARNING☠️☠️💀☠️☠️

@Nikita33
Copy link

Nikita33 commented May 5, 2020

Hi
Using the help of your code I am still not able to disable the clicks on the legends.

let option = AAOptionsConstructor.configureChartOptions(pieChartModel)
option.plotOptions?.series?.events = ["legendItemClick": false]

This is what I am using.
The value for legendItemClick for events in AASeries is being set to false. But still the legends are clickable.

@AAChartModel
Copy link
Owner

     //禁用图例点击事件
        aaOptions.plotOptions?.series?.events = AAEvents()
            .legendItemClick(#"""
                        function() {
                          return false;
                        }
            """#)
        

@AAChartModel
Copy link
Owner

参见 #239

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

No branches or pull requests

3 participants