Get Free Trial
Get Free Trial

Google Chart Date Drill down repeating same bars

Answered
sudhasmsa asked on November 5, 2019

Hello,
 
We are using google charts with flexmonster integration. I am attaching a screenshot of what’s happening.
If you see the screen shot , I have `year/quarter/month/day` in row , when I drill down to quarters, months, days, for every drilldown step if you see the chart the same bars are repeated, which is seems to redundant. Is there is away to avoid that ? Could you please help us out ? 
 
BTW. Here is my prep function.
    private prepareDataFunction = (report, options) => {
        const output = {} as any;
        const table = [];
        const cAmount = report.meta ? report.meta.cAmount : 0;
        for (let i = 0; i < report.data.length; i++) {
            if (i === 0) {
                const xAxisName = (report.meta.r0Name !== undefined) ? report.meta.r0Name : ”;
                const headerRow = [xAxisName];
                table.push(headerRow);
            }
            const record = report.data[i];
            if (record.r0 === undefined && record.c0 !== undefined && record.v0 !== undefined) {
                let label = record.c0;
                for (let j = 1; j < cAmount; j++) {
                    label = record[`c${j}`] ? label + ` – ${record[`c${j}`]}` : label;
                }
                table[0].push(label);
            }
            if (record.r0 === undefined || record.c0 === undefined || record.v0 === undefined) {
                continue;
            }
            // tslint:disable: variable-name
            let _record = table[table.length – 1];
            if (record.r0 === _record[0]) {
                _record.push(record.v0);
            } else {
                _record = [record.r0];
                _record.push(record.v0);
                table.push(_record);
            }
        }
        output.data = table;
        output.options = {
            title: ”
        };
        return output;
    }

1 answer

Public
Vera Didenko Flexmonster November 6, 2019

Hello,
 
Thank you for reaching out to us and for providing your prepareDataFunction.
 
At the moment, there are some limitations regarding drill down when integrating with third party chart libraries.
 
We kindly suggest checking out Flexmonster’s built-in column chart as it seems to provide the desired behavior.
Here is a JSFiddle example for illustration: https://jsfiddle.net/flexmonster/8atfxgkn/
 
Please let us know if you have further questions.
 
Best Regards,
Vera

Please login or Register to Submit Answer