.language


class: Language

class Language(**kwargs)[source]

Collection of configuration settings for UI strings that can be adapted for display in specific languages.

Note

The Language object is a global setting in Highcharts and it cannot be set on each chart initialization. Instead, it has to be set using (in JavaScript) Highcharts.setOptions(...) before any chart is initialized.

Class Inheritance
Inheritance diagram of Language

copy(other=None, overwrite=True, **kwargs)

Copy the configuration settings from this instance to the other instance.

Parameters:
  • other (HighchartsMeta) – The target instance to which the properties of this instance should be copied. If None, will create a new instance and populate it with properties copied from self. Defaults to None.

  • overwrite (bool) – if True, properties in other that are already set will be overwritten by their counterparts in self. Defaults to True.

  • kwargs – Additional keyword arguments. Some special descendents of HighchartsMeta may have special implementations of this method which rely on additional keyword arguments.

Returns:

A mutated version of other with new property values

classmethod from_dict(as_dict: dict, allow_snake_case: bool = True)

Construct an instance of the class from a dict object.

Parameters:
  • as_dict (dict) – A dict representation of the object.

  • allow_snake_case (bool) – If True, interprets snake_case keys as equivalent to camelCase keys. Defaults to True.

Returns:

A Python object representation of as_dict.

Return type:

HighchartsMeta

classmethod from_js_literal(as_str_or_file, allow_snake_case: bool = True, _break_loop_on_failure: bool = False)

Return a Python object representation of a Highcharts JavaScript object literal.

Parameters:
  • as_str_or_file (str) – The JavaScript object literal, represented either as a str or as a filename which contains the JS object literal.

  • allow_snake_case (bool) – If True, interprets snake_case keys as equivalent to camelCase keys. Defaults to True.

  • _break_loop_on_failure (bool) – If True, will break any looping operations in the event of a failure. Otherwise, will attempt to repair the failure. Defaults to False.

Returns:

A Python object representation of the Highcharts JavaScript object literal.

Return type:

HighchartsMeta

classmethod from_json(as_json_or_file, allow_snake_case: bool = True)

Construct an instance of the class from a JSON string.

Parameters:
  • as_json_or_file – The JSON string for the object or the filename of a file that contains the JSON string.

  • allow_snake_case (bool) – If True, interprets snake_case keys as equivalent to camelCase keys. Defaults to True.

Returns:

A Python objcet representation of as_json.

Return type:

HighchartsMeta

to_dict() dict

Generate a dict representation of the object compatible with the Highcharts JavaScript library.

Note

The dict representation has a property structure and naming convention that is intentionally consistent with the Highcharts JavaScript library. This is not Pythonic, but it makes managing the interplay between the two languages much, much simpler.

Returns:

A dict representation of the object.

Return type:

dict

to_js_literal(filename=None, encoding='utf-8') str | None

Return the object represented as a str containing the JavaScript object literal.

Parameters:
  • filename (Path-like) – The name of a file to which the JavaScript object literal should be persisted. Defaults to None

  • encoding (str) – The character encoding to apply to the resulting object. Defaults to 'utf-8'.

Return type:

str or None

to_json(filename=None, encoding='utf-8')

Generate a JSON string/byte string representation of the object compatible with the Highcharts JavaScript library.

Note

This method will either return a standard str or a bytes object depending on the JSON serialization library you are using. For example, if your environment has orjson, the result will be a bytes representation of the string.

Parameters:
  • filename (Path-like) – The name of a file to which the JSON string should be persisted. Defaults to None

  • encoding (str) – The character encoding to apply to the resulting object. Defaults to 'utf-8'.

Returns:

A JSON representation of the object compatible with the Highcharts library.

Return type:

str or bytes

static trim_dict(untrimmed: dict, to_json: bool = False) dict

Remove keys from untrimmed whose values are None and convert values that have .to_dict() methods.

Parameters:
  • untrimmed (dict) – The dict whose values may still be None or Python objects.

  • to_json (bool) – If True, will remove all keys from untrimmed that are not serializable to JSON. Defaults to False.

Returns:

Trimmed dict

Return type:

dict

static trim_iterable(untrimmed, to_json=False)

