<div id="response"></div>
// Set the auth token
var token = "demo-token";
// Set the chart inputs
var chartInputs = {
"symbol": "AAPL",
"exchange": "NSQ",
"realTime": false,
"numDays": 365,
"height": 50,
"priceLineColor": "#5F6064",
"priceLineWidth": 2,
"priceNegativeColor": "#C0202D",
"pricePositiveColor": "#1D8343",
"showChange": true,
"width": 115
};
// Stringify & Encode Inputs
var encoded = encodeURIComponent(JSON.stringify(chartInputs, null));
// Create API call
var url = "https://api.markitondemand.com/apiman-gateway/MOD/chartworks-image/1.0/Chart/sparkLine?inputs=" + encoded + "&access_token=" + token;
// Append to our target
$("<img />").attr("src", url).appendTo("#response");
This Pen doesn't use any external CSS resources.