OptChartFrappe Module

class epyk.core.html.options.OptChartFrappe.AxisOptions(component: HtmlModel, attrs: Optional[dict] = None, options: Optional[dict] = None, js_tree: Optional[dict] = None, page: Optional[PageModel] = None)
property xIsSeries

We can skip X labels by setting the xIsSeries property in axisOptions to true.

Related Pages:

class epyk.core.html.options.OptChartFrappe.BarOptions(component: HtmlModel, attrs: Optional[dict] = None, options: Optional[dict] = None, js_tree: Optional[dict] = None, page: Optional[PageModel] = None)
property spaceRatio

In order to set the bar width, instead of defining it and the space between the bars independently, we simply define the ratio of the space between bars to the bar width.

Related Pages:

property stacked

Renders multiple bar datasets in a stacked configuration, rather than the default adjacent.

Related Pages:

class epyk.core.html.options.OptChartFrappe.FrappeData(component: HtmlModel, attrs: Optional[dict] = None, options: Optional[dict] = None, js_tree: Optional[dict] = None, page: Optional[PageModel] = None)
add_data(data, name, kind)
Parameters:
  • data

  • name

  • kind

property labels
class epyk.core.html.options.OptChartFrappe.FrappeDataset(component: HtmlModel, attrs: Optional[dict] = None, options: Optional[dict] = None, js_tree: Optional[dict] = None, page: Optional[PageModel] = None)
property kind
property name
property values
class epyk.core.html.options.OptChartFrappe.FrappeLine(component: HtmlModel, attrs: Optional[dict] = None, options: Optional[dict] = None, js_tree: Optional[dict] = None, page: Optional[PageModel] = None)
add_marker(label, value)
Parameters:
  • label

  • value

add_region(label, start, end)
Parameters:
  • label

  • start

  • end

property animate

Enable or disable animation.

Related Pages:

property axisOptions

Related Pages:

https://frappe.io/charts/docs/basic/basic_chart

property barOptions

Can be used to set various properties on bar plot.

Related Pages:

property data

Contains an array of labels and an array of datasets, each a value for the 2-dimensional data points.

Related Pages:

property height

Set the height of the chart in pixels.

Related Pages:

property isNavigable

Makes the chart interactive with arrow keys and highlights the current active data point.

Related Pages:

property lineOptions

Can be used to set various properties on line plots, turn them into Area Charts and so on.

Related Pages:

property stacked

Renders multiple bar datasets in a stacked configuration, rather than the default adjacent.

Related Pages:

property title

Add a title to the Chart.

Related Pages:

property tooltipOptions

Frappe Charts are known for their awesome tooltips.

property truncateLegends

Sometimes long legends would overlap with neighboring legends, this option truncates it to a fixed length.

Related Pages:

property type

Let the chart know what type to render.

Related Pages:

property valuesOverPoints

To display data values over bars or dots in an axis graph.

Related Pages:

property xAxisMode

Display axis points as short ticks or long spanning lines.

Related Pages:

property xIsSeries

The X axis (often the time axis) is usually continuous.

Related Pages:

property yAxisMode

Display axis points as short ticks or long spanning lines.

Related Pages:

class epyk.core.html.options.OptChartFrappe.FrappeMarkers(component: HtmlModel, attrs: Optional[dict] = None, options: Optional[dict] = None, js_tree: Optional[dict] = None, page: Optional[PageModel] = None)
property label

//frappe.io/charts/docs/basic/annotations

Type:

https

property options

Can be used to set various properties on bar plot.

Related Pages:

property value

//frappe.io/charts/docs/basic/annotations

Type:

https

class epyk.core.html.options.OptChartFrappe.FrappeMarkersOptions(component: HtmlModel, attrs: Optional[dict] = None, options: Optional[dict] = None, js_tree: Optional[dict] = None, page: Optional[PageModel] = None)
property labelPos

//frappe.io/charts/docs/basic/annotations

Type:

https

class epyk.core.html.options.OptChartFrappe.FrappeRegions(component: HtmlModel, attrs: Optional[dict] = None, options: Optional[dict] = None, js_tree: Optional[dict] = None, page: Optional[PageModel] = None)
property end

//frappe.io/charts/docs/basic/annotations

Type:

https

property label

//frappe.io/charts/docs/basic/annotations

Type:

https

property options

Can be used to set various properties on bar plot.

Related Pages:

property start

//frappe.io/charts/docs/basic/annotations

Type:

https

class epyk.core.html.options.OptChartFrappe.FrappeTooltipOptions(component: HtmlModel, attrs: Optional[dict] = None, options: Optional[dict] = None, js_tree: Optional[dict] = None, page: Optional[PageModel] = None)
formatTooltipY(js_funcs, profile=None)

Usage:

l2.options.tooltipOptions.formatTooltipY(["return 'test: '+ value "])
Parameters:
  • js_funcs

  • profile

class epyk.core.html.options.OptChartFrappe.LineOptions(component: HtmlModel, attrs: Optional[dict] = None, options: Optional[dict] = None, js_tree: Optional[dict] = None, page: Optional[PageModel] = None)
property dotSize
property heatline

Related Pages:

https://frappe.io/charts/docs/basic/trends_regions

property hideDots

Related Pages:

https://frappe.io/charts/docs/basic/trends_regions

property regionFill

Related Pages:

https://frappe.io/charts/docs/basic/trends_regions

property spline

Related Pages:

https://frappe.io/charts/docs/basic/trends_regions

class epyk.core.html.options.OptChartFrappe.OptionFormatters(options: Options, name: str)
class epyk.core.html.options.Options(component: HtmlModel, attrs: Optional[dict] = None, options: Optional[dict] = None, js_tree: Optional[dict] = None, page: Optional[PageModel] = None)
property builder

Add a JavaScript Builder function to the options.

This will be used to automatically map the Python component to its corresponding JavaScript builder function used by the build method.

Usage:

but = page.ui.button()
but.options.builder = "Button"
Prop value:

The JavaScript builder function name.

property config_default

The default value for the configuration in case of template.

Default value is an empty string.

Usage:

component.options.config_default = {"value": "test"}
config_html()

Return the HTML options used by the python and passed to the HTML.

Those options will not be available in the JavaScript layer and they are only defined either to build the HTML from Python or to set some HTML properties.

The returned dictionary is a copy so it can be changed or used in other processes. To change the internal component property, the options property should be used.

config_js(attrs: Optional[dict] = None)

Return the JavaScript options used by the builders functions.

Builder functions can be defined in the framework or external from the various packages.

The returned dictionary is a copy so it can be changed or used in other processes. To change the internal component property, the options property should be used.

Parameters:

attrs – Optional. The extra or overridden options

custom_config(name: str, value: Any, js_type: bool = False)

Add a custom JavaScript configuration.

Usage:

chart = page.ui.charts.apex.scatter()
chart.options.chart.zoom.custom_config("test", False)
Parameters:
  • name – The key to be added to the attributes

  • value – String or JString. The value of the defined attributes

  • js_type – Optional. Specify if the parameter is a JavaScript fragment

details()

Retrieve the defined properties details.

This function will return a dictionary with all the component attributes (required and optional) ones. It will provide the full available description of those components.

Usage:

but = page.ui.button()
pprint.pprint(but.options.details(), indent=4)
from_json(vals: dict, schema: Optional[dict] = None)

Load the option schema for a component from a json string.

TODO: add more feature to handle functions and enumeration

Parameters:
  • vals – The input schema

  • schema – The full object schema

has_attribute(cls_obj, name: Optional[str] = None)

Add an extra sub layer to the data structure.

The key in the object representation will be the function name.

Parameters:
  • cls_obj – Class. The sub data class used in the structure definition

  • name – The sub attribute name

isJsContent(property_name: str)

Check if the content of a property is defined to always be a JavaScript fragment.

Thus the framework will not convert it to a Json content.

Usage:

div = page.ui.div()
print(div.options.isJsContent("inline"))
Parameters:

property_name – The property name

property managed

Boolean flag to set if the component needs to be added to the page.

If set to False the component has to be managed manually in the page.

Usage:

but = page.ui.button()
but.options.managed = False
Prop bool:

Flag to specify if this component is automatically managed by the page

optional()

Return all options not added to the HTML component by default.

Those are options which will impact either the Python or the JavaScript builders.

To get the full definition of options the details method should be used.

Usage:

but = page.ui.button()
pprint.pprint(but.options.optional(), indent=4)
property profile

Boolean flag to set if extra logs need to be displayed.

This could help in debugging, default is the page verbose flag (default is false).

Usage:

but = page.ui.button()
but.options.verbose = True
Prop flag:

Flag to display / hide warning logs generated by the framework.

required()

Return all the mandatory / required options with the default values.

Those options are added by the framework to provide a default for the HTML components but they can be changed.

System options are also added to this category as they are always available in any HTML components.

To get the full definition of options the details method should be used.

Usage:

but = page.ui.button()
pprint.pprint(but.options.required(), indent=4)
set_attrs(vals: dict)

Set the object internal attributes.

Parameters:

vals – All the attributes to be added to the component

property style

Change some CSS attributes to the internal HTML component.

Related Pages:

Prop values:

The CSS attributes.

update_config(attrs: dict)

Update the option configuration.

Parameters:

attrs – The attributes to set

property verbose

Boolean flag to set if extra logs need to be displayed.

This could help in debugging, default is the page verbose flag (default is false).

Usage:

but = page.ui.button()
but.options.verbose = True
Prop flag:

Boolean. Flag to display / hide warning logs generated by the framework.

class epyk.core.html.options.OptChartFrappe.OptionsChartSharedFrappe(component: HtmlModel, page: Optional[PageModel] = None)
x_format(js_funcs, profile=None)
Parameters:
  • js_funcs

  • profile

x_format_money(symbol='', digit=0, thousand_sep='.', decimal_sep=',', fmt='%v %s', factor=None, alias='')
Parameters:
  • symbol

  • digit

  • thousand_sep

  • decimal_sep

  • fmt

  • factor

  • alias

x_format_number(factor=1000, alias=None, digits=0, thousand_sep='.')
Parameters:
  • factor

  • alias

  • digits

  • thousand_sep

x_label(value)

Set the label of the x axis.

Not yet available.

Related Pages:

Parameters:

value – String. The axis label.

x_tick_count(num)
Parameters:

num

y_format(js_funcs, profile=None)
Parameters:
  • js_funcs

  • profile

y_format_money(symbol='', digit=0, thousand_sep='.', decimal_sep=',', fmt='%v %s', factor=None, alias='')
Parameters:
  • symbol

  • digit

  • thousand_sep

  • decimal_sep

  • fmt

  • factor

  • alias

y_format_number(factor=1000, alias=None, digits=0, thousand_sep='.')
Parameters:
  • factor

  • alias

  • digits

  • thousand_sep

y_label(value)

Set the label of the y axis.

Not yet available.

Related Pages:

Parameters:

value – String. The axis label.

y_tick_count(num)
Parameters:

num