Esri / Esri/cedar

Possible to have multiple series on a time chart?

Open
#275 7 comments 0 reactions 0 assignees View on GitHub
v0x
Dominant language
Handlebars
Stars
265
Forks
236
PR merge metrics
No merged PRs in 30d

Description

Likely a rookie error, but is it possible to have multiple lines on a line chart?

Sample app [here](http://s3-ap-southeast-2.amazonaws.com/languagesofaustralia.com/SimonJacksonFiles/cedar_hub8.html)

The request seems to be returning the[ expected results](https://services1.arcgis.com/vHnIGBHHqDR6y0CR/ArcGIS/rest/services/CrashStats_2017/FeatureServer/0/query?where=1%3D1&returnGeometry=false&returnDistinctValues=false&returnIdsOnly=false&returnCountOnly=false&outFields=*&sqlFormat=standard&f=json&orderByFields=accident_date&groupByFieldsForStatistics=accident_date&outStatistics=%5B%7B%22statisticType%22%3A%22sum%22%2C%22onStatisticField%22%3A%22bicyclist%22%2C%22outStatisticFieldName%22%3A%22bicyclist_SUM%22%7D%2C%7B%22statisticType%22%3A%22sum%22%2C%22onStatisticField%22%3A%22pedestrian%22%2C%22outStatisticFieldName%22%3A%22pedestrian_SUM%22%7D%5D) from the service, but I must be missing something in parsing the results into the chart.

```
var chart = new Cedar({"type":"time"});

var datasets = [
{
"url": "https://services1.arcgis.com/vHnIGBHHqDR6y0CR/ArcGIS/rest/services/CrashStats_2017/FeatureServer/0",
"query": {
"orderByFields": "accident_date",
"groupByFieldsForStatistics": "accident_date",
"outStatistics": [
{
"statisticType": "sum",
"onStatisticField": "bicyclist",
"outStatisticFieldName": "bicyclist_SUM"
},
{
"statisticType": "sum",
"onStatisticField": "pedestrian",
"outStatisticFieldName": "pedestrian_SUM"
}
]
}
}
];

var series = [
{
"category": { "field": "accident_date", "label": "Date" },
"value": { "field":"bicyclist_SUM","label":"Bikes" }
},
{
"category": { "field": "accident_date", "label": "Date" },
"value": { "field":"pedestrian_SUM","label":"Peds" }
}

];

chart.datasets = datasets;
chart.series = series;
chart.show({
elementId: "#chart",
autolabels: true
});
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked sample app and the Cedar time-chart handling of the datasets and series configuration. Inspect how the ArcGIS response fields bicyclist_SUM and pedestrian_SUM are parsed, then verify the chart renders both labeled lines from the provided configuration. Done means the sample displays separate bicyclist and pedestrian series.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data-visualization, frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.