Convert any EnforcedNullType values in untrimmed to 'null'.

Parameters:
  • untrimmed (iterable) – The iterable whose members may still be None or Python objects.

  • to_json (bool) – If True, will remove all members from untrimmed that are not serializable to JSON. Defaults to False.

Return type:

iterable

property accessibility: AccessibilityLanguageOptions | None

Configuration of accessibility strings in the chart.

Note

Requires the accessibility module to be loaded.

For a description of the module and information on its features, see Accessibility.

Hint

For more dynamic control over the accessibility functionality, see Accessibility.point.description_formatter(), Accessibility.series.description_formatter(), and Accessibility.screen_reader_section.before_chart_formatter().

Returns:

Accessibility strings used in the chart.

Return type:

AccessibilityLanguageOptions or None

property context_button_title: str | None

The tooltip title for the context menu holding print and export menu items.

Defaults to 'Chart context menu'.

Return type:

str or None

property decimal_point: str | None

Decimal point used in (JavaScript) Highcharts.numberFormat. Defaults to ..

Return type:

str or None

property download_csv: str | None

Text for the context menu item that allows the user to download a CSV of the chart/data. Defaults to 'Download CSV'.

Return type:

str or None

property download_jpeg: str | None

Text for the context menu item that allows the user to download a JPEG of the chart/data. Defaults to 'Download JPEG'.

Return type:

str or None

property download_midi: str | None

New in version Highcharts: Core for Python v.1.1.0 / Highcharts Core (JS) v.11.0.0

Text for the context menu item that allows the user to download a MIDI of the chart/data. Defaults to 'Download MIDI'.

Return type:

str or None

property download_pdf: str | None

Text for the context menu item that allows the user to download a PDF of the chart/data. Defaults to 'Download PDF'.

Return type:

str or None

property download_png: str | None

Text for the context menu item that allows the user to download a PNG of the chart/data. Defaults to 'Download PNG'.

Return type:

str or None

property download_svg: str | None

Text for the context menu item that allows the user to download an SVG of the chart/data. Defaults to 'Download SVG'.

Return type:

str or None

property download_xls: str | None

Text for the context menu item that allows the user to download a Microsoft Excel file of the chart/data. Defaults to 'Download Excel'.

Return type:

str or None

property drillup_text: str | None

The text for the button that appears when drilling down, linking back to the parent series.

Note

The parent series’ name is inserted for {series.name}.

Defaults to None.

Return type:

str or None

property exit_fullscreen: str | None

The text for the menu item to exit the chart from full screen. Defaults to 'Exit from full screen'.

Return type:

str or None

property export_data: ExportDataLanguageOptions | None

Language strings used in the exported data table.

Return type:

ExportDataLanguageOptions or None

property hide_data: str | None

Text used for the hide data table menu item. Defaults to: 'Hide data table'.

Return type:

str or None

property invalid_date: str | None

Text to show in a date field for invalid dates. Defaults to '' (an empty string).

Return type:

str or None

property loading: str | None

The loading text that appears when the chart is set into the loading state following a (JavaScript) call to chart.showLoading(). Defaults to 'Loading...'.

Return type:

str

property main_breadcrumb: str | None

The root item in the breadcrums used when in drilldown mode. Defaults to 'Main'.

Return type:

str or None

property months: List[str] | None

An array containing the months names. Defaults to:

[
    "January",
    "February",
    "March",
    "April",
    "May",
    "June",
    "July",
    "August",
    "September",
    "October",
    "November",
    "December"
]

Note

Corresponds to the %B format string in (JavaScript) Highcharts.dateFormat().

Return type:

list of str, or None

property navigation: NavigationLanguageOptions | None

The Popup strings used in the chart.

Note

Requires the annotations.js or annotations-advanced.src.js module to be loaded.

Return type:

NavigationLanguageOptions or None

property no_data: str | None

The text to display when the chart contains no data. Defaults to 'No data to display'.

Return type:

str or None

property numeric_symbol_magnitude: int | None

The magnitude of replacements for Language.numeric_symbols() replacements. Defaults to 1000.

Hint

