Page 1 of 1

Adding Charts in Frappe Page

Posted: Tue Mar 03, 2020 8:37 am
by aalfarran
in this topic I'm gonna show U the steps that I followed to add charts in frappe page so lets start.

STEP 1:
I Followed the instructions in this link https://medium.com/@alainber/adventures ... cf2c5c562b to understand the proper way to began with and understand how to build charts using Frappe Charts library.

STEP 2:
I take advantage of Ali's experience in building charts and from his code I used couple of lines, for more details:
To call the page using button and return some value from the button form to the chart page I used the following
code in button form.js

Code: Select all

frm.add_custom_button(__("Burn-Down Chart"), () => {
			window.location.href ="#burndownchart/"+frm.doc.project_name;
				});
The above code will call the chart page burndownchart and in the chart page use the
following code to take the value you need

Code: Select all

var projectName = frappe.get_route();
and in my case I want to get the project_name so I get it using the var projectName
just like this:

Code: Select all

console.log(projectName[1]);
That's it I hop you find this helpful and useful. :)