Docs - Version 0.1.2

• Docs for Version 0.0.5
• Installation
• Initialization
• Themes
• Grid System
     • Row
     • Column
• Typography
• Images
• Links
• Dataframes
• Charts
     • Bar
     • Line
     • Spline
     • Area
     • Area Spline
     • Pie
     • Donut
     • Gauge
     • KPI





Installation

The most easiest method for installation of pieSparrow is through PyPi and pip

Use pip to install pieSparrow in your Python environment
$pip install piesparrow
as an alternate, you can download the complete package from GitHub


Initialization

Before composing anything, the html file needs to be initialize through initfunction.

Function
init(filename, title, basetheme, charttheme, icon)

Parameter Format Description
filename string name of HMTL file which will be generated
title string Title of HMTL page
basetheme string name of theme (light, dark) - Default light
charttheme string name of charts color theme (any name from themes) - Default sparrow_light
icon True/False Turn on or off the pieSparrow banding on top right of page - Default True
Example
import piesparrow as ps
ps.init(filename = 'helloWorld', title = 'My Hello World Page', basetheme = ps.light, charttheme =p s.sparrow_light, icon = True)

Themes

Color themes can be defined as piesparrow variable in the parameter ofinit(basetheme,charttheme)function.

Function
init(filename, title, basetheme, charttheme, icon)

basetheme charttheme
light rainbow_light
light sparrow_light
light virdis_light
light cividis_light
light gold_light
light sunflower_light
dark rainbow_dark
dark sparrow_dark
dark virdis_dark
dark cividis_dark
dark gold_dark
dark sunflower_dark

Grids

Grids are composed of rows and column, each row can contain a minimum of 1 and maximum of 5 columns. Unlimited number of rows can be added

Row

Row is a basic building component, each visual element that needs to be presented on the page must be contained with in a row, a row can have one or multiple columns but it is not mandatory to have a column to display data.

Function
row(content)

Parameter Format Description
content string/variable/function Contents that needs to be displayed.
Example
import piesparrow as ps
ps.row(ps.p('Hello World'))

Column

5 different type of columns can be called, colxs, colsm, colmd, collg, colxl

colxs occupies the width of 18%, colsmoccupies 36%, colmdoccupies 47%, collgoccupies 76% and colxloccupies 98% width.

Function
colxs(content, align, type)
colsm(content, align, type)
colmd(content, align, type)
collg(content, align, type)
colxl(content, align, type)

Parameter Format Description
content string/variable/function Contents that needs to be displayed.
align string Alignment of content inside column can be either 'left', 'right', 'center'. Default 'center'
type string Turn the shadow property on or off, use 'box' for no shadow and 'card' for shadow. Default 'box'
Example
import piesparrow as ps

ps.row(
 ps.colsm(
  type = 'card'
  align = 'left'
  content = ps.h1("Hello World !")
 )
)

Typography

Beside writing text without any function will result in text being displayed, four different heading sizes starting from h1(biggest) to h4(smallest) can be called. pcan be called for paragraph texts and boldcan be called for strong text.

Function
h1(txt)
h2(txt)
h3(txt)
h4(txt)
p(txt)
bold(txt)

Parameter Format Description
txt string/variabale/function content
Example
import piesparrow as ps

ps.row(
  ps.h1('This is H1 Text')
+ ps.h2('This is H2 Text')
+ ps.h3('This is H3 Text')
+ ps.h4('This is H4 Text')
+ ps.p('This is paragraph Text')
+ ps.bold('This is bold text')
+ ps.p('This is '+ps.bold('inline bold')+'text')
)

Images

Images can be displayed by calling img.

Function
img(path, height, width)

Parameter Format Description
path string image path
height integer height of image. Defaul 250
width integer width of image. Defaul 250
Example
import piesparrow as ps

ps.row(
  ps.img(path='images/logo.png', height=100, width-100)
)

Links

Links can be displayed by calling link.

Function
link(target,label)

Parameter Format Description
target string link target
label string label for link.
width integer width of image. Defaul 250
Example
import piesparrow as ps

ps.row(
  ps.link(target='https://piesparrow.com', label='home')
)

Datafames

Pandas data frames can be beautifully displaye by callingtable.

Function
table(df)

Parameter Format Description
df dataframe Pandas dataframe object
Example
import piesparrow as ps
import pandas as pd

