| 16 | === Notes === |
| 17 | - Voici comment procéder pour ajouter une donnée SpatialTemp (par ex. `cosmo1_t_500m`) sur un graphe du portail VIVA: |
| 18 | 1. dans le fichier [https://trac.crealp.ch/VIVA/browser/trunk/web/app/scripts/services/apiData.js services/apiData.js] |
| 19 | - on choisit la section qui correspond à la source de données (Users/Maya/MINERVE/resource) |
| 20 | - on ajoute la fonction |
| 21 | {{{ |
| 22 | #!div style="font-size:90%;width:60%;" |
| 23 | {{{ |
| 24 | var getWeatherStationsForecastData = function (product, stationId, refDate) { |
| 25 | return getAPIResponse('minerve/weather-stations/forecast/'+product+'/'+stationId+'/'+refDate); |
| 26 | }; |
| 27 | }}} |
| 28 | }}} |
| 29 | 2. dans le fichier [https://trac.crealp.ch/VIVA/browser/trunk/web/app/scripts/services/appData.js services/appData.js] |
| 30 | {{{ |
| 31 | #!div style="font-size:90%;width:60%;" |
| 32 | {{{ |
| 33 | this.loadMeteoStationData = function (station, callback) { |
| 34 | // [...] |
| 35 | |
| 36 | var prevC1Temp500m = apiData.getWeatherStationsForecastData(config.weatherProductId.cosmo1_t_500m, station.stationId, refDate).then(function (data) { |
| 37 | stationData.prevData.c1Temp500m = data; |
| 38 | }); |
| 39 | }}} |
| 40 | }}} |
| 41 | 3. dans le fichier [https://trac.crealp.ch/VIVA/browser/trunk/web/app/scripts/directives/graph.js directives/graph.js] |
| 42 | {{{ |
| 43 | #!div style="font-size:90%;width:60%;" |
| 44 | {{{ |
| 45 | // Spatial temperatures |
| 46 | if (scope.station.data.prevData.c1Temp500m.length > 0) { |
| 47 | highchart.addSeries(graphService.createSerie( |
| 48 | gettextCatalog.getString('portal_right_panel_tab_meteo_graph_temp_prev_c1_500m_serie_name'), |
| 49 | scope.station.data.prevData.c1Temp500m, |
| 50 | '#9900ff', |
| 51 | config.highchart.types.line, |
| 52 | 0, |
| 53 | false, |
| 54 | null, |
| 55 | appData.getDates().ref, |
| 56 | gettextCatalog.getString('portal_unit_c') |
| 57 | )); |
| 58 | } |
| 59 | }}} |
| 60 | }}} |
| 61 | |