function updateChart(type, period, rawData) {
        let scaledData;

        scaledData = getDefaultScale(rawData);

        if (type === 'net:rx' || type === 'net:tx') {
          scaledData = scaleData(rawData);
        }

        const { divisionScale, unit } = scaledData;

        const data = _.map(rawData.values, e => ({
          timestamp: e.timestamp * 1000, // unix to js timestamp
          value: e.value / divisionScale,
        }));
        if (data.length) {
          const chartData = {
            data,
            ymin: 0,
            xmin: getPeriodStart(period),
            xmax: new Date().getTime(),
            unit,
            margin: {
              top: 10, left: 55, bottom: 30, right: 10,
            },
            timeScale: getPeriodTimeScale(period),
          };
          if (type === 'mem:used' && self.vm.monitoringData && self.vm.monitoringData.mem
                    && self.vm.monitoringData.mem.total) {
            chartData.ymax = self.vm.monitoringData.mem.total.value;
          }
          self.chartData[type] = chartData;
        }
      }
// updates monitoring chart with given data from api
updates monitoring chart with given data from api
updates monitoring chart with given data from api
function updateChart(type, period, rawData) {
        let scaledData;
        scaledData = getDefaultScale(rawData);
        if (type === 'net:rx' || type === 'net:tx') {
          scaledData = scaleData(rawData);
        }
        const { divisionScale, unit } = scaledData;
        const data = _.map(rawData.values, e => ({
          timestamp: e.timestamp * 1000, 
          value: e.value / divisionScale,
        }));
        if (data.length) {
          const chartData = {
            data,
            ymin: 0,
            xmin: getPeriodStart(period),
            xmax: new Date().getTime(),
            unit,
            margin: {
              top: 10, left: 55, bottom: 30, right: 10,
            },
            timeScale: getPeriodTimeScale(period),
          };
          if (type === 'mem:used' && self.vm.monitoringData && self.vm.monitoringData.mem
                    && self.vm.monitoringData.mem.total) {
            chartData.ymax = self.vm.monitoringData.mem.total.value;
          }
          self.chartData[type] = chartData;
        }
      }
function updateChart ( type , period , rawData ) { let scaledData ; scaledData = getDefaultScale ( rawData ) ; if ( type === 'net:rx' || type === 'net:tx' ) { scaledData = scaleData ( rawData ) ; } const { divisionScale , unit } = scaledData ; const data = _ . map ( rawData . values , e => ( { timestamp : e . timestamp * 1000 , value : e . value / divisionScale , } ) ) ; if ( data . length ) { const chartData = { data , ymin : 0 , xmin : getPeriodStart ( period ) , xmax : new Date ( ) . getTime ( ) , unit , margin : { top : 10 , left : 55 , bottom : 30 , right : 10 , } , timeScale : getPeriodTimeScale ( period ) , } ; if ( type === 'mem:used' && self . vm . monitoringData && self . vm . monitoringData . mem && self . vm . monitoringData . mem . total ) { chartData . ymax = self . vm . monitoringData . mem . total . value ; } self . chartData [ type ] = chartData ; } }
updates monitoring chart with given data from api
updates monitoring chart with given data from api
// unix to js timestamp