Use Charts

Line Chart

LineChart takes a list of of the data (numbers, will be the x axis), and a list of the lables:

chart_labels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
chart_data = [1.5, 2.3, 4.3, 2.2, 5.1, 6.5, 2.3, 2.3, 2.2, 1.1]
LineChart(chart_data, chart_labels)

You may put more than 1 series on the line chart:

LineChart({'series1': chart_data, 'series2': chart_data2}, chart_labels)

set show_area=True to fill the area of the chart, and set smooth=False to stop smoothing the line.

You may set the height in every type of chart.

class adminui.LineChart(data=[], labels=None, show_axis=True, show_line=True, show_area=False, smooth=True, height=300, line_color=None, area_color=None, columns=['x', 'y'], id=None)

Create a line chart

Parameters:
  • data – the data shown on the chart. It can be: a) an array like [2, 3, 4, 5] b) a dict of series, like { ‘series1’: [2, 3, 4, 5], ‘series2’: [6, 7, 8, 9] }
  • labels – labels corresponding to the data. Must be to the same length of the data e.g. [‘a’, ‘b’, ‘c’, ‘d’]
  • show_axis – True for displaying the x and y axis, labels and markers
  • show_line – False for hiding the line, if you wish to make a pure-area chart
  • show_area – True then the area below the line will be filled
  • smooth – True then the line will be smoothed out
  • height – the height of the chart
  • line_color – line color as a string if data is a list else an array of colors
  • area_color – area color as a string if data is a list else an array of colors

Bar Chart

Basic usage:

BarChart(chart_data, chart_labels)

Multiple bars will be put side-by-side. Stack them with stack=True:

BarChart({'series1': chart_data, 'series2': chart_data2}, chart_labels, stack=True),
class adminui.BarChart(data=[], labels=None, show_axis=True, height=300, color=None, columns=['x', 'y'], stack=False, id=None)

Create a bar chart

Parameters:
  • data – the data shown on the chart. It can be: a) an array like [2, 3, 4, 5] b) a dict of series, like { ‘series1’: [2, 3, 4, 5], ‘series2’: [6, 7, 8, 9] }
  • labels – labels corresponding to the data. Must be to the same length of the data e.g. [‘a’, ‘b’, ‘c’, ‘d’]
  • show_axis – True for displaying the x and y axis, labels and markers
  • height – the height of the chart
  • color – color as a string if data is a list else an array of colors

Pie Chart

Basic usage:

PieChart(chart_data, chart_labels)
class adminui.PieChart(data=[], labels=None, height=300, color=None, title=None, id=None)

Create a bar chart

Parameters:
  • data – the data shown on the chart. e.g. an array like [2, 3, 4, 5]
  • labels – labels corresponding to the data. Must be to the same length of the data e.g. [‘a’, ‘b’, ‘c’, ‘d’]
  • height – the height of the chart
  • title – the title of the chart

Scatter Plot

Scatter Plot takes x, y series, and optionally size and color (both can be a constant or an array of data):

ScatterPlot(list_of_x, list_of_y),
ScatterPlot(list_of_x, list_of_y, color=list_of_color_data, size=list_of_size_data),
class adminui.ScatterPlot(x=[], y=[], labels={'color': 'color', 'size': 'size', 'x': 'x', 'y': 'y'}, height=300, color=None, size=3, opacity=0.65, id=None)

Create a bar chart

Parameters:
  • x – data in the x axis e.g. an array like [2, 3, 4, 5]
  • y – data in the y axis
  • color
    1. color of the points; b) a series of data shown as the color e.g. [1, 2, 1, 2]
  • size
    1. (int) size of data points; b) a series of data as the size e.g. [1, 2, 3, 1, 2, 3]
  • labels – labels of the x, y axis
  • height – the height of the chart
  • opacity – the opacity of the data points

An example with chart is listed here: https://github.com/bigeyex/python-adminui/blob/master/python/example_chart.py https://github.com/bigeyex/python-adminui/blob/master/python/example_dash.py