i have created a doctype from an app and am trying to get started with charting. i am getting the error as in the screenshot.
@Vinob_chander_Ramasw This is really a very big hack. I would not recommend doing this.
What is your use case, maybe you can start sending in contributions
just playing around with charting !!
@Vinob_chander_Ramasw you can do the java script in the js file ,that will be better ,
and that error happen when you have error in the data in the template you use ,
in the html just use the empty div with id and complete your code in the javascript file
@Vinob_chander_Ramasw
use this
chart = new Chart({
parent : "#chart",
data: {
labels: [x,y,z],
datasets: [
{
values: [10,15,13]
}
]
},
title: "title",
type: 'pie',
height: 250,
colors: ['#d056e2', '#8a56e2','#56aee2','#ade255']
});
error in the data in the template
can u b exact…i am just using the sample date as given in the documentation site…
and if i put it in the js file,
is it new Chart or new frappe.Chart…and how does the js get the Chart API??
npm install and import {Chart} from …gives error
I try usingd documentation but i face the same problem. When i used that code without using react {} just like above example it worked
react ??
is it not,
npm install frappe-charts
import { Chart } from “frappe-charts”
@Vinob_chander_Ramasw you don’t need the react overhead.
Frappe Charts is already imported into the frappe environment/ ERPNext application (I think in desk.js, but I’m not sure and it doesn’t matter. It’s there. You can test this in the console with let chart = new Chart
… and see that it’s starting to autocomplete, at least in Chrome)
Here’s a discussion and some links on how to do it in either the dashboard or an HTML field: