class_docstr: Create a HeatMapWithTime layer
  
  Parameters
  ----------
  data: list of list of points of the form [lat, lng] or [lat, lng, weight]
      The points you want to plot. The outer list corresponds to the various time
      steps in sequential order. (weight is in (0, 1] range and defaults to 1 if
      not specified for a point)
  index: Index giving the label (or timestamp) of the elements of data. Should have
      the same length as data, or is replaced by a simple count if not specified.
  name : string, default None
      The name of the Layer, as it will appear in LayerControls.
  radius: default 15.
      The radius used around points for the heatmap.
  blur: default 0.8.
      Blur strength used for the heatmap. Must be between 0 and 1.
  min_opacity: default 0
      The minimum opacity for the heatmap.
  max_opacity: default 0.6
      The maximum opacity for the heatmap.
  scale_radius: default False
      Scale the radius of the points based on the zoom level.
  gradient: dict, default None
      Match point density values to colors. Color can be a name ('red'),
      RGB values ('rgb(255,0,0)') or a hex number ('#FF0000').
  use_local_extrema: default False
      Defines whether the heatmap uses a global extrema set found from the input data
      OR a local extrema (the maximum and minimum of the currently displayed view).
  auto_play: default False
      Automatically play the animation across time.
  display_index: default True
      Display the index (usually time) in the time control.
  index_steps: default 1
      Steps to take in the index dimension between animation steps.
  min_speed: default 0.1
      Minimum fps speed for animation.
  max_speed: default 10
      Maximum fps speed for animation.
  speed_step: default 0.1
      Step between different fps speeds on the speed slider.
  position: default 'bottomleft'
      Position string for the time slider. Format: 'bottom/top'+'left/right'.
  overlay : bool, default True
      Adds the layer as an optional overlay (True) or the base layer (False).
  control : bool, default True
      Whether the Layer will be included in LayerControls.
  show: bool, default True
      Whether the layer will be shown on opening.
