Hi Team,
Is there a way to use Chart and populate it with static data?
I mean, instead of using a Database, the data in the chart will be stored in a file like .csv for example.
Thank you!
Hi Team,
Is there a way to use Chart and populate it with static data?
I mean, instead of using a Database, the data in the chart will be stored in a file like .csv for example.
Thank you!
Hello Moustapha,
You can store the data into a json file, and use the json data source component as a source for the charts.
Or use a server action to upload the csv into a table then use it as a dynamic source.
Thanks for your replies @Teodor & @Hyperbytes.
I was referring to something like this: http://www.webassist.com/dreamweaver-extensions/dynamic-web-charts and it would be great to see this kind of features in Wappler…
Thank you!
Wappler has charting from dynamic data and database import from CSV which can then be used as a data source but .csv files cannot be used directly.
I believe that extension is based on outdated XML technology
You could use a bit of code to convert the csv to json then use that as a data source, it’s relatively easy to do
Thanks @Hyperbytes. Yeah, this is just in case there is no DB.
I will try to see with the csv to Json conversion.
In PHP
$file="myfile.csv";
$csv= file_get_contents($file);
$array = array_map("str_getcsv", explode("\n", $csv));
$json = json_encode($array);
Then just save the json file to wherever you want and use it as a data source
Thanks @Hyperbytes. Much appreciated!!!