View Source Tremorx.Components.BarChart (tremorx v0.1.0)
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 to640
.height
(:integer
) - The height of the chart. The chart will be resized to fit the availabe height before rendering. Defaults to320
.margin_top
(:integer
) - The top margin of the chart. Applied to the y axis range. Defaults to20
.margin_right
(:integer
) - The right margin of the chart. Applied to the x axis range. Defaults to20
.margin_bottom
(:integer
) - The bottom margin of the chart. Applied to the y axis range. Defaults to30
.margin_left
(:integer
) - The left margin of the chart. Applied to the x axis range. Defaults to50
.x_axis_margin
(:integer
) - The margin between x axis labels and the x axis line. Defaults to20
.y_axis_width
(:integer
) - The width of the y axis labels. Defaults to60
.x_axis_label
(:string
) - The label of the x axis. Defaults tonil
.y_axis_label
(:string
) - The label of the y axis. Defaults tonil
.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 to5
.x_axis_label_offset
(:integer
) - The offset of the x axis label. Defaults to32
.y_axis_label_offset
(:integer
) - The offset of the y axis label. Defaults to30
.x_axis_text_offset
(:integer
) - The y-offset of the x axis ticks from the x axis line. Defaults to16
.y_axis_text_offset
(:integer
) - The x-offset of the y axis ticks from the y axis line. Defaults to8
.legend_height
(:integer
) - The height of the legend. Defaults to44
.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 tonil
.- Global attributes are accepted.