hi matt,your 'Graphic is undefined' error is the result of using an AMD code snippet within a sample that uses the legacy loading pattern (ie. esri.Graphic refers to something here, but not 'Graphic' all by itself.)in order to solve this problem you are going to have to avoid creating a new array each time someone clicks on the map.heres a working sample and a description of the logic it uses.1. create global variables for a variable called 'features' and another called 'facilities'
var map, serviceAreaTask, params, clickpoint, features, facilities;
2. make features an empty array within the function that fires on page load and make facilities a new FeatureSet()
function init() {
...
features = [];
facilities = new esri.tasks.FeatureSet();
}
3. stop clearing the map graphics each time the map is clicked (because we need more than one to display)
function mapClickHandler(evt) {
//map.graphics.clear();
}
4. check how many items can be found within the array of graphics called 'features'. once there are two, call the service area code.
features.push(location);
if (features.length === 2) {
facilities.features = features;
...
ps. in the future, please consider posting your code within CODE tags. it helps with formatting.