# Is the variable "width" not defined?

**URL:** https://discourse.processing.org/t/is-the-variable-width-not-defined/9083
**Category:** Libraries
**Created:** [March 7, 2019, 4:10pm UTC](https://discourse.processing.org/t/is-the-variable-width-not-defined/9083 "2019-03-07T16:10:05Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![kkxxbdm](https://avatars.discourse-cdn.com/v4/letter/k/b5a626/32.png) [@kkxxbdm](https://discourse.processing.org/u/kkxxbdm)
#### Post date: [March 7, 2019, 4:10pm UTC](https://discourse.processing.org/t/is-the-variable-width-not-defined/9083/1 "2019-03-07T16:10:06Z")

</div>

I’m reading this piece of code and somehow I’m confused. I can not find the definition of “width” anywhere…

```auto
////// MAIN INPUTS ///////
String directoryName = "${DIRECTORY_NAME}"; // directory name
String date = "${DATE}"; // today's date
String inputFile = "../data/output.csv"; // the main csv file which drives the animation
int totalFrames = ${TOTAL_FRAMES}; // the total number of frames, which is 3600
Location center = new Location(${AVG_LAT}, ${AVG_LON}); // the center location of the map
Integer zoom_start = 9; ///////////////////////////////////////////////////////////
String date_format = "M/d/yy";
String day_format = "EEEE"; ///////////////////////////////////////////////////////////
String time_format = "h:mm a";
boolean recording = ${RECORDING};
boolean HQ = false; ///////////////////////////////////////////////////////////
boolean rotateBearing = true; ///////////////////////////////////////////////////////////
//////////////////////////

// Import Unfolding Maps
import de.fhpotsdam.unfolding.*;
import de.fhpotsdam.unfolding.core.*;
import de.fhpotsdam.unfolding.data.*;
import de.fhpotsdam.unfolding.events.*;
import de.fhpotsdam.unfolding.geo.*;
import de.fhpotsdam.unfolding.interactions.*;
import de.fhpotsdam.unfolding.mapdisplay.*;
import de.fhpotsdam.unfolding.mapdisplay.shaders.*;
import de.fhpotsdam.unfolding.marker.*;
import de.fhpotsdam.unfolding.providers.*;
import de.fhpotsdam.unfolding.texture.*;
import de.fhpotsdam.unfolding.tiles.*;
import de.fhpotsdam.unfolding.ui.*;
import de.fhpotsdam.unfolding.utils.*;
import de.fhpotsdam.utils.*;

// Import some Java utilities
import java.util.Date;
import java.text.SimpleDateFormat;

// Import video export
import com.hamoid.*;
VideoExport videoExport;

// Declare Global Variables

UnfoldingMap map;

// Statistics input files (for stacked area chart)
String vehicleCountFile = "../data/vehicle_counts/vehicles_" + totalFrames + ".csv";
String busCountFile = "../data/vehicle_counts/buses_" + totalFrames + ".csv";
String tramCountFile = "../data/vehicle_counts/trams_" + totalFrames + ".csv";
String cablecarCountFile = "../data/vehicle_counts/cablecars_" + totalFrames + ".csv";
String metroCountFile = "../data/vehicle_counts/metros_" + totalFrames + ".csv";
String trainCountFile = "../data/vehicle_counts/trains_" + totalFrames + ".csv";
String ferryCountFile = "../data/vehicle_counts/ferries_" + totalFrames + ".csv";

int totalSeconds;
Table tripTable;

ArrayList<Trips> trips = new ArrayList<Trips>();
ArrayList<String> operators = new ArrayList<String>();
ArrayList<String> vehicle_types = new ArrayList<String>();
ArrayList<Float> bearings = new ArrayList<Float>();

Table vehicleCount;
IntList vehicleCounts; //////////////////////////////////////////////////////////////////
int maxVehicleCount;
float hscale = float(totalFrames) / float(width)*0.12;

```

---

<div class="post-metadata">

### Author: ![Schred](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/schred/32/13146_2.png) [@Schred](https://discourse.processing.org/u/Schred)
#### Post date: [March 7, 2019, 4:47pm UTC](https://discourse.processing.org/t/is-the-variable-width-not-defined/9083/2 "2019-03-07T16:47:10Z")

</div>

Usually, “width” is the actual width of the window you set with `size()`. I don’t know if that library you’re using changes this… 😅  
Could be that I just don’t understand what you’re asking for 😅 In that case, sorry xD

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [March 7, 2019, 4:56pm UTC](https://discourse.processing.org/t/is-the-variable-width-not-defined/9083/3 "2019-03-07T16:56:57Z")

</div>

width is pre-defined variable that is in-build with processing and does not have to be declared

It’s similar to mouseX, it’s just there

But you can only access it properly after size() by the way…

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [March 9, 2019, 9:43pm UTC](https://discourse.processing.org/t/is-the-variable-width-not-defined/9083/4 "2019-03-09T21:43:31Z")

</div>

If you find a variable or method that you don’t see defined, it is usually a built-in part of either Processing or Java.

Most built-in parts of Processing are listed in the reference – e.g. search the reference page for “width”:

[https://processing.org/reference/](https://processing.org/reference/)  
[https://processing.org/reference/width.html](https://processing.org/reference/width.html)
