highcharts-ios
highcharts-ios copied to clipboard
Dependency wheel label issue
I am having trouble placing DataLabels in a DependencyWheel properly. See screenshot. How can I get the same distance to the wheel for all labels? dataLabels.distance does not work fine for the wheel ...

Code:
HIChartView *chartView = [[HIChartView alloc] initWithFrame:self.view.bounds];
chartView.plugins= @[ @"sankey",@"dependency-wheel" ];
HIOptions *options = [[HIOptions alloc]init];
HITitle *title = [[HITitle alloc]init];
title.text = @"Highcharts Dependency Wheel";
options.title = title;
HIDependencywheel *series1 = [[HIDependencywheel alloc] init];
series1.name = @"Dependency wheel series";
series1.type = @"dependencywheel";
//series1.minLinkWidth=@10;
HIColor *colorSun = [[HIColor alloc] initWithUIColor:[UIColor yellowColor]];
HIColor *colorHouse = [[HIColor alloc] initWithUIColor:[UIColor blueColor]];
HIColor *colorBatterie = [[HIColor alloc] initWithUIColor:[UIColor greenColor]];
HIColor *colorNetz = [[HIColor alloc] initWithUIColor:[UIColor redColor]];
HIColor *colorWallbox = [[HIColor alloc] initWithUIColor:[UIColor grayColor]];
series1.colors=[NSArray arrayWithObjects:colorSun,colorNetz,colorHouse,colorWallbox,colorBatterie, nil];
HIDataLabels *dataLabels = [[HIDataLabels alloc] init];
dataLabels.color = [[HIColor alloc] initWithHexValue:@"333"];
dataLabels.textPath = [[HITextPath alloc] init];
dataLabels.textPath.enabled = [[NSNumber alloc] initWithBool:true];
dataLabels.textPath.attributes = [[HISVGAttributes alloc] init];
dataLabels.textPath.attributes.d = [NSArray arrayWithObjects:@50, nil];
dataLabels.distance = @10;
series1.dataLabels = [NSArray arrayWithObjects:dataLabels, nil];
series1.keys = @[@"from", @"to", @"weight"];
series1.data = [NSArray arrayWithObjects:
@[@"1111", @"SSSS", @1005],
@[@"2222", @"SSSS", @121],
@[@"3333", @"SSSS", @520],
@[@"SSSS", @"4444", @540],
@[@"SSSS", @"5555", @5540],
nil];
options.series = @[series1];
chartView.options = options;
[self.view addSubview:chartView];
3 weeks passed, but no reply so far ... :(
Can someone of the responsible at least confirm that this is a bug in the underlying framework? Thanks.
Hello @skuske, we are so sorry for the inconvenience. We will investigate the problem as soon as possible and let you know.
It's a problem with the library. Related tickets:
- https://github.com/highcharts/highcharts/issues/16681 - It's necessary to set
textPath.attributes.dyoption to align them. That shouldn't be necessary, setting simpledistanceshould be enough. - https://github.com/highcharts/highcharts/issues/14029 - that one is a problem because wrapper can not use
dyanddx. Those two attributes are not described in the library, thus the wrapper does not have access to change it.
@ihnatmoisieiev - could you provide a simple example of how to change this option in the wrapper in runtime (load event)?
@skuske we have prepared a workaround for you, please:
- Remove all
series1.dataLabelsconfigurations; - Add the following code to your config:
HIChart *chart = [[HIChart alloc] init];
chart.events = [[HIEvents alloc] init];
chart.events.load = [[HIFunction alloc] initWithJSFunction:@"function() { this.series[0].update({ dataLabels: [{ enabled: true, color: '#333', distance: 10, textPath: { enabled: true, attributes: { dy: 5 } } }] }); }"];
options.chart = chart;
Please let us know if it works for you.
@ihnatmoisieiev
That works! Many thanks!