Widgets.us.season.mlb.TopPlayers

us.season.mlb.topPlayers shows list of top players for selected category.

For the widget to render you need to provide seasonId.

To have specific stats for players, statType must be set

List of stat keys:

Hitting:

  • hitting_runs_batted_in (Hitting Runs Batted In)
  • hitting_batting_average (Hitting Batting Average)
  • hitting_slugging_percentage (Hitting Slugging Percentage)
  • hitting_on_base_percentage (Hitting On Base Percentage)
  • hitting_on_base_percentage_plus_slugging (Hitting On Base Percentage Plus Slugging)
  • hitting_hits (Hitting Hits)
  • hitting_doubles (Hitting Doubles)
  • hitting_triples (Hitting Triples)
  • hitting_home_runs (Hitting Home Runs)
  • hitting_at_bats (Hitting At Bats)
  • hitting_batting_average_on_balls_in_play (Hitting Batting Average On Balls In Play)
  • hitting_isolated_power (Hitting Isolated Power)
  • hitting_walks_per_strikeout (Hitting Walks Per Strikeouts)
  • hitting_at_bats_per_homerun (Hitting At Bats Per Homerun)
  • hitting_stolen_bases (Hitting Stolen Bases)
  • hitting_caught_stealing (Hitting Caught Stealing)
  • hitting_plate_appearances (Hitting Plate Appearance)
  • hitting_ground_out_to_fly_out_ratio (Hitting Ground Out To Fly Out Ratio)
  • hitting_ground_out_to_air_out_ratio (Hitting Ground Out To Fly Air Ratio)

Pitching:

  • pitching_overall_earned_run_average (Pitching Overall Earned Run Average)
  • pitching_overall_wins (Pitching Overall Wins)
  • pitching_overall_losses (Pitching Overall Losses)
  • pitching_overall_outs_pitched (Pitching Overall Outs Pitched)
  • pitching_overall_saves (Pitching Overall Saves)
  • pitching_overall_walks_plus_hits_per_innings_pitched (Pitching Overall Walks Plus Hits Per Innings Pitched)
  • pitching_overall_total_strikeouts (Pitching Overall Total Strikeouts)
  • pitching_overall_walks (Pitching Overall Walks)
  • pitching_overall_strikeouts_per_walk (Pitching Overall Strikeouts Per Walk)
  • pitching_overall_complete_games (Pitching Overall Complete Games)
  • pitching_overall_shutouts (Pitching Overall Shutouts)
  • pitching_overall_quality_starts (Pitching Overall Quality Starts)
  • pitching_overall_holds (Pitching Overall Holds)
  • pitching_overall_opponents_batting_average (Pitching Overall Opponents Batting Average)
  • pitching_overall_ground_out_to_fly_out_ratio (Pitching Overall Ground Out To Fly Out Ratio)
  • pitching_overall_ground_out_to_air_out_ratio (Pitching Overall Ground Out To Air Out Ratio)
  • pitching_overall_games_started (Pitching Overall Games Started)

new TopPlayers(props)

Parameters
Name Type Description
props object
Properties
Name Type Argument Default Description
seasonId number

Season id.

seasonType string <optional>
'regular'

Selected season type. Can be regular, playoffs.

conference string <optional>
'all'

Selected conference. Can be al, nl, all.

statType string <optional>
'hitting_runs_batted_in'

Selected stat. Can be hitting_runs_batted_in, hitting_batting_average, hitting_slugging_percentage, hitting_on_base_percentage, hitting_on_base_percentage_plus_slugging, hitting_extra_base_hits, hitting_hits, hitting_doubles, hitting_triples, hitting_home_runs, hitting_at_bats, hitting_batting_average_on_balls_in_play, hitting_isolated_power, hitting_walks_per_strikeout, hitting_at_bats_per_homerun, hitting_stolen_bases, hitting_caught_stealing, hitting_plate_appearances, hitting_ground_out_to_fly_out_ratio, pitching_overall_earned_run_average, pitching_overall_wins, pitching_overall_losses, pitching_overall_outs_pitched, pitching_overall_saves, pitching_overall_walks_plus_hits_per_innings_pitched, pitching_overall_total_strikeouts, pitching_overall_walks, pitching_overall_strikeouts_per_walk, pitching_overall_complete_games, pitching_overall_shutouts, pitching_overall_quality_starts, pitching_overall_holds, pitching_overall_opponents_batting_average, pitching_overall_ground_out_to_fly_out_ratio, pitching_overall_games_started.

disableDropdown boolean <optional>

If true hides dropdown.

disableHeader boolean <optional>

If true hides widget header.

showTitle boolean <optional>

If true turns dropdown to title.

hidePlayers boolean <optional>

If true hides player images.

playersLimit number <optional>
5

Limits list length.

qualifiesAsLeagueLeader boolean <optional>
true

If true enables statistical minimums to qualify a player for inclusion in a statistical category,

border boolean <optional>

If true enables a border around the widget.

onItemClick function <optional>

Function/event handler. Emits playerId on click or touch.

Examples

HTML/Declarative

<div class="sr-widget" data-sr-widget="us.season.mlb.topPlayers" data-sr-season-id="88607"></div>
<script type="application/javascript" src="https://widgets.media.sportradar.com/uscommon/widgetloader" data-sr-language="en_us" async></script>

JS/Programmatic

<script>
    (function(a,b,c,d,e,f,g,h,i){a[e]||(i=a[e]=function(){(a[e].q=a[e].q||[]).push(arguments)},i.l=1*new Date,i.o=f,
    g=b.createElement(c),h=b.getElementsByTagName(c)[0],g.async=1,g.src=d,g.setAttribute("n",e),h.parentNode.insertBefore(g,h)
    )})(window,document,"script","https://widgets.media.sportradar.com/uscommon/widgetloader","USW", {
        language: 'en_us'
    });
    USW('addWidget', '#sr-widget', 'us.season.mlb.topPlayers', {seasonId: 88607, statType: 'hitting_batting_average'});
</script>
<div id="sr-widget"></div>

JS/Example of using Event Handler

<script>
    (function(a,b,c,d,e,f,g,h,i){a[e]||(i=a[e]=function(){(a[e].q=a[e].q||[]).push(arguments)},i.l=1*new Date,i.o=f,
    g=b.createElement(c),h=b.getElementsByTagName(c)[0],g.async=1,g.src=d,g.setAttribute("n",e),h.parentNode.insertBefore(g,h)
    )})(window,document,"script","https://widgets.media.sportradar.com/uscommon/widgetloader","USW", {
        language: 'en_us'
    });
    USW('addWidget', '#sr-widget', 'us.season.mlb.topPlayers', {seasonId: 88607, conference: 'al', statType: 'pitching_overall_earned_run_average', onItemClick: function(type, obj){alert('playerId: ' + obj.playerId);}});
</script>
<div id="sr-widget"></div>