Skip to content

BUG: Silently ignoring distance property for data Labels in pie charts #209

Closed
@secastro

Description

@secastro

Describe the bug
While trying to reproduce the example in https://www.highcharts.com/demo/highcharts/pie-chart using Python Code, setting the distance property in dataLabels is ignored.

To Reproduce
This is a minimal piece of Python code to reproduce:

from highcharts_core.chart import Chart

chart0 = Chart.from_options(
    {'title': {'text': 'Pie chart'},
     'chart': {'type': 'pie'},
     'plotOptions': {'pie': {'dataLabels': {'enabled': True}},
                     'series': {
                         'dataLabels': [{'enabled': True, 'distance': 20},
                                        {'enabled': True, 'distance': -40, 'format': '{point.percentage:.1f}%' }]
                     }
                     },
     'series': [{'name': 'Random Data', 'colorByPoint': True, 'data': [{'name': 'X', 'y': 10000},
                                                                       {'name': 'Y', 'y': 20000},
                                                                       {'name': 'Z', 'y': 40000}] }]}
)

print([_ for _ in chart0.options.plot_options.series.data_labels])

[DataLabel(enabled = True),
 DataLabel(enabled = True, format = '{point.percentage:.1f}%')]

Also the exported chart in JSON format doesn't contain the 'distance' values

Expected behavior
Ideally, the 'distance' property is preserved in the chart, and included when exported. Otherwise, a warning about the property being excluded would be useful.

Your Environment:

  • OS: Mac OSX 14.7 Sonoma
  • Python Version: 3.11.5
  • Highcharts Core Version: 1.10.1

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions