Hi,
I created a page to display graphics,
I tried a basic js script but it gives an error in the console “frappe.chart is not a constructor”
Someone can take a look and point out the error in this.
Erpnext V8 version
Frappe V8 version
Code JS:
frappe.pages[‘prueba’].on_page_load = function(wrapper) {
var page = frappe.ui.make_app_page({
parent: wrapper,
title: ‘KPI gestion oportunidades’,
single_column: true
});
wrapper = $(wrapper).find('.layout-main-section');
wrapper.append(`
<div id="chart"></div>
`);
const chart_data = {
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
datasets: [
{
values:['0','10','20','30','40','50','60','70','50','40','30','20']
}
]
};
const graph = new frappe.chart({
parent: "#chart",
data: chart_data,
type: 'line'
});
setTimeout(function () {graph.refresh()}, 1);
}
Code HTML:
<div id="chart"