google-chart icon indicating copy to clipboard operation
google-chart copied to clipboard

Allow for comma in last row of data

Open vikjung opened this issue 10 months ago • 1 comments

Process data with comma on the last row of data so dont have to do specific logic to identify last row for bar charts I am using it inside a lit component

data='[["Month", "Days"], ["Jan", 31],["Feb", 28]]' --- works data='[["Month", "Days"], ["Jan", 31],["Feb", 28],]' --- fails

vikjung avatar Jan 11 '25 23:01 vikjung

The component uses JSON.parse which does not accept trailing commas. Providing a custom parser would be fairly complex and could increase the code size significantly.

I am using it inside a lit component

In that case, the input can use a property binding and pass the array object without serialization.

<google-chart .data="${this.inputArray}"></google-chart>

rslawik avatar Feb 02 '25 20:02 rslawik