Skip to content

BUG #68

@javipzv

Description

@javipzv

Describe the bug
The labelStyle and inputStyle properties in the rangeSelector configuration are parsed as strings instead of objects. When providing JSON-style objects (as is standard for other style properties in Highcharts), an error is thrown if the value is a string rather than a proper object. This is inconsistent with other style options throughout the library, which accept objects.

To Reproduce

  1. Configure a chart with the following rangeSelector:
RANGE_SELECTOR = {
    "label_style": {
      "display": "block"
    },
    "button_position": {
      "align": "center",
      "x": -153
    },
    "button_theme": {
      "fill": "#ccc",
      "style": {
        "fontFamily": "inherit",
        "fontSize": "12.5px"
      },
      "states": {
        "hover": {
          "fill": "#999",
          "style": {
            "color": "#000"
          }
        },
        "select": {
          "fill": "#FF4F2F",
          "style": {
            "color": "#fff"
          }
        }
      }
    },
    "input_style": {
      "fontFamily": "inherit",
      "fontSize": "14px",
      "color": "#6A6A6A"
    },
    "enabled": True,
    "all_buttons_enabled": True,
    "input_enabled": True,
    "buttons": [
      {
        "type": "month",
        "count": 6,
        "text": "6M",
        "title": "View 6 months"
      },
      {
        "type": "year",
        "count": 1,
        "text": "1Y",
        "title": "View 1 year"
      },
      {
        "type": "year",
        "count": 3,
        "text": "3Y",
        "title": "View 3 year"
      },
      {
        "type": "all",
        "text": "ALL",
        "title": "View all",
        "offsetMin": -86400000
      }
    ],
    "selected": 4
}
  1. Try to export it

Expected behavior
I would expect labelStyle and inputStyle to behave like other style options in Highcharts, i.e., to accept and correctly apply style objects provided in standard JavaScript object notation. This would make configuration more consistent and less error-prone, especially when chart options are generated or transformed by code.

Your Environment:

  • OS: Linux
  • Python Version: 3.10
  • Highcharts Stock: 1.7.0.

Additional context
The error is the following:
validator_collection.errors.CannotCoerceError: value ({'display': 'block'}) was not coerced to a string

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