equitablegrowth / Playfair

Web application for creating publication ready charts and graphs
http://www.austinclemens.com/Playfair/playfair.html
56 stars 6 forks source link

Loading Themes #266

Closed sergiospagnuolo closed 7 years ago

sergiospagnuolo commented 7 years ago

Hi, Austin, awesome tool you have here, man. Its pretty awesome.

I am having a very hard time loading templates into my playfair. I got some JSON parse errors, and, when I finally debugged everything (damn comma before the closing }), they just won't load. I am using AWS. The default theme works fine.

Do you have an example theme to see if my themes are made in the correct format?

Here is the link (I translated the whole thing into Portuguese).

http://ec2-54-207-49-199.sa-east-1.compute.amazonaws.com/playfair-volt/playfair.html#

This was a recurring issue

screen shot 2017-10-06 at 12 01 29 am

austinclemens commented 7 years ago

Looking into this now but I love that you translated everything into Portuguese - do you have a git repository for the translation?

sergiospagnuolo commented 7 years ago

Yes! I will surely make it public and will advertise it here (proper credits for you, of course) when everything is finished.

austinclemens commented 7 years ago

So because I'm just using the stock json commands it is very unforgiving. You can use an online json validator to look for errors in your json: https://jsonlint.com

I did that with your theme and you have 2 problems - valid json should not have commas before close brackets. ie don't do this:

"footer_rightpad": 40 , },

And second, valid json always needs a zero for decimal values, so instead of .5 as the value for a line width, use 0.5. That should fix your theme.

Also, one way to avoid this altogether is to create your theme interactively using the Settings menu within Playfair. If you change all those boxes to the values you want and then hit the 'save settings as theme' button it will create a valid JSON object that you can use.

This has also made me realize that it's not maybe very easy to create a translation of the settings. I'll have to think about that. Actually it's not very easy to create a translation of any part of Playfair given how I made it!

austinclemens commented 7 years ago

Here's a working version of your theme:

example.txt

sergiospagnuolo commented 7 years ago

Yeah, some parts I did not translate at all, especially the data recognition (date, numeric, text), Brazilians will have to go without it. I haven't translated the settings at all as well, will leave it like that.

sergiospagnuolo commented 7 years ago

It worked perfectly. That comma before closing was the grad. Tks so much, @austinclemens