Chart

Attribute Type Documentation Default Value
Required id * :string

The ID used for the chart container

type :string

The type of chart to render. Defaults to “bar”.

Read more Read less
"bar"

Available types: bar, line, pie, scatter, radar

series :any

The series data for the chart. Structure depends on chart type:

Read more Read less

For bar/line charts:

  • A list of values: [10, 20, 30]
  • A list of maps with names: [%{name: “Series 1”, values: [10, 20, 30]}]
  • A list of series with different types: [%{name: “Bar”, type: “bar”, values: [10, 20, 30]}, %{name: “Line”, type: “line”, values: [5, 15, 25]}]
  • A list of time series: [%{name: “Series 1”, data: [[“2024-01-01”, 10], [“2024-01-02”, 20]]}]

For pie charts:

  • A list of maps with name and value: [%{name: “A”, value: 10}, %{name: “B”, value: 20}]

For scatter charts:

  • A list of [x, y] points: [[10, 20], [30, 40]]
  • A list of maps with series: [%{name: “Series 1”, data: [[10, 20], [30, 40]]}]
labels :list

Category labels for the x-axis (for bar/line charts) or data point names (for pie charts).

Read more Read less
[]

Example: [“Jan”, “Feb”, “Mar”]

title :string

Main title for the chart.

Read more Read less
subtitle :string

Subtitle shown below the main title.

Read more Read less
show_legend :boolean

Whether to show the chart legend.

Read more Read less
true
legend_position :string

Position of the legend. Options: “top”, “bottom”, “left”, “right”

Read more Read less
"top"
colors :list

Custom colors for data series.

Read more Read less
["var:noora-chart-primary", "var:noora-chart-secondary", "var:noora-chart-tertiary", "var:noora-chart-quaternary"]

The given items can either be a hex string, such as “#4C9AFF”, or a CSS variable, prefixed with var:, but omitting the -- prefix, such as chart-primary. The CSS variable is expected to be on the :root element, so the variable would be defined as such:

:root {
  --chart-primary: #4C9AFF;
}

In addition, the color setting supports the light-dark() function, which can be used to automatically resolve the appropriate color based on the the color scheme. That way, the variable can be defined as such:

:root {
  --chart-primary: light-dark(#4C9AFF, #36B37E);
}

Example: [“#4C9AFF”, “#36B37E”, “#FF5630”, “#FFAB00”, “#6554C0”]

stacked :boolean

For bar/line charts, whether series should be stacked.

Read more Read less
false
show_values :boolean

Whether to show data values directly on the chart.

Read more Read less
false
smooth :boolean

For line charts, whether to use smooth curves instead of straight lines.

Read more Read less
false
donut :boolean

For pie charts, whether to render as a donut chart.

Read more Read less
false
donut_radius :list

For donut charts, the inner and outer radius. Default: [“50%”, “70%”]

Read more Read less
["50%", "70%"]
x_axis_name :string

Name for the X axis. Example: “Month”

Read more Read less
y_axis_name :string

Name for the Y axis. Example: “Revenue ($)”

Read more Read less
x_axis_min :integer

Minimum value for the X axis. Example: 0

Read more Read less
x_axis_max :integer

Maximum value for the X axis. Example: 100

Read more Read less
y_axis_min :integer

Minimum value for the Y axis. Example: 0

Read more Read less
y_axis_max :integer

Maximum value for the Y axis. Example: 100

Read more Read less
grid_lines :boolean

Whether to show grid lines on the chart.

Read more Read less
true
horizontal :boolean

Whether to display a horizontal bar chart (with category axis on y-axis).

Read more Read less
false
bar_width :integer

Width of bars in bar charts (in pixels).

Read more Read less
bar_radius :integer

Border radius of bars in bar charts (in pixels).

Read more Read less
extra_options :map

Additional ECharts options for advanced customization.

Read more Read less
%{}

These will be deeply merged with options generated from other attributes.

rest :global

Additional HTML attributes to add to the container div