{ "meta": { "version": "1.060.7322", "date": "Tue Jan 21 2020 14:53:11 GMT+0100 (heure normale d’Europe centrale)", "name": "csv-read-write", "description": "", "tags": [] }, "data": { "version": 1, "allow_edit": true, "plugins": [], "panes": [], "datasources": [ { "name": "csvFile", "type": "CSV_file_reader_plugin", "settings": { "name": "csvFile", "data_path": "CH4-short.csv", "content": "\"lat\",\"lng\",\"CH4\"\r\n48.876684, 2.175765, 1.94\r\n48.876684, 2.175765, 1.95\r\n48.876684, 2.175765, 1.92\r\n48.876705, 2.175806, 1.93\r\n48.876705, 2.175806, 1.99\r\n", "delimiter": "", "eol": "", "quote_char": "\"", "head": true, "skip_empty_lines": true, "dynamic_typing": true, "pluck": true, "embedding_object": false } }, { "name": "tableDisplay", "type": "JSON_formula_plugin", "settings": { "name": "tableDisplay", "autoStart": true, "explicitTrig": false, "json_var_formula": "var vals = _.unzip(_.values(datasources[\"csvFile\"]));\nvar keys = _.keys(datasources[\"csvFile\"]);\nvals.unshift(keys);\nreturn vals;\n" } }, { "name": "convertToCSV", "type": "JSON_formula_plugin", "settings": { "name": "convertToCSV", "autoStart": true, "explicitTrig": false, "json_var_formula": "\nvar keys = Object.keys(datasources[\"csvFile\"]); \nvar values = _.zip(..._.values(datasources[\"csvFile\"]));\n \nvar csv = Papa.unparse({\n\t\"fields\": keys,\n\t\"data\": values\n},\n{\n\tquotes: false, //or array of booleans\n\tquoteChar: '\"',\n\tescapeChar: '\"',\n\tdelimiter: \";\",\n\theader: true,\n\tnewline: \"\\r\\n\",\n\tskipEmptyLines: false, //or 'greedy',\n\tcolumns: null //or array of strings\n});\n\nreturn csv;" } }, { "name": "fileName", "type": "JSON_var_plugin", "settings": { "name": "fileName", "json_var": "{\"value\":\"export.csv\"}" } }, { "name": "saveFile", "type": "JSON_formula_plugin", "settings": { "name": "saveFile", "autoStart": false, "explicitTrig": true, "json_var_formula": "var data, filename, link;\n\t\t\nvar csv = datasources.convertToCSV;\nif (csv === null) return;\n\nfilename = datasources.fileName.value;\n\nif (!csv.match(/^data:text\\/csv/i)) {\n\tcsv = 'data:text/csv;charset=utf-8,' + csv;\n}\ndata = encodeURI(csv);\nlink = document.createElement('a');\nlink.setAttribute('href', data);\nlink.setAttribute('download', filename);\nlink.click();\n\nreturn true;" } } ], "columns": 3, "reIndexMap": [ 1, 4, 2, 0, 3 ], "noTopologicalSortAtSerialize": true }, "scaling": { "widthPx": 1348, "heightPx": 793, "scrollWidthPx": 1348, "scrollHeightPx": 793, "widthVw": 70.20833333333333, "heightVh": 72.1565059144677, "scrollWidthVw": 70.20833333333333, "scrollHeightVh": 72.1565059144677, "scalingMethod": "scaleTwh", "media": "large", "colDims": null }, "device": { "cols": { "valueRow": "none", "valueCol": "1", "maxCells": 0, "maxCols": 0, "classType": "" }, "droppers": {} }, "dashboard": { "flatUiButtonF": { "layout": { "top": "1.36488vh", "left": "2.08333vw", "height": "5.00455vh", "width": "8.02083vw", "minHeight": "50px", "minWidth": "55px", "z-index": "3" }, "container": { "id": "flatUiButtonF", "instanceId": "flatUiButtonF", "modelJsonId": "flatUiButton" }, "modelParameters": { "text": "Read CSV", "numberOfTriggers": 1, "fileInput": true, "binaryFileInput": false, "buttonFontSize": 0.5 }, "modelHiddenParams": {} }, "flatUiButtonX": { "layout": { "top": "1.36488vh", "left": "12.1354vw", "height": "5.00455vh", "width": "8.02083vw", "minHeight": "50px", "minWidth": "55px", "z-index": "4" }, "container": { "id": "flatUiButtonX", "instanceId": "flatUiButtonX", "modelJsonId": "flatUiButton" }, "modelParameters": { "text": "Save CSV", "numberOfTriggers": 1, "fileInput": false, "binaryFileInput": false, "buttonFontSize": 0.5 }, "modelHiddenParams": {} }, "flatUiTablec": { "layout": { "top": "13.1028vh", "left": "0.885417vw", "height": "44.313vh", "width": "66.9271vw", "minHeight": "79px", "minWidth": "88px", "z-index": "1" }, "container": { "id": "flatUiTablec", "instanceId": "flatUiTablec", "modelJsonId": "flatUiTable" }, "modelParameters": { "headerLine": true, "tableValueFontSize": 0.5, "striped": true, "bordered": true, "noBorder": false, "editableCols": "[]" }, "modelHiddenParams": { "value": null } }, "flatUiValueJ": { "layout": { "top": "1.22619vh", "left": "25.5208vw", "height": "5.00455vh", "width": "19.0104vw", "minHeight": "32px", "minWidth": "150px", "z-index": "2" }, "container": { "id": "flatUiValueJ", "instanceId": "flatUiValueJ", "modelJsonId": "flatUiValue" }, "modelParameters": { "label": "file name", "inheritLabelFromData": false, "displayLabel": true, "labelFontSize": 0.5, "valueWidthProportion": "70%", "validationButton": false, "validationOnFocusOut": true, "isNumber": false, "decimalDigits": 3, "valueFontSize": 0.5, "valueColor": "#34495e", "valueTextAlign": "left", "displayBorder": false }, "modelHiddenParams": { "value": "" } } }, "connections": { "flatUiButtonF": { "trigger1": { "name": "trigger1", "dataSource": "csvFile", "dataFields": [], "dataSourceIndex": 0 } }, "flatUiButtonX": { "trigger1": { "name": "trigger1", "dataSource": "saveFile", "dataFields": [], "dataSourceIndex": 4 } }, "flatUiTablec": { "value": { "name": "value", "dataSource": "tableDisplay", "dataFields": [], "dataSourceIndex": 1 } }, "flatUiValueJ": { "value": { "name": "value", "dataSource": "fileName", "dataFields": [ "value" ], "dataSourceIndex": 3 } } }, "exportOptions": "projectToTargetWindow", "checkExportOptions": false }