{
  "meta": {
    "version": "4.000.9103",
    "fileFormatVersion": "0.4",
    "date": "2024-12-02T20:53:15.173Z",
    "name": "echarts-covid-comparison-js",
    "description": "Covid real-time dashboard using data from CSSE at Johns Hopkins University",
    "groupName": "JavaScript",
    "tags": [
      {
        "text": "Covid"
      },
      {
        "text": "ECharts"
      },
      {
        "text": "widgets"
      },
      {
        "text": "REST-API"
      },
      {
        "text": "CSV"
      },
      {
        "text": "Plots"
      }
    ],
    "schedulerLogOff": true
  },
  "data": {
    "datanodes": [
      {
        "name": "countries",
        "type": "JSON_formula_plugin",
        "settings": {
          "name": "countries",
          "autoStart": true,
          "explicitTrig": false,
          "json_var_formula": "var s = new Set();\n\nfor (var i=1; i < dataNodes[\"json\"][\"data\"].length - 1; i++) {\n\ts.add(dataNodes[\"json\"][\"data\"][i][1]);\n}\n\nreturn Array.from(s);"
        }
      },
      {
        "name": "country",
        "type": "JSON_var_plugin",
        "settings": {
          "name": "country",
          "json_var": "[\"France\"]"
        }
      },
      {
        "name": "countryData",
        "type": "JSON_formula_plugin",
        "settings": {
          "name": "countryData",
          "autoStart": true,
          "explicitTrig": false,
          "json_var_formula": "var countryData = {};\n_.each(dataNodes[\"json\"][\"data\"],(country)=> {\n    _.each(dataNodes[\"country\"], (selectedCountry)=> {\n        if (country[1] == selectedCountry ) {\n            countryData[selectedCountry] = [];\n            countryData[selectedCountry].push(country);\n        }\n    });\n});\n\nreturn countryData;"
        }
      },
      {
        "name": "countryForDisplay",
        "type": "JSON_formula_plugin",
        "settings": {
          "name": "countryForDisplay",
          "autoStart": true,
          "explicitTrig": false,
          "json_var_formula": "var length = dataNodes[\"json\"][\"data\"][0].length;\nvar header = dataNodes[\"json\"][\"data\"][0];\nvar countryData = {};\nvar time =  [];\nfor (var i=5; i < length; i ++) {\n\ttime.push(header[i]);\n}\n\nvar bCumulative =  dataNodes[\"cumulative\"];\n\nvar loopStart = 6;\nif (bCumulative) loopStart = 5;\n\n_.each(dataNodes[\"country\"], (selectedCountry)=> {\n    countryData[selectedCountry]=[];\n    for (var k=0; k < dataNodes[\"countryData\"][selectedCountry].length; k++) {\n        for (var i=loopStart; i < length; i++) {\n            if (bCumulative) \n            \tcountryData[selectedCountry].push(dataNodes[\"countryData\"][selectedCountry][k][i]);\n            else\n                countryData[selectedCountry].push((dataNodes[\"countryData\"][selectedCountry][k][i]-dataNodes[\"countryData\"][selectedCountry][k][i-1]));\n        }\n    }\n});\n\ncountryData[\"time\"] = time;\n\nreturn countryData;"
        }
      },
      {
        "name": "covid",
        "type": "REST_web-service_from_datasource",
        "settings": {
          "name": "covid",
          "url": "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series",
          "use_xproxy": true,
          "sampleTime": 0,
          "autoStart": true,
          "explicitTrig": false,
          "req_data_type": "JSON",
          "resp_data_type": "text",
          "method": "GET",
          "body": "return {\"urlAppend\": \"/\" +  dataNodes[\"dataset\"]  + \".csv\"};",
          "headers": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ],
          "proxyHash": "eyJBZGRyZXNzIjoiaHR0cHM6Ly9yYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tL0NTU0VHSVNhbmREYXRhL0NPVklELTE5L21hc3Rlci9jc3NlX2NvdmlkXzE5X2RhdGEvY3NzZV9jb3ZpZF8xOV90aW1lX3NlcmllcyIsIkhvc3QiOiJ4ZGFzaCJ9",
          "proxySig": "5TM10MtZYvnW/sf2ZrpNxn/fpTeOoUHXzV23CzlL95mni7uOrscQQSlcUagf1btXos2wf1ZA+eGBSZhc1/bPlk5lyaqX3oHfc4Sq0kUugOLuSZa8ZHH9jyGOBNVXZpzZLBXBrEJXDUTQjJP4Ff5kbos1NUPOwAegxsUNhkW2giUp+afVQxS22AfcoGM18x+R"
        }
      },
      {
        "name": "cumulative",
        "type": "JSON_var_plugin",
        "settings": {
          "name": "cumulative",
          "json_var": "true"
        }
      },
      {
        "name": "dataset",
        "type": "JSON_var_plugin",
        "settings": {
          "name": "dataset",
          "json_var": "\"time_series_covid19_deaths_global\""
        }
      },
      {
        "name": "datasets",
        "type": "JSON_var_plugin",
        "settings": {
          "name": "datasets",
          "json_var": "[\"time_series_covid19_confirmed_global\",\"time_series_covid19_deaths_global\",\"time_series_covid19_recovered_global\"]"
        }
      },
      {
        "name": "json",
        "type": "JSON_formula_plugin",
        "settings": {
          "name": "json",
          "autoStart": true,
          "explicitTrig": false,
          "json_var_formula": "return Papa.parse( dataNodes[\"covid\"].content,{\n\tdynamicTyping: true\n});"
        }
      },
      {
        "name": "option",
        "type": "JSON_formula_plugin",
        "settings": {
          "name": "option",
          "autoStart": true,
          "explicitTrig": false,
          "json_var_formula": "var series = [];\n\nvar yAxisName = '';\n\nif  (dataNodes[\"cumulative\"])\n\tyAxisName = 'cumulative number';\nelse\n    yAxisName = 'daily number';\n\nvar countries = [];\n\n_.each(dataNodes[\"country\"], (selectedCountry)=> {\n\tseries.push(        {\n            name: dataNodes[\"dataset\"] + ' for ' + selectedCountry, \n            type: 'line',\n            animation: false,\n            areaStyle: {},\n            lineStyle: {\n                width: 1\n            },\n            markArea: {\n                silent: true\n            },\n            data:  dataNodes[\"countryForDisplay\"][selectedCountry] \n        });\n    \n    countries.push(selectedCountry);\n}); \n\nvar option = {\n    title: {\n        text: 'Covid data for ' + countries,\n        subtext: 'CSSE at Johns Hopkins University',\n        left: 'center',\n        align: 'right'\n    },\n    grid: {\n        bottom: 80\n    },\n    toolbox: {\n        feature: {\n            dataZoom: {\n                yAxisIndex: 'none'\n            },\n            restore: {},\n            saveAsImage: {}\n        }\n    },\n    tooltip: {\n        trigger: 'axis',\n        axisPointer: {\n            type: 'cross',\n            animation: false,\n            label: {\n                backgroundColor: '#505765'\n            }\n        }\n    },\n    dataZoom: [\n        {\n            show: true,\n            realtime: true,\n            start: 80,\n            end: 100\n        },\n        {\n            type: 'inside',\n            realtime: true,\n            start: 80,\n            end: 100\n        }\n    ],\n    xAxis: [\n        {\n            type: 'category',\n            boundaryGap: false,\n            axisLine: {onZero: false},\n            data:  dataNodes[\"countryForDisplay\"][\"time\"] \n        }\n    ],\n    yAxis: [\n        {\n            name: yAxisName,\n            type: 'value',\n        }\n    ],\n    series: series\n};\n\nreturn option;\n"
        }
      },
      {
        "name": "source",
        "type": "JSON_var_plugin",
        "settings": {
          "name": "source",
          "json_var": "\"Data from CSSE at Johns Hopkins University at <a href=\\\"https://github.com/CSSEGISandData\\\">https://github.com/CSSEGISandData</a>\""
        }
      }
    ]
  },
  "libraries": {
    "pyodideStandard": [],
    "pyodideMicropip": []
  },
  "dashboard": {
    "echartsGenerich": {
      "layout": {
        "top": 87,
        "left": 345,
        "height": 484,
        "width": 913,
        "z-index": "5"
      },
      "container": {
        "instanceId": "echartsGenerich",
        "modelJsonId": "echartsGeneric"
      },
      "modelParameters": {
        "showWidget": true,
        "enableWidget": true
      },
      "modelHiddenParams": {
        "option": {
          "color": [
            "var(--widget-color-2)",
            "var(--widget-color-5)",
            "var(--widget-color-6)",
            "var(--widget-color-7)",
            "var(--widget-color-8)",
            "var(--widget-color-9)",
            "var(--widget-color-10)",
            "var(--widget-color-11)",
            "var(--widget-color-12)",
            "var(--widget-color-13)"
          ]
        },
        "selection": {}
      }
    },
    "annotationHtmlA": {
      "layout": {
        "top": 0,
        "left": 5,
        "height": 61,
        "width": 709,
        "z-index": "7"
      },
      "container": {
        "instanceId": "annotationHtmlA",
        "modelJsonId": "annotationHtml"
      },
      "modelParameters": {
        "fontsize": 0.3,
        "backgroundColor": "rgba(0, 0, 0, 0)",
        "textColor": "var(--widget-color)",
        "valueFontFamily": "var(--widget-font-family)",
        "textAlign": "left",
        "displayBorder": false,
        "centerVertically": true,
        "showWidget": true,
        "enableWidget": true
      },
      "modelHiddenParams": {
        "html": ""
      }
    },
    "flatUiListA": {
      "layout": {
        "top": 87,
        "left": 0,
        "height": 484,
        "width": 333,
        "z-index": "8"
      },
      "container": {
        "instanceId": "flatUiListA",
        "modelJsonId": "flatUiList"
      },
      "modelParameters": {
        "addControls": false,
        "listValueFontSize": 0.5,
        "listValueColor": "var(--widget-select-drop-text)",
        "listBackgroundColor": "var(--widget-select-drop-color)",
        "selectValueColor": "var(--widget-select-option-highlighted-text)",
        "selectValueBackgroundColor": "var(--widget-select-option-highlighted-color)",
        "valueFontFamily": "var(--widget-font-family)",
        "borderColor": "var(--widget-border-color)",
        "displayBorder": true,
        "maxSelected": "*",
        "borderWidth": "2px",
        "showWidget": true,
        "enableWidget": true
      },
      "modelHiddenParams": {
        "value": [],
        "selectedValue": ""
      }
    },
    "flatUiCheckboxA": {
      "layout": {
        "top": 41,
        "left": 730,
        "height": 38,
        "width": 192,
        "z-index": "9"
      },
      "container": {
        "instanceId": "flatUiCheckboxA",
        "modelJsonId": "flatUiCheckbox"
      },
      "modelParameters": {
        "label": "cumulative",
        "inheritLabelFromData": true,
        "displayLabel": true,
        "labelPosition": "right",
        "labelFontSize": 0.5,
        "labelColor": "var(--widget-label-color)",
        "labelFontFamily": "var(--widget-font-family)",
        "checkboxSize": 1,
        "checkedColor": "var(--widget-input-checked-color)",
        "uncheckedColor": "var(--widget-input-unchecked-color)",
        "showWidget": true,
        "enableWidget": true
      },
      "modelHiddenParams": {
        "value": false
      }
    },
    "flatUiSelectA": {
      "layout": {
        "top": 0,
        "left": 729,
        "height": 36,
        "width": 534,
        "z-index": "10"
      },
      "container": {
        "instanceId": "flatUiSelectA",
        "modelJsonId": "flatUiSelect"
      },
      "modelParameters": {
        "label": "dataset",
        "inheritLabelFromData": true,
        "displayLabel": true,
        "labelFontSize": 0.5,
        "labelColor": "var(--widget-label-color)",
        "labelFontFamily": "var(--widget-font-family)",
        "selectWidthProportion": "70%",
        "isNumber": false,
        "isBoolean": false,
        "selectValueFontFamily": "var(--widget-font-family)",
        "selectValueFontSize": 0.5,
        "selectedValueColor": "var(--widget-select-option-highlighted-text)",
        "selectedItemDefaultColor": "var(--widget-select-option-highlighted-color)",
        "selectedItemHoverColor": "var(--widget-select-option-highlighted-color)",
        "isKeyValuePairs": false,
        "showWidget": true,
        "enableWidget": true
      },
      "modelHiddenParams": {
        "keys": [],
        "values": [],
        "selectedValue": ""
      }
    }
  },
  "connections": {
    "echartsGenerich": {
      "option": {
        "name": "option",
        "dataFields": [],
        "dataNode": "option",
        "dataNodeIndex": 1
      }
    },
    "annotationHtmlA": {
      "html": {
        "name": "html",
        "dataNode": "source",
        "dataFields": []
      }
    },
    "flatUiListA": {
      "value": {
        "name": "value",
        "dataNode": "countries",
        "dataFields": []
      },
      "selectedValue": {
        "name": "selectedValue",
        "dataNode": "country",
        "dataFields": []
      }
    },
    "flatUiCheckboxA": {
      "value": {
        "name": "value",
        "dataNode": "cumulative",
        "dataFields": []
      }
    },
    "flatUiSelectA": {
      "keys": {
        "name": "keys",
        "dataNode": "datasets",
        "dataFields": []
      },
      "values": {
        "name": "values",
        "dataNode": "datasets",
        "dataFields": []
      },
      "selectedValue": {
        "name": "selectedValue",
        "dataNode": "dataset",
        "dataFields": []
      }
    }
  },
  "display": {
    "theme": "default",
    "backgroundColor": "var(--widget-color-0)",
    "inheritThemeBackgroundColor": true,
    "marginX": 10,
    "marginY": 10,
    "width": 1294,
    "height": 590,
    "enforceHeightLimit": false
  },
  "navBarNotification": false
}