class_docstr_tok: ["Create","a","HeatMapWithTime","layer","Parameters","--","--","--","--","--","data",":","list","of","list","of","points","of","the","form","[","lat",",","lng","]","or","[","lat",",","lng",",","weight","]","The","points","you","want","to","plot",".","The","outer","list","corresponds","to","the","various","time","steps","in","sequential","order",".","(","weight","is","in","(","0",",","1","]","range","and","defaults","to","1","if","not","specified","for","a","point",")","index",":","Index","giving","the","label","(","or","timestamp",")","of","the","elements","of","data",".","Should","have","the","same","length","as","data",",","or","is","replaced","by","a","simple","count","if","not","specified",".","name",":","string",",","default","None","The","name","of","the","Layer",",","as","it","will","appear","in","LayerControls",".","radius",":","default","15",".","The","radius","used","around","points","for","the","heatmap",".","blur",":","default","0.8",".","Blur","strength","used","for","the","heatmap",".","Must","be","between","0","and","1.","min_opacity",":","default","0","The","minimum","opacity","for","the","heatmap",".","max_opacity",":","default","0.6","The","maximum","opacity","for","the","heatmap",".","scale_radius",":","default","False","Scale","the","radius","of","the","points","based","on","the","zoom","level",".","gradient",":","dict",",","default","None","Match","point","density","values","to","colors",".","Color","can","be","a","name","(","'red","'",")",",","RGB","values","(","'rgb","(","255,0,0",")","'",")","or","a","hex","number","(","'","#","FF0000","'",")",".","use_local_extrema",":","default","False","Defines","whether","the","heatmap","uses","a","global","extrema","set","found","from","the","input","data","OR","a","local","extrema","(","the","maximum","and","minimum","of","the","currently","displayed","view",")",".","auto_play",":","default","False","Automatically","play","the","animation","across","time",".","display_index",":","default","True","Display","the","index","(","usually","time",")","in","the","time","control",".","index_steps",":","default","1","Steps","to","take","in","the","index","dimension","between","animation","steps",".","min_speed",":","default","0.1","Minimum","fps","speed","for","animation",".","max_speed",":","default","10","Maximum","fps","speed","for","animation",".","speed_step",":","default","0.1","Step","between","different","fps","speeds","on","the","speed","slider",".","position",":","default","'bottomleft'","Position","string","for","the","time","slider",".","Format",":","'bottom\/top'+'left\/right","'",".","overlay",":","bool",",","default","True","Adds","the","layer","as","an","optional","overlay","(","True",")","or","the","base","layer","(","False",")",".","control",":","bool",",","default","True","Whether","the","Layer","will","be","included","in","LayerControls",".","show",":","bool",",","default","True","Whether","the","layer","will","be","shown","on","opening","."]
code: def render(self, **kwargs):
      super().render(**kwargs)
  
      figure = self.get_root()
      assert isinstance(
          figure, Figure
      ), "You cannot render this Element if it is not in a Figure."
  
      figure.header.add_child(
          Element(
              """
              <script>
                  var TDHeatmap = L.TimeDimension.Layer.extend({
  
              initialize: function(data, options) {
                  var heatmapCfg = {
                      radius: 15,
                      blur: 0.8,
                      maxOpacity: 1.,
                      scaleRadius: false,
                      useLocalExtrema: false,
                      latField: 'lat',
                      lngField: 'lng',
                      valueField: 'count',
                      defaultWeight : 1,
                  };
                  heatmapCfg = $.extend({}, heatmapCfg, options.heatmapOptions || {});
                  var layer = new HeatmapOverlay(heatmapCfg);
                  L.TimeDimension.Layer.prototype.initialize.call(this, layer, options);
                  this._currentLoadedTime = 0;
                  this._currentTimeData = {
                      data: []
                      };
                  this.data= data;
                  this.defaultWeight = heatmapCfg.defaultWeight || 1;
              },
              onAdd: function(map) {
                  L.TimeDimension.Layer.prototype.onAdd.call(this, map);
                  map.addLayer(this._baseLayer);
                  if (this._timeDimension) {
                      this._getDataForTime(this._timeDimension.getCurrentTime());
                  }
              },
              _onNewTimeLoading: function(ev) {
                  this._getDataForTime(ev.time);
                  return;
              },
              isReady: function(time) {
                  return (this._currentLoadedTime == time);
              },
              _update: function() {
                  this._baseLayer.setData(this._currentTimeData);
                  return true;
              },
              _getDataForTime: function(time) {
                      delete this._currentTimeData.data;
                      this._currentTimeData.data = [];
                      var data = this.data[time-1];
                      for (var i = 0; i < data.length; i++) {
                          this._currentTimeData.data.push({
                                  lat: data[i][0],
                                  lng: data[i][1],
                                  count: data[i].length>2 ? data[i][2] : this.defaultWeight
                              });
                          }
                      this._currentLoadedTime = time;
                      if (this._timeDimension && time == this._timeDimension.getCurrentTime() && !this._timeDimension.isLoading()) {
                          this._update();
                      }
                      this.fire('timeload', {
                          time: time
                      });
                  }
          });
  
          L.Control.TimeDimensionCustom = L.Control.TimeDimension.extend({
              initialize: function(index, options) {
                  var playerOptions = {
                      buffer: 1,
                      minBufferReady: -1
                      };
                  options.playerOptions = $.extend({}, playerOptions, options.playerOptions || {});
                  L.Control.TimeDimension.prototype.initialize.call(this, options);
                  this.index = index;
                  },
              _getDisplayDateFormat: function(date){
                  return this.index[date.getTime()-1];
                  }
              });
              </script>
                  """,  # noqa
              template_name="timeControlScript",
          )
      )
  
file_path: folium/folium/plugins/heat_map_withtime.py
imports: from branca.element import Element, Figure
  from jinja2 import Template
  from folium.elements import JSCSSMixin
  from folium.map import Layer
  from folium.utilities import none_max, none_min
label_desc: Use image node_id 2 for calling the HeatMapWithTime obj's underlying member method code with example usage: obj.render() without return types