code: func (p *Panel) SetTarget(t *Target) {
  	setTarget := func(t *Target, targets *[]Target) {
  		for i, target := range *targets {
  			if t.RefID == target.RefID {
  				(*targets)[i] = *t
  				return
  			}
  		}
  		(*targets) = append((*targets), *t)
  	}
  	switch p.OfType {
  	case GraphType:
  		setTarget(t, &p.GraphPanel.Targets)
  	case SinglestatType:
  		setTarget(t, &p.SinglestatPanel.Targets)
  	case TableType:
  		setTarget(t, &p.TablePanel.Targets)
  	}
  }
docs: // SetTarget updates a target if target with such refId exists
  // or creates a new one.