要改变标记颜色HighCharts

问题描述 投票:1回答:1

我想改变在highCharts https://api.highcharts.com/highcharts/plotOptions.series.marker.fillColor在上面的共享链路它的工作网络,但同样的事情不会对iOS的工作标识的颜色。我曾试图改变标记颜色为链接提到的一样,但它不工作。

下面我正在共享的代码。

HIColor *color = [[HIColor alloc] initWithUIColor:[UIColor greenColor]];
HIColor *colorRed = [[HIColor alloc] initWithUIColor:[UIColor redColor]];

HIChartView *chartView = [[HIChartView alloc] initWithFrame:self.view.bounds];
chartView.backgroundColor = [UIColor orangeColor];

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

HIOptions *options = [[HIOptions alloc]init];

HITitle *title = [[HITitle alloc]init];
title.text = @"Solar Employment Growth by Sector, 2010-2016";

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

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

HIBackground *bg = [[HIBackground alloc] init];
bg.backgroundColor = colorRed;

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

HIYAxis *yaxis = [[HIYAxis alloc]init];
yaxis.title = [[HITitle alloc]init];
yaxis.title.text = @"Number of Employees";

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.pointStart = @2010;
plotoptions.series.color = [[HIColor alloc] initWithUIColor:[UIColor whiteColor]];
plotoptions.series.colorIndex = @4;
plotoptions.series.marker.color =  [[HIColor alloc] initWithUIColor:[UIColor whiteColor]];
plotoptions.series.marker.fillColor = [[HIColor alloc] initWithUIColor:[UIColor whiteColor]];

HILine *line1 = [[HILine alloc]init];
line1.name = @"Installation";
line1.data = [NSMutableArray arrayWithObjects:@43934, @52503, @57177, @69658, @97031, @119931, @137133, @154175, nil];
line1.marker.fillColor = [[HIColor alloc] initWithUIColor:[UIColor whiteColor]];
line1.marker.color = [[HIColor alloc] initWithUIColor:[UIColor whiteColor]];
line1.marker.lineColor = [[HIColor alloc] initWithUIColor:[UIColor whiteColor]];

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

HIRules *rules1 = [[HIRules alloc] init];
rules1.condition = [[HICondition alloc] init];
rules1.condition.maxWidth = @500;
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.credits = credits;
options.exporting = exporting;
options.chart = chart;

chartView.options = options;
chartView.tintColor = [UIColor brownColor];

[self.view addSubview:chartView];

提前致谢。

objective-c highcharts
1个回答
0
投票

如果设置在plotOptions的颜色,那么你就不需要再为各个系列设置。

您应该创建一个标记对象:qazxsw POI

更正和工作代码:

plotoptions.series.marker = [[HIMarker alloc] init];
© www.soinside.com 2019 - 2024. All rights reserved.