Use 10000 for Japanese, Korean and various Chinese locales, which use symbols for 10^4, 10^8 and 10^12.

Return type:

int

property numeric_symbols: List[str] | EnforcedNullType | None

Metric suffixes used to shorten high numbers in axis labels. Defaults to ["k", "M", "G", "T", "P", "E"].

Note

Replacing any of the positions with None or constants.EnforcedNullType causes the full number to be written. Setting Language.numeric_symbols() as a whole to None or constants.EnforcedNullType disables shortening altogether.

Return type:

list of str or EnforcedNullType, or EnforcedNullType, or None

property play_as_sound: str | None

New in version Highcharts: Core for Python v.1.1.0 / Highcharts Core (JS) v.11.0.0

Text for the context menu item that allows the user to play the chart/data as a sound. Defaults to 'Play as sound'.

Return type:

str or None

property print_chart: str | None

The text for the menu item to print the chart. Defaults to 'Print chart'.

Return type:

str or None

property reset_zoom: str | None

The text for the label of the button to reset the zoom when a chart is zoomed. Defaults to 'Reset zoom'.

Return type:

str or None

property reset_zoom_title: str | None

The text for the tooltip which appears above the button to reset the zoom when a chart is zoomed. Defaults to 'Reset zoom level 1:1'.

Return type:

str or None

property short_months: List[str] | None

A collection containing the months names in abbreviated form. Defaults to:

[
  "Jan",
  "Feb",
  "Mar",
  "Apr",
  "May",
  "Jun",
  "Jul",
  "Aug",
  "Sep",
  "Oct",
  "Nov",
  "Dec"
]

Note

Corresponds to the %b format in (JavaScript) Highcharts.dateFormat().

Return type:

list of str, or None

property short_weekdays: List[str] | None

Short week days, starting Sunday.

If not specified, Highcharts uses the first three letters of the Language.weekdays() setting.

Return type:

list of str or None

property thousands_separator: str | None

The default thousands separator used in the (JavaScript) Highcharts.numberFormat() method unless otherwise specified in the function arguments.

Defaults to a single space character, which is recommended in ISO 31-0 and works across Anglo-American and continental European languages.

Return type:

str or None

property view_data: str | None

The text for the menu item to view the chart’s data table. Defaults to: 'View data table'

Return type:

str or None

property view_fullscreen: str | None

The text for the menu item to view the chart in fullscreen mode. Defaults to: 'View in full screen'.

Return type:

str or None

property weekdays: List[str] | None

An array containing the days of the week, starting with Sunday. Defaults to:

[
  "Sunday",
  "Monday",
  "Tuesday",
  "Wednesday",
  "Thursday",
  "Friday",
  "Saturday"
]
Return type:

list of str, or None

property zoom_in: str | None

The title that appears when hovering over the zoom in button. Defaults to '+'.

Return type:

str or None

property zoom_out: str | None

The title that appears when hovering over the zoom out button. Defaults to '-'.

Return type:

str or None


Sub-components

Module

Classes / Functions

.global_options.language

Language

.global_options.language.accessibility

AccessibilityLanguageOptions

.global_options.language.accessibility.announce_new_data

AnnounceNewDataLanguageOptions

.global_options.language.accessibility.axis

AxisLanguageOptions

.global_options.language.accessibility.chart_types

ChartTypesLanguageOptions

.global_options.language.accessibility.exporting

ExportingLanguageOptions

.global_options.language.accessibility.legend

LegendLanguageOptions

.global_options.language.accessibility.range_selector

RangeSelectorLanguageOptions

.global_options.language.accessibility.screen_reader_section

ScreenReaderSectionLanguageOptions ScreenReaderSectionAnnotationLanguage

.global_options.language.accessibility.series

SeriesLanguageOptions SeriesSummaryLanguageOptions SeriesTypeDescriptions

.global_options.language.accessibility.sonification

SonificationLanguageOptions

.global_options.language.accessibility.table

TableLanguageOptions

.global_options.language.accessibility.zoom

ZoomLanguageOptions

.global_options.language.export_data

ExportDataLanguageOptions

.global_options.language.navigation

NavigationLanguageOptions PopupLanguageOptions