class ChartComponent { constructor(parent, df) { this.parent = parent; this.df = df || {}; this.make(); } make() { this.wrapper = $(`
`).appendTo(this.parent); new SectionHead(this.wrapper, this.df); let chart_section = $(`
`).appendTo(this.wrapper); if (this.df.data) { if (this.df.type === 'mixed-bars') { let mixed_bar_section = $(`
`).appendTo( chart_section, ); for (let value of this.df.data.datasets[0].values) { var bar; if (value === undefined) { bar = `
`; } else if (value === 1) { bar = `
`; } else if (value === 0) { bar = `
`; } else { bar = `
`; } mixed_bar_section.append($(bar)); } } else { new jingrow.Chart(chart_section.get(0), { data: this.df.data, type: this.df.type, // or 'bar', 'line', 'scatter', 'pie', 'percentage' height: 250, colors: this.df.colors, }); } } else { chart_section.append(`
No data yet
`); } } }