code: @Override
      public Widget deserialize(JsonElement element, Type type, JsonDeserializationContext context)
          throws JsonParseException
      {
          JsonObject obj = element.getAsJsonObject();
          String visualization = obj.get("visualization").getAsString();
          if(visualization != null)
          {
              if(EventChart.Visualization.contains(visualization))
                  return gson.fromJson(obj, EventChart.class);
              else if(BreakdownMetricChart.Visualization.contains(visualization))
                  return gson.fromJson(obj, BreakdownMetricChart.class);
              else if(FacetChart.Visualization.contains(visualization))
                  return gson.fromJson(obj, FacetChart.class);
              else if(InventoryChart.Visualization.contains(visualization))
                  return gson.fromJson(obj, InventoryChart.class);
              else if(Markdown.Visualization.contains(visualization))
                  return gson.fromJson(obj, Markdown.class);
              else if(MetricLineChart.Visualization.contains(visualization))
                  return gson.fromJson(obj, MetricLineChart.class);
              else if(ThresholdEventChart.Visualization.contains(visualization))
                  return gson.fromJson(obj, ThresholdEventChart.class);
              else if(TrafficLightChart.Visualization.contains(visualization))
                  return gson.fromJson(obj, TrafficLightChart.class);
          }
          return null;
      }
docs: Gson invokes this call-back method during deserialization when it encounters a field of the specified type.
  @param element The Json data being deserialized
  @param type The type of the Object to deserialize to
  @param context The JSON deserialization context
  @return The widget