Skip to content

"states: hover: lineWidthPlus" is not accepted as a passable parameter in .from_dict() or .from_js_literal() methods #211

Closed
@khetzke-etr

Description

@khetzke-etr

Describe the bug

I am trying to create a line chart where no lines are actually drawn between markers. It is important that I use a line chart to take advantage of splitting the tooltip. I want to modify the the "states" parameter of all lines in my plot so that lines are not drawn between markers on hover.

From the Highcharts API Reference, it would seem that I could just add 'states': {'hover': 'lineWidthPlus': 0}} to my chart-options-dictionary (see code below); but this does not appear to be acceptable.

I am able to pass 'states': {'hover': {'enabled': False}} from python and have the chart behave properly, but for some reason lineWidthPlus doesn't even render in the javascript returned from my_chart.to_js_literal() after creating my_chart from the options dictionary.

I suspect that there is some bug in the HighchartsOptions.from_dict() method that prevents this particular argument from being inserted into the chart-options.

To Reproduce

from highcharts_core.chart import Chart
from highcharts_core.options import HighchartsOptions

options_dict = {
    'chart': {
        'type': 'line',
        'width'  : 800,
        'height' : 550,
        },
    'xAxis': {
    'type': 'category',
    'min': 0,
    'categories': ['Entity1','Entity2'],
    'title': {'text': None}
    },
    'yAxis': {
        'title': {
            'text': "Value",
            },
        'labels': {
            'format': '{value}%',
            },
    },
    'series': [{'name': '2024',
                'data': [{'x': 'Entity1', 'y': 44.2132435},
                {'x': 'Entity2', 'y': 25.342593}],
                'visible': True,
                'marker': {'symbol': 'circle', 'radius': 6, 'fillColor': '#26437C'}},
                {'name': '2023',
                'data': [{'x': 'Entity1', 'y': 66.1241257},
                {'x': 'Entity2', 'y': 55.23646546}],
                'visible': True,
                'marker': {'symbol': 'circle', 'radius': 3, 'fillColor': '#EBA041'}}
                ],
    
    'title': {'text': "Example Chart"},
    'tooltip': {
        'formatter': """function() {
      tooltipHTML = `<b>${this.x}</b><br/>`
      return tooltipHTML}""",
        'split': True,
        'useHTML': True
    },
     'legend': {
        'enabled': True
    },
    'plotOptions': {
      'line': {
          'lineWidth': 0, 'enableMouseTracking': True, 
          'states': {'hover': {'enabled': True, 'lineWidthPlus': 0}}, # For some reason, the "lineWidthPlus" option does not get passed correctly and it is ignored by Highcharts
          'dataSorting': {'enabled': False, 'matchByName': False, 'sortKey': 'y'}, 'dataLabels': {'enabled': False},'zoneAxis': 'x'
          }
    }
}

options = HighchartsOptions.from_dict(options_dict)
my_chart = Chart.from_options(options)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions