New York City 311 helicopter noise complaints from Jan 2025 to Jan 2026, binned into 3-day intervals.

What is a line chart?

Line charts are used to display trends over time or continuous data, with values shown through the relative positions of points connected by lines. The x-axis typically represents a continuous variable, while the y-axis represents a numeric scale.

Data configurations

This section demonstrates how different data configurations can be used to create various types of line charts, including number field, date field, and split by field configurations.

With number field

With a number field (integer, double, etc.) on the x-axis, each number appears in the table only once, and the line chart connects the points in the order of the numbers.

Without numeric fields

When no numeric fields are specified, the chart will use the Count aggregation type, which totals the number of records for each unique value in the x-axis field.

The above chart visualizes the count of average SAT scores across the x-axis.

  1. Set the xAxisField property to "SAT_Score_Average", which is an integer field.
Charts component
30 collapsed lines
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>Esri Developer Guide: Line chart with number field</title>
<style>
html,
body,
arcgis-chart {
height: 100%;
margin: 0;
}
</style>
<!-- Load the ArcGIS Maps SDK for JavaScript from CDN -->
<script type="module" src="https://js.arcgis.com/5.1/"></script>
</head>
<body>
<arcgis-chart></arcgis-chart>
<script type="module">
const { createModel } = await $arcgis.import("@arcgis/charts-components/model/shared/setup-utils.js");
const FeatureLayer = await $arcgis.import("@arcgis/core/layers/FeatureLayer.js");
const featureLayer = new FeatureLayer({
portalItem: {
id: "fcf794778a4d486eb0ce863ab71d40db",
},
});
const chartElement = document.querySelector("arcgis-chart");
const lineChartModel = await createModel({ layer: featureLayer, chartType: "lineChart" });
lineChartModel.xAxisField = "SAT_Score_Average";
6 collapsed lines
chartElement.model = lineChartModel;
chartElement.actionMode = "none";
</script>
</body>
</html>

With numeric fields

If numeric fields are specified and an aggregation type is provided, the chart will apply the aggregation type to the numeric values for each unique value in the x-axis field.

The above chart visualizes the average tuition fee and earnings across the x-axis. It provides insights into how tuition fees and earnings vary with average SAT scores.

  1. Set the xAxisField property to "SAT_Score_Average", which is an integer field.
  2. Set the numericFields property to ["TUITIONFEE", "Earnings"] to specify the numeric fields.
  3. Set the aggregationType property to "avg" to calculate the average tuition fee and earnings for each unique average SAT score.
Charts component
30 collapsed lines
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>Esri Developer Guide: Line chart with numeric fields</title>
<style>
html,
body,
arcgis-chart {
height: 100%;
margin: 0;
}
</style>
<!-- Load the ArcGIS Maps SDK for JavaScript from CDN -->
<script type="module" src="https://js.arcgis.com/5.1/"></script>
</head>
<body>
<arcgis-chart></arcgis-chart>
<script type="module">
const { createModel } = await $arcgis.import("@arcgis/charts-components/model/shared/setup-utils.js");
const FeatureLayer = await $arcgis.import("@arcgis/core/layers/FeatureLayer.js");
const featureLayer = new FeatureLayer({
portalItem: {
id: "fcf794778a4d486eb0ce863ab71d40db",
},
});
const chartElement = document.querySelector("arcgis-chart");
const lineChartModel = await createModel({ layer: featureLayer, chartType: "lineChart" });
lineChartModel.xAxisField = "SAT_Score_Average";
lineChartModel.numericFields = ["TUITIONFEE", "Earnings"];
lineChartModel.aggregationType = "avg";
6 collapsed lines
chartElement.model = lineChartModel;
chartElement.actionMode = "none";
</script>
</body>
</html>

With date field

Temporal line charts visualize data over time, allowing trends and patterns to be easily identified.

The above chart visualizes NYC 311 helicopter noise complaints from Jan 2025 to Jan 2026, binned into 3-day intervals.

  1. Set the xAxisField property to "Created_Date" to specify the date field.
  2. Set the binTemporalData property to true to enable temporal binning.
  3. Set the temporalBinningSize property to 3 and the temporalBinningUnit property to "days" to group the date values into 3-day intervals.
Charts component
30 collapsed lines
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>Esri Developer Guide: Line chart with date field</title>
<style>
html,
body,
arcgis-chart {
height: 100%;
margin: 0;
}
</style>
<!-- Load the ArcGIS Maps SDK for JavaScript from CDN -->
<script type="module" src="https://js.arcgis.com/5.1/"></script>
</head>
<body>
<arcgis-chart></arcgis-chart>
<script type="module">
const { createModel } = await $arcgis.import("@arcgis/charts-components/model/shared/setup-utils.js");
const FeatureLayer = await $arcgis.import("@arcgis/core/layers/FeatureLayer.js");
const featureLayer = new FeatureLayer({
portalItem: {
id: "caea6a7ab4fe44b9b4ec3abb7314c1bb",
},
});
const chartElement = document.querySelector("arcgis-chart");
const lineChartModel = await createModel({ layer: featureLayer, chartType: "lineChart" });
lineChartModel.xAxisField = "Created_Date";
lineChartModel.binTemporalData = true;
lineChartModel.temporalBinningUnit = "days";
lineChartModel.temporalBinningSize = 3;
8 collapsed lines
lineChartModel.setAxisTitleText("Created Date", 0);
lineChartModel.titleText = "NYC 311 Helicopter Noise Complaints by 3-Day Period";
chartElement.model = lineChartModel;
chartElement.actionMode = "none";
</script>
</body>
</html>

With split by field

A split by line chart displays multiple lines to compare trends across different categories over time.

The above chart visualizes NYC 311 helicopter noise complaints from Jan 2025 to Jan 2026, binned into 3-day intervals and split by the “City” field to compare complaints across different cities.

  1. Set the xAxisField property to "Created_Date" to specify the date field.
  2. Set the binTemporalData property to true to enable temporal binning.
  3. Set the temporalBinningSize property to 3 and the temporalBinningUnit property to "days" to group the date values into 3-day intervals.
  4. Set the splitByField property to "City" to divide each main category into grouped lines for subcategory comparison.
Charts component
30 collapsed lines
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>Esri Developer Guide: Line chart with split by field</title>
<style>
html,
body,
arcgis-chart {
height: 100%;
margin: 0;
}
</style>
<!-- Load the ArcGIS Maps SDK for JavaScript from CDN -->
<script type="module" src="https://js.arcgis.com/5.1/"></script>
</head>
<body>
<arcgis-chart></arcgis-chart>
<script type="module">
const { createModel } = await $arcgis.import("@arcgis/charts-components/model/shared/setup-utils.js");
const FeatureLayer = await $arcgis.import("@arcgis/core/layers/FeatureLayer.js");
const featureLayer = new FeatureLayer({
portalItem: {
id: "caea6a7ab4fe44b9b4ec3abb7314c1bb",
},
});
const chartElement = document.querySelector("arcgis-chart");
const lineChartModel = await createModel({ layer: featureLayer, chartType: "lineChart" });
lineChartModel.xAxisField = "Created_Date";
lineChartModel.binTemporalData = true;
lineChartModel.temporalBinningUnit = "days";
lineChartModel.temporalBinningSize = 3;
lineChartModel.splitByField = "City";
9 collapsed lines
lineChartModel.legendTitleText = "City";
lineChartModel.setAxisTitleText("Created Date", 0);
lineChartModel.titleText = "NYC 311 Helicopter Noise Complaints by 3-Day Period by City";
chartElement.model = lineChartModel;
chartElement.actionMode = "none";
</script>
</body>
</html>