data = pd.read_csv('mock_data.csv)
ps.row(
  ps.table(df='data')
)

Charts

Bar Chart

Bar Charts can be created by calling chartfunction and declaring type parameter as 'bar'

Function
chart(title, df, columns, xcolumn, xaxistype, type, datalabels, zoom, legend, legendposition, grid, xlabel, ylabel, height)

Parameter Format Description
title string unique name of chart
df dataframe Pandas dataframe
columns list List of all colums for which chart needs to be made
xcolumn string Name of column which needs to be placed at x axis.
xaxistype string Type of x-axis, Default 'category'. for non categorical axis leave blank
type string Type of chart, for bar chart use 'bar'.
datalabels string Turn on data labels for charts 'true'for on or'false'for off, Default'true'.
zoom string Turn on drag and zoom function for charts 'true'for on or'false'for off, Default'true'.
legend string Turn on legend for charts 'true'for on or'false'for off, Default'true'.
legendposition string Define legend position in charts 'bottom''right'or'inset', Default'bottom'.
grid string Turn on grids display for charts 'true'for on or'false'for off, Default'true'.
xlabel string Define label for x axis
ylabel string Define label for y axis
height integer Set height for chart. Default 500
Example
import piesparrow as ps
import pandas as pd

data = pd.read_csv('mock_data.csv)
ps.row(
  ps.chart(
  title = 'barchart1',
  df = data,
  columns = ['Months','Data 1'],
  xcolumn = 'Months',
  type = 'bar',
  )
)

Line Chart

Line Charts can be created by calling chartfunction and declaring type parameter as 'line'

Function
chart(title, df, columns, xcolumn, xaxistype, type, datalabels, zoom, legend, legendposition, grid, xlabel, ylabel, height)

Parameter Format Description
title string unique name of chart
df dataframe Pandas dataframe
columns list List of all colums for which chart needs to be made
xcolumn string Name of column which needs to be placed at x axis.
xaxistype string Type of x-axis, Default 'category'. for non categorical axis leave blank
type string Type of chart, for line chart use 'line'.
datalabels string Turn on data labels for charts 'true'for on or'false'for off, Default'true'.
zoom string Turn on drag and zoom function for charts 'true'for on or'false'for off, Default'true'.
legend string Turn on legend for charts 'true'for on or'false'for off, Default'true'.
legendposition string Define legend position in charts 'bottom''right'or'inset', Default'bottom'.
grid string Turn on grids display for charts 'true'for on or'false'for off, Default'true'.
xlabel string Define label for x axis
ylabel string Define label for y axis
height integer Set height for chart. Default 500
Example
import piesparrow as ps
import pandas as pd

data = pd.read_csv('mock_data.csv)
ps.row(
  ps.chart(
  title = 'linechart1',
  df = data,
  columns = ['Months','Data 1'],
  xcolumn = 'Months',
  type = 'line',
  )
)

Spline Chart

Spline Charts can be created by calling chartfunction and declaring type parameter as 'spline'

Function
chart(title, df, columns, xcolumn, xaxistype, type, datalabels, zoom, legend, legendposition, grid, xlabel, ylabel, height)

Parameter Format Description
title string unique name of chart
df dataframe Pandas dataframe
columns list List of all colums for which chart needs to be made
xcolumn string Name of column which needs to be placed at x axis.
xaxistype string Type of x-axis, Default 'category'. for non categorical axis leave blank
type string Type of chart, for spline chart use 'spline'.
datalabels string Turn on data labels for charts 'true'for on or'false'for off, Default'true'.
zoom string Turn on drag and zoom function for charts 'true'for on or'false'for off, Default'true'.
legend string Turn on legend for charts 'true'for on or'false'for off, Default'true'.
legendposition string Define legend position in charts 'bottom''right'or'inset', Default'bottom'.
grid string Turn on grids display for charts 'true'for on or'false'for off, Default'true'.
xlabel string Define label for x axis
ylabel string Define label for y axis
height integer Set height for chart. Default 500
Example
import piesparrow as ps
import pandas as pd

data = pd.read_csv('mock_data.csv)
ps.row(
  ps.chart(
  title = 'splinechart1',
  df = data,
  columns = ['Months','Data 1'],
  xcolumn = 'Months',
  type = 'spline',
  )
)

Area Chart

Area Charts can be created by calling chartfunction and declaring type parameter as 'area'

Function
chart(title, df, columns, xcolumn, xaxistype, type, datalabels, zoom, legend, legendposition, grid, xlabel, ylabel, height)

Parameter Format Description
title string unique name of chart
df dataframe Pandas dataframe
columns list List of all colums for which chart needs to be made
xcolumn string Name of column which needs to be placed at x axis.
xaxistype string Type of x-axis, Default 'category'. for non categorical axis leave blank
type string Type of chart, for area chart use 'area'.
datalabels string Turn on data labels for charts 'true'for on or'false'for off, Default'true'.
zoom string Turn on drag and zoom function for charts 'true'for on or'false'for off, Default'true'.
legend string Turn on legend for charts 'true'for on or'false'for off, Default'true'.
legendposition string Define legend position in charts 'bottom''right'or'inset', Default'bottom'.
grid string Turn on grids display for charts 'true'for on or'false'for off, Default'true'.
xlabel string Define label for x axis
ylabel string Define label for y axis
height integer Set height for chart. Default 500
Example
import piesparrow as ps
import pandas as pd

data = pd.read_csv('mock_data.csv)
ps.row(
  ps.chart(
  title = 'areachart1',
  df = data,
  columns = ['Months','Data 1'],
  xcolumn = 'Months',
  type = 'area',
  )
)

Area Spline Chart

Area Spline Charts can be created by calling chartfunction and declaring type parameter as 'area-spline'

Function
chart(title, df, columns, xcolumn, xaxistype, type, datalabels, zoom, legend, legendposition, grid, xlabel, ylabel, height)

Parameter Format Description
title string unique name of chart
df dataframe Pandas dataframe
columns list List of all colums for which chart needs to be made
xcolumn string Name of column which needs to be placed at x axis.
xaxistype string Type of x-axis, Default 'category'. for non categorical axis leave blank
type string Type of chart, for area spline chart use 'area-spline'.
datalabels string Turn on data labels for charts 'true'for on or'false'for off, Default'true'.
zoom string Turn on drag and zoom function for charts 'true'for on or'false'for off, Default'true'.
legend string Turn on legend for charts 'true'for on or'false'for off, Default'true'.
legendposition string Define legend position in charts 'bottom''right'or'inset', Default'bottom'.
grid string Turn on grids display for charts 'true'for on or'false'for off, Default'true'.
xlabel string Define label for x axis
ylabel string Define label for y axis
height integer Set height for chart. Default 500
Example
import piesparrow as ps
import pandas as pd

data = pd.read_csv('mock_data.csv)
ps.row(
  ps.chart(
  title = 'areasplinechart1',
  df = data,
  columns = ['Months','Data 1'],
  xcolumn = 'Months',
  type = 'area-spline',
  )
)

Pie Chart

Pie Charts can be created by calling piefunction.

Function
pie(title, df, columns, legend, legendposition, height)

Parameter Format Description
title string unique name of chart
df dataframe Pandas dataframe
columns list List of all colums for which chart needs to be made
legend string Turn on legend for charts 'true'for on or'false'for off, Default'true'.
legendposition string Define legend position in charts 'bottom''right'or'inset', Default'bottom'.
height integer Set height for chart. Default 500
Example
import piesparrow as ps
import pandas as pd

data = pd.read_csv('mock_data.csv')
ps.row(
  ps.pie(
  title = 'piechart1',
  df = data,
  columns = ['Data 1', 'Data 2', 'Data 3', 'Data 4'],
  )
)

Donut Chart

Donut Charts can be created by calling donutfunction.

Function
donut(title, df, columns, legend, legendposition, height)

Parameter Format Description
title string unique name of chart
df dataframe Pandas dataframe
columns list List of all colums for which chart needs to be made
legend string Turn on legend for charts 'true'for on or'false'for off, Default'true'.
legendposition string Define legend position in charts 'bottom''right'or'inset', Default'bottom'.
height integer Set height for chart. Default 500
Example
import piesparrow as ps
import pandas as pd

data = pd.read_csv('mock_data.csv)
ps.row(
  ps.donut(
  title = 'donutchart1',
  df = data,
  columns = ['Data 1', 'Data 2', 'Data 3', 'Data 4'],
  )
)

Gauge

Gauge can be created by calling gaugefunction.

Function
gauge(title, label, value, legend, legendposition,color, height)

Parameter Format Description
title string unique name of chart
label string Display label for gauge
value integer value for gauge
legend string Turn on legend for charts 'true'for on or'false'for off, Default'true'.
legendposition string Define legend position in charts 'bottom''right'or'inset', Default'bottom'.
color string Hex value of color
height integer Set height for chart. Default 500
Example
import piesparrow as ps
x = 60
ps.row(
  ps.gauge(
  title = 'gauge1',
  label = 'progress',
  value = x,
  color = '#127881'
)

KPI

KPI card can be created by calling kpifunction. It workby dispalying last row value in dataframe and difference of last and second last value as delta in positive or negative.

Function
kpi(df, column)

Parameter Format Description
df dataframe Pandas dataframe
column string Name of column
Example
import piesparrow as ps
import pandas as pd

data = pd.read_csv('mock_data.csv)
ps.row(
  ps.kpi(
  df = data,
  column = 'Data 1',
  )
)