▾
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.
- Set the
xAxisFieldproperty to"SAT_Score_Average", which is an integer 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 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.
- Set the
xAxisFieldproperty to"SAT_Score_Average", which is an integer field. - Set the
numericFieldsproperty to["TUITIONFEE", "Earnings"]to specify the numeric fields. - Set the
aggregationTypeproperty to"avg"to calculate the average tuition fee and earnings for each unique average SAT score.
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.
- Set the
xAxisFieldproperty to"Created_Date"to specify the date field. - Set the
binTemporalDataproperty totrueto enable temporal binning. - Set the
temporalBinningSizeproperty to3and thetemporalBinningUnitproperty to"days"to group the date values into 3-day intervals.
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.
- Set the
xAxisFieldproperty to"Created_Date"to specify the date field. - Set the
binTemporalDataproperty totrueto enable temporal binning. - Set the
temporalBinningSizeproperty to3and thetemporalBinningUnitproperty to"days"to group the date values into 3-day intervals. - Set the
splitByFieldproperty to"City"to divide each main category into grouped lines for subcategory comparison.
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>