Bước tới nội dung

Bản mẫu:NPVIC chart/doc

Bách khoa toàn thư mở Wikipedia

This template creates a "stacked" timeline chart for the article National Popular Vote Interstate Compact, showing the contributions over time of individual member states to the NPVIC electoral vote total. It allows annotations of key events.

Use Bản mẫu:NPVIC chart/doc

This template has several named parameters used to set up the chart, and uses unnamed parameters to pass data (in {{item}} frames) to the sub-template {{NPVIC chart/bar}}, which creates the contents of the chart.

Chart parameters

Parameter groupParameterPurposeDefault value
Current status (mandatory)curr_totTotal number of electoral votes (EVs) currently controlled by NPVIC member states-
updatedDate of last update to the chart, in MM/DD/YYYY format-
Bar segments (as many as needed1)[unnamed]Defines an individual bar segment in the chart, using the {{item}} template
(See bar segment syntax below)
-
Display parameters (optional)widthWidth of the displayed table, in pixels750
heightHeight of the displayed table, in pixels (also determines font sizes)450
max_totMaximum number of EVs ever controlled by NPVIC member states
(Controls scale of vertical axis; use when EV total has decreased)
{{{curr_tot}}}
vert-intervalInterval of the vertical axis, in EVs25
year-intervalInterval of the horizontal axis, in years1
Annotations (optional, up to five2)note-date[n]Date of event-
note-text[n]Annotation text-
1.^The template currently supports up to 50 bar segments. If more are needed, the template must be edited to make additional calls to {{NPVIC chart/bar}}.
2.^Census events are automatically annotated and do not count towards the limit

Example

{{NPVIC chart| curr_tot = 165 | updated = 9/17/2017 <!--Mandatory parameters-->| size = 500 | max_tot = 165 | vert-interval = 25 | year-interval = 1 <!--Optional display parameters-->| note-date1 = 1/3/2006 | note-text1 = First<br/>legislative<br/>introduction <!--An annotation-->| {{item | ... }} <!--First bar segment (see syntax below) -->| {{item | ... }} <!--Second bar segment (see syntax below) -->| ...}}

Bar segment syntax

A bar segment represents a portion of the history of a particular state's participation in the compact, between two events at which the EV total changed:

  • The start event may be when the state joined the compact, when a previously-joined state left or rejoined the compact, or at a congressional reapportionment
  • The end event may be when the state left the compact, when a previously-joined state left or rejoined the compact, or at a congressional reapportionment

Most states will require multiple segments to span their history in the compact, if intervening events change the EV total. States which leave the compact must continue to be included, with an EV value of zero.

Each bar segment is created with a single unnamed argument, containing a call to the template {{item}} with the parameters outlined below.

Parameter groupParameterPurposeSample valueNotes
State1State (two letter abbreviation)MDMANDATORY: May be empty, but must be present
Electoral votes2Number of EVs controlled by the state10MANDATORY
3New total EVs of member states listed to this point10MANDATORY
old_totPrevious total EVs of member states listed to this point0MANDATORY for start events other than the given state joining the compact.
(Makes a continuous line over segments belonging to the same state)
Dates
(start or end date may be inferred from a signle date parameter as described below.)
startStart date of the segment (MM/DD/YYYY)04/10/2007At least one date parameter is needed; see below
endEnd date of the segment (MM/DD/YYYY)01/01/2011
censusYear of most recent census (YYYY)2000
Label adjustments (optional)x-offsetPosition offsets of the state label, as a percent of the chart width-1Use to avoid overlapping labels
y-offset0.5

Sample bar segment

| {{item | MD | 10 | 10 | old_tot = 0 | start = 04/10/2007 | end = 01/01/2011 | census = 2000 | x-offset = -1 | y-offset = 0.5}}

(Note that the bar segment comprises a single argument to the parent template)

Date parameters

Bar segments require at least one of the three date parameters. If either the start date or end date is not given, the bar segment will start or end at the previous or the following reapportionment date, respectively. If neither date is specified, a census year must be specified instead, and the segment will span between subsequent reapportionments.

The start and end dates of the segment are set as follows:

Inputs givenOutput
segment starts at:segment ends at:
"start" and "end"specified start datespecified end date
"start", but not "end"specified start datedate of the following reapportionment3
"end", but not "start"date of the previous reapportionment3specified end date
"census" onlydate of reapportionment for the specified year3date of the following reapportionment
3.^Reapportionment is considered to take place at the end of the census year.

Sub-templates Bản mẫu:NPVIC chart/doc

The following templates exist for use by this template, and should not be called outside this template.