highcharts-ios icon indicating copy to clipboard operation
highcharts-ios copied to clipboard

Dependency wheel label issue

Open skuske opened this issue 4 years ago • 5 comments

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 ...

depwheel

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];


skuske avatar Oct 27 '21 10:10 skuske

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.

skuske avatar Nov 19 '21 08:11 skuske

Hello @skuske, we are so sorry for the inconvenience. We will investigate the problem as soon as possible and let you know.

ihnatmoisieiev avatar Nov 19 '21 08:11 ihnatmoisieiev

It's a problem with the library. Related tickets:

  • https://github.com/highcharts/highcharts/issues/16681 - It's necessary to set textPath.attributes.dy option to align them. That shouldn't be necessary, setting simple distance should be enough.
  • https://github.com/highcharts/highcharts/issues/14029 - that one is a problem because wrapper can not use dy and dx. 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)?

pawelfus avatar Nov 19 '21 14:11 pawelfus

@skuske we have prepared a workaround for you, please:

  1. Remove all series1.dataLabels configurations;
  2. 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 avatar Nov 19 '21 15:11 ihnatmoisieiev

@ihnatmoisieiev

That works! Many thanks!

skuske avatar Nov 19 '21 16:11 skuske