Shimoku docs
Search…
Creating reports page
On this page you will learn how to create in few lines of code:
To see how to initialize Shimoku check Quickstart
To use shimoku.plt it is convenient to start specifying the businessId you are addressing:
shimoku.plt.set_business(business_id)
Or if you do not have any business yet you can simply do:
business_name: str = 'my-new-business'
shimoku.plt.set_new_business(business_name)
To learn more about business check Managing Businesses
from os import getenv
import shimoku_api_python as Shimoku
access_token = getenv('SHIMOKU_TOKEN') # env var with your token
universe_id: str = getenv('UNIVERSE_ID') # your universe UUID
business_id: str = getenv('BUSINESS_ID') # a business UUID
shimoku = Shimoku.Client(
config={'access_token': access_token},
universe_id=universe_id,
)
shimoku.plt.set_business(business_id)
report: Dict = shimoku.plt.bar(
df, x='date', y=['billing'],
menu_path='catalog/bar-example',
order=0,
)

1. Bar chart

These are the mandatory fields to be introduced.
report: Dict = shimoku.plt.bar(
df, x='date', y=['billing'],
menu_path='catalog/bar-example',
order=0,
)
The menu_path says where, in the left menu, the chart is going to be created, in this case in Catalog > Bar example the URL is: https://www.shimoku.io/catalog/bar-exampleexists.
The order argument controls the position within the page catalog > bar example in which the app is going to be created. Additional control over position is obtained using the grid.
You can also pass a dictionary of further data called third_layer
third_layer: Dict = {
subtitle: 'Subtitle LineChart',
legend: True,
tooltip: True,
axisPointer: True,
toolbox: {
saveAsImage: True,
restore: True,
dataView: True,
dataZoom: True,
magicType: True,
},
xAxis: {
type: 'category',
},
yAxis: {
type: 'value',
},
dataZoom: True,
}
The report that returns allows you to further make changes in your bar chart and looks like:
report = {
'id': 'f74gh9', # report uuid
'owner': '38c7f', # user uuid
'appId': 'f74gh9', # suite uuid
'path': 'Predictions', # page name
'order': 0, #
'reportType': 'BARCHART',
'grid': '1, 1', # where the report is in the grid
'description': 'This is a description',
'createdAt': '2021-01-01',
'updatedAt '2021-09-24',
}
To make iterations over this component see Working with components

2. Line chart

These are the mandatory fields to be introduced.
report: Dict = shimoku.plt.line(
df, x='date', y=['billing'],
menu_path='catalog/line-example',
order=0,
)
The menu_path says where in the left menu the chart is going to be created in this case in Catalog > Line examplehttps://www.shimoku.io/catalog/line-example which will be accessible only by the users you specified. If the path doesn’t exist previously Shimoku would create it.
The order argument controls the position within the page catalog > line example in which the app is going to be created. Additional control over position is obtained using the grid.
You can also pass a dictionary of further data called third_layer
third_layer: Dict = {
subtitle: 'Subtitle LineChart',
legend: True,
tooltip: True,
axisPointer: True,
toolbox: {
saveAsImage: True,
restore: True,
dataView: True,
dataZoom: True,
magicType: True,
},
xAxis: {
type: 'category',
},
yAxis: {
type: 'value',
},
dataZoom: True,
}
The report that returns allows you to further make changes in your line chart and looks like:
report = {
'id': 'f74gh9', # report uuid
'owner': '38c7f', # user uuid
'appId': 'f74gh9', # suite uuid
'path': 'Predictions', # page name
'order': 0, #
'reportType': 'LINECHART',
'grid': '1, 1', # where the report is in the grid
'description': 'This is a description',
'createdAt': '2021-01-01',
'updatedAt '2021-09-24',
}
To make iterations over this component see Working with components

3. Stock line chart

These are the mandatory fields to be introduced.
report: Dict = shimoku.plt.line(
df, x='date', y=['billing'],
menu_path='catalog/stocklinechart-example',
order=0,
)
The menu_pathwhereinCatalog > Stocklinechart example the URL is: https://www.shimoku.io/catalog/stocklinechart-example which will be accessible only by the users you specified. If the path doesn’t exist previously Shimoku will create it.
The order argument controls the position within the page catalog > stocklinechart example in which the app is going to be created. Additional control over position is obtained using the grid.
You can also pass a dictionary of further data called third_layer
third_layer: Dict = {
subtitle: 'Subtitle LineChart',
legend: True,
tooltip: True,
axisPointer: True,
toolbox: {
saveAsImage: True,
restore: True,
dataView: True,
dataZoom: True,
magicType: True,
},
xAxis: {
type: 'category',
},
yAxis: {
type: 'value',
},
dataZoom: True,
}
The report that returns allows you to further make changes in your stock line chart and looks like:
report = {
'id': 'f74gh9', # report uuid
'owner': '38c7f', # user uuid
'appId': 'f74gh9', # suite uuid
'path': 'Predictions', # page name
'order': 0, #
'reportType': 'STOCKLINECHART',
'grid': '1, 1', # where the report is in the grid
'description': 'This is a description',
'createdAt': '2021-01-01',
'updatedAt '2021-09-24',
}
To make iterations over this component see Working with components
Copy link
On this page
1. Bar chart
2. Line chart
3. Stock line chart