@@ -297,7 +297,7 @@ def add_layers_to_map(self):
297297 @iter_obj ('simple' )
298298 def simple_marker (self , location = None , popup = None ,
299299 marker_color = 'blue' , marker_icon = 'info-sign' ,
300- clustered_marker = False , icon_angle = 0 , width = 300 ):
300+ clustered_marker = False , icon_angle = 0 , popup_width = 300 ):
301301 """Create a simple stock Leaflet marker on the map, with optional
302302 popup text or Vincent visualization.
303303
@@ -309,7 +309,7 @@ def simple_marker(self, location=None, popup=None,
309309 Input text or visualization for object. Can pass either text,
310310 or a tuple of the form (Vincent object, 'vis_path.json')
311311 It is possible to adjust the width of text/HTML popups
312- using the optional keywords `width`. (Leaflet default is 300px.)
312+ using the optional keywords `popup_width` ( default is 300px).
313313 marker_color
314314 color of marker you want
315315 marker_icon
@@ -350,7 +350,7 @@ def simple_marker(self, location=None, popup=None,
350350 })
351351
352352 popup_out = self ._popup_render (popup = popup , mk_name = 'marker_' ,
353- count = count , width = width )
353+ count = count , width = popup_width )
354354 if clustered_marker :
355355 add_mark = 'clusteredmarkers.addLayer(marker_{0})' .format (count )
356356 name = 'cluster_markers'
@@ -376,6 +376,8 @@ def line(self, locations,
376376 popup: string or tuple, default 'Pop Text'
377377 Input text or visualization for object. Can pass either text,
378378 or a tuple of the form (Vincent object, 'vis_path.json')
379+ It is possible to adjust the width of text/HTML popups
380+ using the optional keywords `popup_width` (default is 300px).
379381
380382 Note: If the optional styles are omitted, they will not be included
381383 in the HTML output and will obtain the Leaflet defaults listed above.
@@ -457,7 +459,7 @@ def multiline(self, locations, line_color=None, line_opacity=None,
457459 @iter_obj ('circle' )
458460 def circle_marker (self , location = None , radius = 500 , popup = None ,
459461 line_color = 'black' , fill_color = 'black' ,
460- fill_opacity = 0.6 ):
462+ fill_opacity = 0.6 , popup_width = 300 ):
461463 """Create a simple circle marker on the map, with optional popup text
462464 or Vincent visualization.
463465
@@ -470,6 +472,8 @@ def circle_marker(self, location=None, radius=500, popup=None,
470472 popup: string or tuple, default 'Pop Text'
471473 Input text or visualization for object. Can pass either text,
472474 or a tuple of the form (Vincent object, 'vis_path.json')
475+ It is possible to adjust the width of text/HTML popups
476+ using the optional keywords `popup_width` (default is 300px).
473477 line_color: string, default black
474478 Line color. Can pass hex value here as well.
475479 fill_color: string, default black
@@ -501,7 +505,7 @@ def circle_marker(self, location=None, radius=500, popup=None,
501505 'fill_opacity' : fill_opacity })
502506
503507 popup_out = self ._popup_render (popup = popup , mk_name = 'circle_' ,
504- count = count )
508+ count = count , width = popup_width )
505509
506510 add_mark = 'map.addLayer(circle_{0})' .format (count )
507511
@@ -512,7 +516,8 @@ def circle_marker(self, location=None, radius=500, popup=None,
512516 @iter_obj ('polygon' )
513517 def polygon_marker (self , location = None , line_color = 'black' , line_opacity = 1 ,
514518 line_weight = 2 , fill_color = 'blue' , fill_opacity = 1 ,
515- num_sides = 4 , rotation = 0 , radius = 15 , popup = None ):
519+ num_sides = 4 , rotation = 0 , radius = 15 , popup = None ,
520+ popup_width = 300 ):
516521 """Custom markers using the Leaflet Data Vis Framework.
517522
518523
@@ -539,6 +544,8 @@ def polygon_marker(self, location=None, line_color='black', line_opacity=1,
539544 popup: string or tuple, default 'Pop Text'
540545 Input text or visualization for object. Can pass either text,
541546 or a tuple of the form (Vincent object, 'vis_path.json')
547+ It is possible to adjust the width of text/HTML popups
548+ using the optional keywords `popup_width` (default is 300px).
542549
543550 Returns
544551 -------
@@ -563,7 +570,7 @@ def polygon_marker(self, location=None, line_color='black', line_opacity=1,
563570 'radius' : radius })
564571
565572 popup_out = self ._popup_render (popup = popup , mk_name = 'polygon_' ,
566- count = count )
573+ count = count , width = popup_width )
567574
568575 add_mark = 'map.addLayer(polygon_{0})' .format (count )
569576
@@ -610,7 +617,7 @@ def click_for_marker(self, popup=None):
610617 self .template_vars .update ({'click_pop' : click_str })
611618
612619 def fit_bounds (self , bounds , padding_top_left = None ,
613- padding_bottom_right = None , padding = None , max_zoom = None ):
620+ padding_bottom_right = None , padding = None , max_zoom = None ):
614621 """Fit the map to contain a bounding box with the maximum zoom level possible.
615622
616623 Parameters
@@ -653,7 +660,6 @@ def fit_bounds(self, bounds, padding_top_left=None,
653660
654661 self .template_vars .update ({'fit_bounds' : fit_bounds_str })
655662
656-
657663 def _auto_bounds (self ):
658664 if 'fit_bounds' in self .template_vars :
659665 return
@@ -664,21 +670,19 @@ def _auto_bounds(self):
664670 # Make a comprehensive list of all the features we want to fit
665671 feat_str = ["{name}_{count}" .format (name = ft_name ,
666672 count = self .mark_cnt [ft_name ])
667- for ft_name in ft_names
668- for count in range (1 , self .mark_cnt [ft_name ]+ 1 )
669- ]
673+ for ft_name in ft_names for
674+ count in range (1 , self .mark_cnt [ft_name ]+ 1 )]
670675 feat_str = "[" + ', ' .join (feat_str ) + "]"
671676
672677 fit_bounds = self .env .get_template ('fit_bounds.js' )
673678 fit_bounds_str = fit_bounds .render ({
674679 'autobounds' : not self .location ,
675680 'features' : feat_str ,
676- 'fit_bounds_options' : json .dumps ({'padding' : [30 , 30 ]}),
681+ 'fit_bounds_options' : json .dumps ({'padding' : [30 , 30 ]}),
677682 })
678683
679684 self .template_vars .update ({'fit_bounds' : fit_bounds_str .strip ()})
680685
681-
682686 def _popup_render (self , popup = None , mk_name = None , count = None ,
683687 width = 300 ):
684688 """Popup renderer: either text or Vincent/Vega.
0 commit comments