从HighChart Objective-C移除导出按钮

时间:2019-02-05 06:12:52

标签: objective-c highcharts

反正有没有从iOS的折线图中删除导出按钮?

下面是我的代码:

HIChartView *chartView = [[HIChartView alloc] initWithFrame:self.lineGraphView2.bounds];
    chartView.tintColor = [UIColor greenColor];

HIColor *color = [[HIColor alloc] initWithHexValue:@"283445"];

HIColor *greeColorHex = [[HIColor alloc] initWithHexValue:@"00B84A"];
HIColor *redColorHex = [[HIColor alloc] initWithHexValue:@"A3001F"];
//    color = [color initWithHexValue:@"000000"];

HIChart *chart = [[HIChart alloc] init];
chart.plotBackgroundColor = color;
chart.backgroundColor = color;

HICredits *credits = [[HICredits alloc] init];
credits.enabled = @0;

HIExporting *exporting = [[HIExporting alloc] init];
exporting.enabled = @0;

HIOptions *options = [[HIOptions alloc]init];
options.exporting.enabled = false;

HITitle *title = [[HITitle alloc]init];
title.text = @"";

HISubtitle *subtitle = [[HISubtitle alloc]init];
//    subtitle.text = @"Source: thesolarfoundation.com";

HIYAxis *yaxis = [[HIYAxis alloc]init];
yaxis.title = [[HITitle alloc]init];
yaxis.title.text = @"";
yaxis.gridLineColor = color;
yaxis.gridLineWidth = @0;


HILegend *legend = [[HILegend alloc]init];
legend.layout = @"vertical";
legend.align = @"right";
legend.verticalAlign = @"middle";

HIPlotOptions *plotoptions = [[HIPlotOptions alloc] init];
plotoptions.series = [[HISeries alloc] init];
plotoptions.series.label = [[HILabel alloc] init];
plotoptions.series.label.connectorAllowed = [[NSNumber alloc] initWithBool:false];
plotoptions.series.lineWidth = @2;

HILine *line1 = [[HILine alloc]init];
line1.name = @"Shares Price";
line1.data = graphPointsMutableArray;
line1.color = greeColorHex;
line1.threshold = @10;

HIResponsive *responsive = [[HIResponsive alloc] init];

HIRules *rules1 = [[HIRules alloc] init];
rules1.condition = [[HICondition alloc] init];
rules1.chartOptions = @{
                        @"legend" : @{
                                @"layout": @"horizontal",
                                @"align": @"center",
                                @"verticalAlign": @"bottom"
                                }

                        };
responsive.rules = [NSMutableArray arrayWithObjects:rules1, nil];

options.title = title;
options.subtitle = subtitle;
options.yAxis = [NSMutableArray arrayWithObject:yaxis];
options.legend = legend;
options.plotOptions = plotoptions;
options.series = [NSMutableArray arrayWithObjects:line1, nil];
options.responsive = responsive;
options.chart = chart;
options.credits = credits;
options.exporting = exporting;
options.exporting.enabled = @0;
options.labels.enabled = @0;

chartView.options = options;

[self.lineGraphView2 addSubview:chartView];

我已经阅读了文档来设置exporting.enable = false,但是它不起作用。

3 个答案:

答案 0 :(得分:1)

My RenderMessageImage is renderMessage(props) { if(this.state.messages.length !==0){ return <Message {...props} />; }else{ return <View style={{flex:1, backgroundColor:'red'}}> <Text>Hello no data found</Text> </View> } return null } 方法集中输出= NO

它将隐藏3条按钮。 有关更多详细信息,请参见下面的屏幕截图:

enter image description here

答案 1 :(得分:0)

下面是我在Swift中找到的解决方案。基本上,您必须创建一个HINavigation对象和一个HIButtonOptions对象。将按钮选项enabled属性设置为false后,将导航的按钮选项属性设置为按钮选项对象,然后将HIOptions对象的导航对象设置为您创建的导航对象。我的obj-c不够好,无法尝试在obj-c中将其键入,因此下面是我的解决方案的Swift版本:

// init your options object
let options = HIOptions()

// hide hamburger button
let navigation = HINavigation() // init navigation object
let buttonOptions = HIButtonOptions() // init button options object
buttonOptions.enabled = false
navigation.buttonOptions = buttonOptions
options.navigation = navigation

答案 2 :(得分:0)

您将导出设置为false两次,请对其进行更改,以便仅将其设置为一次,如swift所示:

options.exporting = HIExporting()
options.exporting.enabled = NSNumber.init(booleanLiteral: false)