View Source Tremorx.Components.BarChart (tremorx v0.1.1)

Renders BarChart

Summary

Functions

Bar charts compare numerical values and use the length of each bar to represent the value of each variable.

Functions

Bar charts compare numerical values and use the length of each bar to represent the value of each variable.

Attributes

  • id (:string) - The id of the chart. Defaults to "barchart".
  • width (:integer) - The width of the chart. The chart will be resized to fit the available width before rendering. Defaults to 640.
  • height (:integer) - The height of the chart. The chart will be resized to fit the availabe height before rendering. Defaults to 320.
  • margin_top (:integer) - The top margin of the chart. Applied to the y axis range. Defaults to 20.
  • margin_right (:integer) - The right margin of the chart. Applied to the x axis range. Defaults to 20.
  • margin_bottom (:integer) - The bottom margin of the chart. Applied to the y axis range. Defaults to 30.
  • margin_left (:integer) - The left margin of the chart. Applied to the x axis range. Defaults to 50.
  • x_axis_margin (:integer) - The margin between x axis labels and the x axis line. Defaults to 20.
  • y_axis_width (:integer) - The width of the y axis labels. Defaults to 60.
  • x_axis_label (:string) - The label of the x axis. Defaults to nil.
  • y_axis_label (:string) - The label of the y axis. Defaults to nil.
  • y_axis_format (:string) - A format to apply to the y axis values. See d3-format for more information. Defaults to "(,.0f".
  • y_axis_ticks (:integer) - The minimum number of ticks on the y axis. Defaults to 5.
  • x_axis_label_offset (:integer) - The offset of the x axis label. Defaults to 32.
  • y_axis_label_offset (:integer) - The offset of the y axis label. Defaults to 30.
  • x_axis_text_offset (:integer) - The y-offset of the x axis ticks from the x axis line. Defaults to 16.
  • y_axis_text_offset (:integer) - The x-offset of the y axis ticks from the y axis line. Defaults to 8.
  • legend_height (:integer) - The height of the legend. Defaults to 44.
  • index (:string) (required) - The index of the data. This determines which value is used to create the x axis.
  • data (:list) (required) - The data to display on the chart.
  • categories (:list) (required) - The categories to display on the chart.
  • colors (:list) - The colors to use for each category. Defaults to [].
  • class (:string) - css classes to apply to the chart wrapper container. Defaults to nil.
  • Global attributes are accepted.