Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
khetzke-etr opened this issue Dec 13, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@khetzke-etr
Copy link

khetzke-etr commented Dec 13, 2024

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)
@khetzke-etr khetzke-etr added the bug Something isn't working label Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants