code: function getMetricStoriesLabelsToValuesMap(sampleArr, guidValueInfo) {
    const newDiagnostics = new Set();
    const metricToDiagnosticValuesMap = new Map();
    for (const elem of sampleArr) {
      let currentDiagnostic = guidValueInfo.
          get(elem.diagnostics.labels);
      if (currentDiagnostic === undefined) {
        continue;
      }
      if (currentDiagnostic !== 'number') {
        currentDiagnostic = currentDiagnostic[0];
      }
      newDiagnostics.add(currentDiagnostic);
  
      if (!metricToDiagnosticValuesMap.has(elem.name)) {
        const map = new Map();
        map.set(currentDiagnostic, [average(elem.sampleValues)]);
        metricToDiagnosticValuesMap.set(elem.name, map);
      } else {
        const map = metricToDiagnosticValuesMap.get(elem.name);
        if (map.has(currentDiagnostic)) {
          const array = map.get(currentDiagnostic);
          array.push(average(elem.sampleValues));
          map.set(currentDiagnostic, array);
          metricToDiagnosticValuesMap.set(elem.name, map);
        } else {
          map.set(currentDiagnostic, [average(elem.sampleValues)]);
          metricToDiagnosticValuesMap.set(elem.name, map);
        }
      }
    }
    return {
      labelNames: Array.from(newDiagnostics),
      mapLabelToValues: metricToDiagnosticValuesMap
    };
  }
docs: This function returns an object containing: all the names of labels plus a map like this: map: [metric_name] -> [map: [lable] -> sampleValue], where the lable is each name of all sub-labels and sampleValue is the average for a specific metric across stories with a specific label.