ERPNext Foundation ERPNext Cloud Chat Blog Discuss Frappé* Donate

How to create dashboard in ERPNext

custom_script
frappe
dashboard

#1

I searched so much on internet and find of ways of creating dashboard in ERPNext. Actually I want to design a dashboard like this one

I followed so many wasy to accomplish this task but don’t succeed. For example I create page and then follow toturials like this one.
-> https://www.youtube.com/watch?v=PxxIYdwT8dw
-> https://frappe.io/charts
-> https://developers.google.com/chart/interactive/docs/gallery

But I am not succeeded till this time. It will be very appreciable for me if you help me in creating dashbard in erpnext.


#2

Have you looked into creating a Page and then putting your code there?


#3

use metabase to create dashboard, Simple BI tool for data visualization.


#4

By this this concept
https://www.youtube.com/watch?v=PxxIYdwT8dw


#5

Yes, you can create dashboards by creating a Page in frappe and then adding the UI elements like charts, etc to your page.

There are existing pages in ERPNext which you can check out if your interested. The source code for the pages are also available in the app folder. :slight_smile:


#6

Yes @littlehera I followed this way as I shared a YouTube link in my question. If you have other useful links kindly share with me.
Actually I am facing the issue that when I write a code for chart, it is not displaying on page. I tried so many ways and many links on internet but failed to draw the chart. Please help me here. It will be very appreciable for me.


#7

You can check the Selling Module in ERPNext.

Go to apps/erpnext/erpnext/selling/page. You should be able to see sales_funnel and sales_analytics which are 2 pages involving graphs.


#8

Hello @sarmadmahmood969

What charts are you using for the page?


#9

Hello @sarmadmahmood969

I like your dashboard page and I want it, Could we work together?


#10

Hi @littlehera

I checked both these folders are there. sales_funnel folder having sales_funnel.css, sales_funnel.js, sales_funnel.json, sales_funnel.py and init.py files.

while sales_analytical having sales_analytical.js, sales_analytical.json and init.py files

any suggestion please…


#11

Hi @iRaySpace

I tried frappe.Chart and frappe.ui.grraph to create a charts.

1 way is this, I followed this link here:

frappe.pages['dash1'].on_page_load = function(wrapper) {
var page = frappe.ui.make_app_page({
parent: wrapper,
title: 'Dashboard',
single_column: true
});

page.add_menu_item('Projects', () => frappe.set_route('List', 'Project'))

new frappe.Chart("#chart", {
data: data,
type: 'bar',
height: 140,
colors: ['red']
});

data = {
labels: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
datasets: [{
				values: [18, 40, 30, 35, 8, 52, 17, -4]
			}]
}
}

The other one is that I tried:

frappe.pages['dash1'].on_page_load = function(wrapper) {
var page = frappe.ui.make_app_page({
parent: wrapper,
title: 'Dashboard',
single_column: true
});

console.log(page)

page.add_menu_item('Projects', () => frappe.set_route('List', 'Project'))

const graph = new frappe.ui.Graph({
height: 140,
parent: page.main,
mode: 'line',
x: {
	values: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul',
					'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
y: [{
	values: [23, 34, 23, 56, 83, 2, 92, 1, 90, 34, 67, 78]
}]
});
}

Any help please.


#12

Hi @vinhnguyent090

yes we can work together. You are welcome.


#13

I think you need to add the graph to an HTML element or <div> block in your page.

As for the files, you can try checking the .js files for the javascript code.


#14

Hi. Like @rk_root said, and also based on my experience, the EASIEST way is to use a BI tool (think Metabase if you’re going opensource). Create your dashboards there, publish them and embed them in a page (not Web Page) you’ve created in ERPNext. And voila! you get what you want.


#15

Thank @sarmadmahmood969 I sent email my contact. pls check thanks,


#16

I sent an email to you


#17

Hello @sarmadmahmood969

I believe you have to create a div with an id of “chart” as what @littlehera said.

// Create a div with an id of chart and attach it to the page
this.$chart = $('<div id="chart">').hide().appendTo(this.page.main);

// Create the charts
this.chart = new Chart(this.$chart[0], options);

// Show the charts since it is added as hidden
this.$chart.show();

Let us know what you have accomplished so far.


#18

can you tell me please on which page these lines have to be added


#19

hi, by using frappe charts you can make beautiful chart for your page and by adding some custom css
it works great. see my pages…


#20

Hi @Sahil

Can you please share how you create all this…