code: function() {
              var that = this;
  
              return api.execute("get:types")
              .then(function(types) {
                  return dialogs.fields(i18n.t("visualization.create.title"), {
                      "eventName": {
                          'label': i18n.t("visualization.create.fields.eventName"),
                          'type': "select",
                          'options': _.chain(types)
                          .map(function(type) {
                              return [type.type, type.type];
                          })
                          .object()
                          .value()
                      },
                      "type": {
                          'label': i18n.t("visualization.create.fields.type"),
                          'type': "select",
                          'options': _.chain(allVisualizations)
                          .map(function(visualization, vId) {
                              return [
                                  vId,
                                  visualization.title
                              ];
                          })
                          .object()
                          .value()
                      }
                  })
              })
              .then(function(data) {
                  that.report.visualizations.add(data);
  
                  return that.report.edit().fail(dialogs.error);
              });
          }
docs: Create a new visualization