Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for comma in last row of data #347

Open
vikjung opened this issue Jan 11, 2025 · 1 comment
Open

Allow for comma in last row of data #347

vikjung opened this issue Jan 11, 2025 · 1 comment

Comments

@vikjung
Copy link

vikjung commented Jan 11, 2025

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

@rslawik
Copy link
Contributor

rslawik commented Feb 2, 2025

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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants