CodePen
Sandbox Download

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 covers a few data configuration examples for line charts, each configured using the line chart model. See the line chart model reference for the full list of available properties and methods.

With number field

With a number field (integer, double, etc.) on the x-axis, points are plotted in ascending numeric order along the axis.

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.

CodePen
Sandbox Download
This 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.
Without numeric fields
29 collapsed lines
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>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.2/"></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";
5 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.

CodePen
Sandbox Download
This 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.
With numeric fields
29 collapsed lines
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>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.2/"></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";
5 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.

CodePen
Sandbox Download
This 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.
With date field
29 collapsed lines
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>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.2/"></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;
7 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

Line chart with split by field allows comparison of trends across different categories over time or continuous data.

CodePen
Sandbox Download
This 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.
With split by field
29 collapsed lines
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>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.2/"></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";
8 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>