function filterKeepSelectedMetrics (chartInfoKey) {
  return function _filterKeepSelectedMetrics (metricInstances, { chartInfo }) {
    const selectedMetrics = chartInfo[chartInfoKey] || []
    return metricInstances.filter(mi => selectedMetrics.includes(mi.metric))
  }
}
Filter metric names so that only metrics in the referenced list will be passed through

@param {string} the name of the key in which to find metric names to filter by (this will be read from chartInfo)

@return {function} a transform function