Удалить кнопку экспорта из HighChart Objective-C - PullRequest
0 голосов
/ 05 февраля 2019

Есть ли способ удалить кнопку экспорта из линейного графика в 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, ноэто не работает.

Ответы [ 2 ]

0 голосов
/ 18 марта 2019

Ниже приведено решение, которое я нашел в Swift.По сути, вам нужно создать объект HINavigation и объект HIButtonOptions.После установки для свойства «Параметры кнопки» значения «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
0 голосов
/ 05 февраля 2019

в viewForHeaderInSection метод набор экспорт = НЕТ

будет скрывать кнопку 3 бара. см. Скриншот ниже для получения более подробной информации:

enter image description here

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...