diff --git a/dist/cedar.js b/dist/cedar.js new file mode 100644 index 00000000..0caa398e --- /dev/null +++ b/dist/cedar.js @@ -0,0 +1,1194 @@ +/** + * Cedar + * + * Generic charting / visualization library for the ArcGIS Platform + * that leverages vega + d3 internally. + * @access private + */ +(function (factory) { + /* global module */ + 'use strict'; + //define an AMD module that relies on 'vega' + if (typeof define === 'function' && define.amd) { + define(['vega', 'd3'], function (vg, d3) { + return factory(vg, d3); + }); + //define a common js module that relies on 'vega' + } else if (typeof module === 'object' && typeof module.exports === 'object') { + module.exports = factory(require('vega'), require('d3')); + } + + if (typeof window !== 'undefined' && window.vg && window.d3) { + window.Cedar = factory(window.vg, window.d3); + } +} (function (vg, d3) { + 'use strict'; + + // get cedar root URL for loading chart specs + var baseUrl = (function() { + var cdnProtocol = 'http:'; + var cdnUrl = '//esri.github.io/cedar/js'; + var src; + if (window && window.document) { + src = (window.document.currentScript && window.document.currentScript.src); + if (src) { + // real browser, get base url from current script + return src.substr(0, src.lastIndexOf('/')); + } else { + // ie, set base url to CDN + // NOTE: could fallback to CDN only if can't find any scripts named cedar + return (window.document.location ? window.document.location.protocol : cdnProtocol) + cdnUrl; + } + } else { + // node, set base url to CDN + return cdnProtocol + cdnUrl; + } + })(); + +/** + * Creates a new Chart object. + * + * @example + * var chart = new Cedar({ + * "type": "bar" + * "dataset": + * "url":"http://maps2.dcgis.dc.gov/dcgis/rest/services/DCGIS_DATA/Education_WebMercator/MapServer/5", + * "query": { + * "groupByFieldsForStatistics": "FACUSE", + * "outStatistics": [{ + * "statisticType": "sum", + * "onStatisticField": "TOTAL_STUD", + * "outStatisticFieldName": "TOTAL_STUD_SUM" + * }] + * }, + * "mappings":{ + * "sort": "TOTAL_STUD_SUM DESC", + * "x": {"field":"FACUSE","label":"Facility Use"}, + * "y": {"field":"TOTAL_STUD_SUM","label":"Total Students"} + * } + * } + * }); + * + * @param {Object} options + * @param {String} options.type - Chart type as a chartType ("bar") or a URL to a Cedar specification + * @param {Object} options.dataset - Dataset definition including Source and Style mappings + * @param {String} options.dataset.url - GeoService Layer URL + * + * "url":"http://.../rest/services/DATA/Education/MapServer/5" + * @param {Object} options.dataset.query - GeoServices Layer query parameters (where, bbox, outStatistics) [optional] + * + * "query": { + * "groupByFieldsForStatistics": "FACUSE", + * "outStatistics": [{ + * "statisticType": "sum", + * "onStatisticField": "TOTAL_STUD", + * "outStatisticFieldName": "TOTAL_STUD_SUM" }] } + * @param {Object} options.dataset.data - Inline feature collection, alternative to data from a URL + * + * "data": {"features":[{"attributes":{"ZIP_CODE":20005,"TOTAL_STUD_SUM":327}}]} + * @param {Object} options.dataset.mappings - Relates data items to the chart style definition + * @param {Object} options.override - Changes to the "options.type" chart specification + * @param {Object} options.tooltip - Optional on-hover tooltip. Element has class="cedar-tooltip" for styling. + * @param {String} options.tooltip.id - Optional HTML element to use for tooltip. (default: unique id created) + * @param {String} options.tooltip.title - Templated tooltip heading. Uses "{Variable} template format" + * @param {String} options.tooltip.content - Templated tooltip body text. Uses "{Variable} template format" + * @return {Object} new Cedar chart object + */ +var Cedar = function Cedar(options){ + //close over this for use in callbacks + var self = this; + + //ensure an opts object + var opts = options || {}; + + var spec; + + + // Internals for holding state + + // Cedar configuration such as size + this.width = undefined; + this.height = undefined; + this.autolabels = true; + + // Array to hold event handlers + this._events = []; + + //initialize the internal definition hash + this._definition = Cedar._defaultDefinition(); + + //the vega view aka the chart + this._view = undefined; + + //the vega view aka the chart + this._tooltip = undefined; + + //queue to hold methods called while + //xhrs are in progress + this._methodQueue=[]; + + // override base URL + if (opts.baseUrl) { + this.baseUrl = opts.baseUrl; + } + + /** + * Flag used to determine if the library is + * waiting for an xhr to return. + * @access private + */ + this._pendingXhr = false; + + //defintion + if(opts.definition){ + //is it an object or string(assumed to be url) + if(typeof opts.definition === 'object'){ + //hold onto the definition + this._definition = opts.definition; + }else if(typeof opts.definition === 'string' ){ + //assume it's a url (relative or abs) and fetch the definition object + this._pendingXhr = true; + Cedar.getJson(opts.definition, function(err,data){ + self._pendingXhr = false; + self._definition = data; + self._purgeMethodQueue(); + }); + }else{ + throw new Error('parameter definition must be an object or string (url)'); + } + } + + if(opts.override) { + this._definition.override = opts.override; + } + + // specification + + // first, check for pre-defined chart type passed as "type" + spec = this._getSpecificationUrl(opts.type); + + // if url or object passed used that + if(opts.specification){ + spec = opts.specification; + } + + if (spec) { + //is it an object or string(assumed to be url) + if(typeof spec === 'object'){ + //hold onto the template + this._definition.specification = spec; + + }else if(typeof spec === 'string' ){ + //assume it's a url (relative or abs) and fetch the template object + this._pendingXhr = true; + Cedar.getJson(spec, function(err,data){ + self._pendingXhr = false; + self._definition.specification = data; + self._purgeMethodQueue(); + }); + }else{ + throw new Error('parameter specification must be an object or string (url)'); + } + } + + //allow a dataset to be passed in... + if(opts.dataset && typeof opts.dataset === 'object'){ + opts.dataset.query = Cedar._mixin({}, Cedar._defaultQuery(), opts.dataset.query); + //assign it + this._definition.dataset = opts.dataset; + } + + /** + * Properties + * + * ES 5.1 syntax, so IE 8 & lower won't work + * + * If the val is a url, should we expect + * cedar to fetch the object? + * + * I'd say no... as that violates the principal + * of least suprise. Also - cedar has a .getJSON + * helper method the dev should use. + * + * @access private + */ + Object.defineProperty(this, 'dataset', { + get: function() { + return this._definition.dataset; + }, + set: function(val) { + this._definition.dataset = val; + } + }); + + Object.defineProperty(this, 'specification', { + get: function() { + return this._definition.specification; + }, + set: function(val) { + this._definition.specification = val; + } + }); + + Object.defineProperty(this, 'override', { + get: function() { + return this._definition.override; + }, + set: function(val) { + this._definition.override = val; + } + }); + + Object.defineProperty(this, 'tooltip', { + get: function() { + return this._definition.tooltip; + }, + set: function(val) { + this._definition.tooltip = val; + if( this._definition.tooltip.id === undefined || this._definition.tooltip.id === null ) { + this._definition.tooltip.id = "cedar-" + Date.now(); + } + } + }); + + //allow a tooltip to be passed in... + if(opts.tooltip && typeof opts.tooltip === 'object'){ + this.tooltip = opts.tooltip; + } else { + // Build a default tooltip based on first two inputs + var inputs = []; + for(var input in this._definition.dataset.mappings){ + if (this._definition.dataset.mappings.hasOwnProperty(input)) { + var field = this._definition.dataset.mappings[input].field; + if(field !== undefined && field !== null) { + inputs.push(field); + } + } + } + if(inputs.length >= 2) { + this.tooltip = { + "title": "{" + inputs[0] + "}", + "content": "{" + inputs[1] + "}" + }; + } + } +}; + +// base URL of this library +Cedar.prototype.baseUrl = baseUrl; + +/** + * Default pre-defined chart types + * + * ['bar', 'bar-horizontal', 'bubble', 'grouped', 'pie', 'scatter', 'sparkline', 'time']; + */ +Cedar.prototype.chartTypes = ['bar', 'bar-horizontal', 'bubble', 'grouped', 'pie', 'scatter', 'sparkline', 'time', 'time-trendline']; + +/** + * Inspect the current state of the object + * and determine if we have sufficient information + * to render the chart + * @return {object} Hash of the draw state + any missing requirements + */ +Cedar.prototype.canDraw = function(){ + + //dataset? + //dataset.url || dataset.data? + //dataset.mappings? + //specification? + //specification.template? + //specification.inputs? + //specification.inputs ~ dataset.mappings? + + return {drawable:true, errs:[]}; + +}; + +/** + * Draw the chart into the DOM element + * + * @example + * + * var chart = new Cedar({ + * "type": "scatter", + * "dataset":{ + * "url":"http://maps2.dcgis.dc.gov/dcgis/rest/services/DCGIS_DATA/Education_WebMercator/MapServer/5", + * "query":{}, + * "mappings":{ + * "x": {"field":"POPULATION_ENROLLED_2008","label":"Enrolment 2008"}, + * "y": {"field":"SQUARE_FOOTAGE","label":"Square Footage"}, + * "color":{"field":"FACUSE","label":"Facility Type"} + * } + * } + * }); + * + * chart.show({ + * elementId: "#chart" + * }); + * + * @param {object} options + * @param {String} options.elementId [required] Id of the Dom element into which the chart will be rendered + * @param {String} options.renderer "canvas" or "svg" (default: `svg`) + * @param {Boolean} options.autolabels place axis labels outside any tick labels (default: false) + * @param {String} options.token Token to be used if the data or spec are on a secured server + */ +Cedar.prototype.show = function(options){ + if(this._pendingXhr){ + + this._addToMethodQueue('show', [options]); + + }else{ + + var err; + //ensure we got an elementId + if( !options.elementId ){ + err= "Cedar.show requires options.elementId"; + } + //check if element exists in the page + if(d3.select(options.elementId)[0][0] === null){ + err = "Element " + options.elementId + " is not present in the DOM"; + } + + //hold onto the id + this._elementId = options.elementId; + this._renderer = options.renderer || "svg"; //default to svg + this.width = options.width || undefined; // if not set in API, always base on current div size + this.height = options.height || undefined; + if(options.autolabels !== undefined && options.autolabels !== null){ + this.autolabels = options.autolabels; + } + //hold onto the token + if(options.token){ + this._token = options.token; + } + + if( err ){ + throw new Error( err ); + } + var chk = this.canDraw(); + if(chk.drawable){ + //update centralizes the spec compilation & drawing + this.update(); + }else{ + //report the issues + var errs = chk.issues.join(','); + throw new Error('Chart can not be drawn because: ' + errs); + } + + } +}; + +/** + * Draw the chart based on any changes to data or specifications + * Should be called after a user modifies + * the dataset, query, mappings, chart specification or element size + * + * @example + * dataset = {"url": "...", "mappings": {"x": {"field": "STATE"}, "y": {"field": "POPULATION"}}}; + * chart = new Cedar({ "type": "bar", "dataset": dataset }); + * chart.show({elementId: "#chart"}); + * chart.dataset.query.where = "POPULATION>30000"; + * chart.update(); + */ +Cedar.prototype.update = function(){ + var self = this; + + if ( this._view ) { + this.emit('update-start'); + } + + if(this._pendingXhr){ + + this._addToMethodQueue('update'); + + }else{ + + if(this._view){ + //remove handlers + //TODO Remove existing handlers + this._remove(this._view); + } + try{ + + // Creates the HTML Div and styling if not already created + if(self._definition.tooltip !== undefined && self._definition.tooltip !== null) { + self._createTooltip(self._definition.tooltip.id); + } + + //ensure we have required inputs or defaults + var compiledMappings = Cedar._applyDefaultsToMappings(this._definition.dataset.mappings, this._definition.specification.inputs); //Cedar._compileMappings(this._definition.dataset, this._definition.specification.inputs); + + var queryFromSpec = Cedar._mixin({}, this._definition.specification.query, this._definition.dataset.query); + queryFromSpec = JSON.parse(Cedar._supplant(JSON.stringify(queryFromSpec), compiledMappings)); + + //allow binding to query properties + compiledMappings.query = queryFromSpec; + + //compile the template + mappings --> vega spec + var spec = JSON.parse(Cedar._supplant(JSON.stringify(this._definition.specification.template), compiledMappings)); + + // merge in user specified style overrides + spec = Cedar._mergeRecursive(spec, this._definition.override); + + //if the spec has a url in the data node, delete it + if(spec.data[0].url){ + delete spec.data[0].url; + } + + if(this._definition.dataset.data){ + + //create the data node using the passed in data + spec.data[0].values = this._definition.dataset.data; + + //send to vega + this._renderSpec(spec); + + }else{ + + //we need to fetch the data so + var url = Cedar._createFeatureServiceRequest(this._definition.dataset, queryFromSpec); + + //create a callback closure to carry the spec + var cb = function(err,data){ + + if (err) { + throw new Error('Error fetching data, ', err); + } else if ( data.error ) { + var xhrErr = data.error.message || data.error.details[0]; + throw new Error(xhrErr); + } + //todo add error handlers for xhr and ags errors + spec.data[0].values = data; + console.dir(spec); + //send to vega + self._renderSpec(spec); + + }; + + //fetch the data from the service + Cedar.getJson(url, cb); + } + } + catch(ex){ + throw(ex); + } + } +}; + +/** + * Render a compiled Vega specification using Vega Runtime + * @access private + */ +Cedar.prototype._renderSpec = function(spec){ + var self = this; + // try{ + if(self.autolabels === true) { + spec = self._placeLabels(spec); + spec = self._placeaAxisTicks(spec); + } + //use vega to parse the spec + //it will handle the spec as an object or url + vg.parse.spec(spec, function(chartCtor) { + + //create the view + self._view = chartCtor({ + el: self._elementId, + renderer: self._renderer + }); + + + var width = self.width || parseInt(d3.select(self._elementId).style('width'), 10) || 500; + var height = self.height || parseInt(d3.select(self._elementId).style('height'), 10) || 500; + + //render into the element + self._view.width(width).height(height).update(); + + //attach event proxies + self._attach(self._view); + + if ( self._view ) { + self.emit('update-end'); + } + + }); + // } + // catch(ex){ + // throw(ex); + // } +}; + +/** + * Automatically determines axis title placement + * + * Calculates the maximum length of a tick label and adds padding + * @todo remove expectation that there are both x,y axes + * + * @access private + */ +Cedar.prototype._placeLabels = function(spec) { + var self = this; + try{ + var fields = {}; + var lengths = {}; + var inputs = []; + // Get all inputs that may be axes + for(var input in self._definition.dataset.mappings){ + // check also if property is not inherited from prototype + if (self._definition.dataset.mappings.hasOwnProperty(input)) { + var field = self._definition.dataset.mappings[input].field; + if(field !== undefined && field !== null) { + inputs.push(input); + fields[input] = field; + lengths[input] = 0; + } + } + } + var length = 0; + + // Find the max length value for each axis + spec.data[0].values.features.forEach(function(feature) { + inputs.forEach(function(axis) { + length = (feature.attributes[fields[axis]] || "").toString().length; + if( length > lengths[axis]) { + lengths[axis] = length; + } + }); + }); + + // Change each axis title offset based on longest value + inputs.forEach(function(axis, index) { + var angle = 0; + if(spec.axes !== undefined && spec.axes[index] !== undefined) { + + if (spec.axes[index].properties.labels.angle !== undefined) { + angle = spec.axes[index].properties.labels.angle.value; + } + if(spec.axes[index].type == 'y' ) { + angle = 100 - angle; + } + spec.axes[index].titleOffset = Math.abs(lengths[axis] * angle/100 * 8) + 35; + //chart._view.model().defs().marks.axes[index].titleOffset = lengths[axis]*4+20 + } + }); + return spec; + + } catch(ex) { + throw(ex); + } +}; + +/** + * Automatically determines number of axis tick marks + * + * Calculates the maximum length of a tick label and adds padding + * @todo remove expectation that there are both x,y axes + * + * @access private + */ +Cedar.prototype._placeaAxisTicks = function(spec) { + var self = this; + if(spec.axes !== undefined) { + try{ + var width = self.width || parseInt(d3.select(self._elementId).style('width'), 10) || 500; + var height = self.height || parseInt(d3.select(self._elementId).style('height'), 10) || 500; + + spec.axes[0].ticks = width / 100; + if(spec.axes[1] !== undefined) { + spec.axes[1].ticks = height / 30; + } + } catch(ex) { + throw(ex); + } + } + + return spec; +}; + +/** + * Highlight marker based on attribute value + * + * @example + * chart = new Cedar({...}); + * chart.select({key: "ZIP_CODE", value: "20002"}); + * + * @param {Object} options - Object(key, value) to match. Calls hover on mark + * @returns {Array} items - array of chart objects that match the criteria + */ +Cedar.prototype.select = function( options ) { + var self = this; + var view = this._view; + var items = view.model().scene().items[0].items[0].items; + + items.forEach(function(item) { + if ( item.datum.attributes[options.key] === options.value ) { + if ( item.hasPropertySet("hover") ) { + self._view.update({props:"hover", items:item}); + } + } + }); + + return items; + +}; + + +/** + * Removes highlighted chart items + * + * If "options" are used, only clear specific items, otherwise clears all highlights. + * @param {Object} options - Object(key, value) to match. Calls hover on mark + * @returns {Array} items - array of chart objects that match the criteria, or null if all items. + */ +Cedar.prototype.clearSelection = function( options ) { + var self = this; + var view = this._view; + + if ( options && options.key ) { + var items = view.model().scene().items[0].items[0].items; + items.forEach(function(item) { + if ( item.datum.attributes[options.key] === options.value ) { + self._view.update({props:"update", items:item}); + } + }); + return items; + } else { + //clear all + self._view.update(); + return null; + } +}; + + +/** + * Trigger a callback + * @param {Strint} eventName - ["mouseover","mouseout","click","update-start","update-end"] + */ +Cedar.prototype.emit = function(eventName) { + if (this._view._handler._handlers[ eventName ] && this._view._handler._handlers[ eventName ][0] !== undefined){ + this._view._handler._handlers[ eventName ][0].handler(); + } +}; + +/** + * Attach the generic proxy handlers to the chart view + * @access private + */ +Cedar.prototype._attach = function(view){ + + view.on('mouseover', this._handler('mouseover')); + view.on('mouseout', this._handler('mouseout')); + view.on('mousemove', this._handler('mousemove')); + view.on('click', this._handler("click")); + view.on('update-start', this._handler('update-start')); + view.on('update-end', this._handler('update-end')); + +}; + +/** + * Remove all event handlers from the view + * @access private + */ +Cedar.prototype._remove = function(view){ + + view.off('mouseover'); + view.off('mouseout'); + view.off('mousemove'); + view.off('click'); + view.off('update-start'); + view.off('update-end'); + +}; + +/** + * Helper function that validates that the + * mappings hash contains values for all + * the inputs + * @param {array} inputs Array of inputs + * @param {object} mappings Hash of mappings + * @return {array} Missing mappings + * @access private + */ +Cedar._validateMappings = function(inputs, mappings){ + var missingInputs = [], input; + for(var i=0;i 0){ + + for(var i=0;i
"; + content += "

" + this._definition.tooltip.content + "

"; + + cedartip.innerHTML = content.replace( /\{(\w+)\}/g, function replacer(match, $1){ + return data[$1]; + } ); + +}; + + +/** +* @access private +*/ +Cedar._mixin = function(source) { + /*jshint loopfunc: true*/ + // TODO: prob should replace w/ forEach() + for (var i = 1; i < arguments.length; i++) { + d3.entries(arguments[i]).forEach(function(p) { + source[p.key] = p.value; + }); + } + return source; +}; + +/** + * Helper function to request JSON from a URL + * @param {String} url URL to json file + * @param {Function} callback node-style callback function (error, data) + */ +Cedar.getJson = function( url, callback ){ + var cb = function(err,data) { + if(err){ + callback('Error loading ' + url + ' ' + err.message); + } + callback(null, JSON.parse(data.responseText)); + }; + if(url.length > 2000) { + var uri = url.split("?"); + d3.xhr(uri[0]) + .header("Content-Type", "application/x-www-form-urlencoded") + .post(uri[1], cb); + } else { + d3.xhr(url).get(cb); + } +}; +/** + * Given a dataset hash, create the feature service + * query string + * @access private + */ +Cedar._createFeatureServiceRequest = function( dataset, queryFromSpec ) { + var mergedQuery = Cedar._mixin({}, Cedar._defaultQuery(), queryFromSpec); + + //Handle bbox + if(mergedQuery.bbox){ + //make sure a geometry was not also passed in + if(mergedQuery.geometry){ + throw new Error('Dataset.query can not have both a geometry and a bbox specified'); + } + //get the bbox (W,S,E,N) + var bboxArr = mergedQuery.bbox.split(','); + + //remove it so it's not serialized as-is + delete mergedQuery.bbox; + + //cook it into a json string + mergedQuery.geometry = JSON.stringify({"xmin": bboxArr[0], "ymin": bboxArr[2],"xmax": bboxArr[1], "ymax": bboxArr[3] }); + //set the spatial ref as geographic + mergedQuery.inSR = '4326'; + } + if(!mergedQuery.groupByFieldsForStatistics && dataset.mappings.group) { + mergedQuery.groupByFieldsForStatistics = dataset.mappings.group.field; + } + if(!mergedQuery.outStatistics && dataset.mappings.count) { + // Why are we explicitly statting _SUM as stats type? + mergedQuery.orderByFields = dataset.mappings.count.field + "_SUM"; + mergedQuery.outStatistics = JSON.stringify([{"statisticType": "sum", "onStatisticField": dataset.mappings.count.field, "outStatisticFieldName": dataset.mappings.count.field + "_SUM"}]); + } + + + + //iterate the mappings keys to check for sort + //----------------------------------------------------------------- + //This approach would seem 'clean' but if there are multiple fields + //to sort by, the order would be determined by how javascript decides to + //iterate the mappings property hash. + //Thus, using mappings.sort gives the developer explicit control + //----------------------------------------------------------------- + // var sort = []; + // for (var property in dataset.mappings) { + // if (dataset.mappings.hasOwnProperty(property)) { + // if(dataset.mappings[property].sort){ + // //ok - build up the sort + // sort.push(dataset.mappings[property].field + ' ' + dataset.mappings[property].sort); + // } + // } + // } + // if(sort.length > 0){ + // mergedQuery.orderByFields = sort.join(','); + // } + //----------------------------------------------------------------- + //check for a sort passed directly in + if(dataset.mappings.sort){ + mergedQuery.orderByFields = dataset.mappings.sort; + } + + var url = dataset.url + "/query?" + this._serializeQueryParams(mergedQuery); + + if(dataset.token){ + url = url + '&token=' + dataset.token; + } + + return url; +}; + +/** +* @access private +*/ +Cedar._applyDefaultsToMappings = function(mappings, inputs){ + var errs = []; + //loop over the inputs + for(var i =0; i < inputs.length; i++){ + //get the input + var input = inputs[i]; + + //if it's required and not in the mappings, add an exception + if(input.required && !mappings[input.name] ){ + errs.push(input.name); + } + + //if it's not required, has a default and not in the mappings + if(!input.required && !mappings[input.name] && input['default']){ + //add the default + mappings[input.name] = input['default']; + } + } + + if(errs.length > 0){ + throw new Error('Required Mappings Missing: ' + errs.join(',')); + }else{ + return mappings; + } +}; + + +/** + * Token Replacement on a string + * @param {string} template string template + * @param {object} params object hash that maps to the tokens to be replaced + * @return {string} string with values replaced + * @access private + */ +Cedar._supplant = function( tmpl, params ){ + var t = tmpl.replace(/{([^{}]*)}/g, + function (a, b) { + var r = Cedar._getTokenValue(params, b); + + return typeof r === 'string' || typeof r === 'number' ? r : a; + } + ); + return t.replace(/"{([^{}]*)}"/g, + function(a, b) { + var r = Cedar._getTokenValue(params, b); + return r.constructor === Array ? r = JSON.stringify(r) : a; + } + ); +}; + +/* + * Recursively merge properties of two objects + * @access private + */ +Cedar._mergeRecursive = function(obj1, obj2) { + for (var p in obj2) { + if (obj2.hasOwnProperty(p)) { + try { + // Property in destination object set; update its value. + if ( obj2[p].constructor===Object || obj2[p].constructor===Array) { + obj1[p] = Cedar._mergeRecursive(obj1[p], obj2[p]); + + } else { + obj1[p] = obj2[p]; + + } + + } catch(e) { + // Property in destination object not set; create it and set its value. + obj1[p] = obj2[p]; + + } + } + } + + return obj1; +}; + +/** + * Get the value of a token from a hash + * @param {[type]} tokens [description] + * @param {[type]} tokenName [description] + * @return {[type]} [description] + * Pulled from gulp-token-replace (MIT license) + * https://github.com/Pictela/gulp-token-replace/blob/master/index.js + * + * @access private + */ +Cedar._getTokenValue = function(tokens, tokenName) { + var tmpTokens = tokens; + var tokenNameParts = tokenName.split('.'); + for (var i = 0; i < tokenNameParts.length; i++) { + if (tmpTokens.hasOwnProperty(tokenNameParts[i])) { + tmpTokens = tmpTokens[tokenNameParts[i]]; + } else { + return null; + } + } + return tmpTokens; +}; + +/** + * Serilize an object into a query string + * + * @param {object} params Params for the query string + * @return {string} query string + * @access private + */ +Cedar._serializeQueryParams = function(params) { + var str = []; + for(var p in params){ + if (params.hasOwnProperty(p)) { + var val = params[p]; + if (typeof val !== "string") { + val = JSON.stringify(val); + } + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(val)); + } + } + var queryString = str.join("&"); + return queryString; +}; + + return Cedar; +})); + +//# sourceMappingURL=cedar.js.map \ No newline at end of file diff --git a/dist/cedar.js.map b/dist/cedar.js.map new file mode 100644 index 00000000..a16c291e --- /dev/null +++ b/dist/cedar.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../src/cedar.js"],"names":[],"mappings":"AAAA,GAAG;AACH,CAAC,CAAC,CAAC,KAAK;AACR,CAAC,CAAC;AACF,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ;AACnE,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC;AACvC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO;AAClB,CAAC,EAAE;AACH,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;AACrB,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;AACrB,EAAE,CAAC,GAAG,C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AAM,CAAC,CAAC,MAAM,CAAC,QAAQ,KAAK,CAAC,MAAM;AACvC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO;AAClB,CAAC,EAAE;AACH,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;AAChD,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG;AACf,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE;AACvB,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC;AACnC,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE;AAC1B,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;AACpC,UAAU,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE;AACpC,MAAM,CAAC;AACP,MAAM,GAAG,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,kBAAkB,CAAC,GAAG,GAAG;AACtE,IAAI,CAAC;AACL,EAAE,CAAC;AACH,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,MAAM;AAClC,EAAE,MAAM,CAAC,WAAW,CAAC;AACrB,EAAE;AACF;AACA,EAAE,MAAM,CAAC,KAAK,CAAC;AACf,IAAI","file":"cedar.js","sourcesContent":["/**\n * Cedar\n *\n * Generic charting / visualization library for the ArcGIS Platform\n * that leverages vega + d3 internally.\n * @access private\n */\n(function (factory) {\n /* global module */\n 'use strict';\n //define an AMD module that relies on 'vega'\n if (typeof define === 'function' && define.amd) {\n define(['vega', 'd3'], function (vg, d3) {\n return factory(vg, d3);\n });\n //define a common js module that relies on 'vega'\n } else if (typeof module === 'object' && typeof module.exports === 'object') {\n module.exports = factory(require('vega'), require('d3'));\n }\n\n if (typeof window !== 'undefined' && window.vg && window.d3) {\n window.Cedar = factory(window.vg, window.d3);\n }\n} (function (vg, d3) {\n 'use strict';\n\n // get cedar root URL for loading chart specs\n var baseUrl = (function() {\n var cdnProtocol = 'http:';\n var cdnUrl = '//esri.github.io/cedar/js';\n var src;\n if (window && window.document) {\n src = (window.document.currentScript && window.document.currentScript.src);\n if (src) {\n // real browser, get base url from current script\n return src.substr(0, src.lastIndexOf('/'));\n } else {\n // ie, set base url to CDN\n // NOTE: could fallback to CDN only if can't find any scripts named cedar\n return (window.document.location ? window.document.location.protocol : cdnProtocol) + cdnUrl;\n }\n } else {\n // node, set base url to CDN\n return cdnProtocol + cdnUrl;\n }\n })();\n\n/**\n * Creates a new Chart object.\n *\n * @example\n * var chart = new Cedar({\n * \"type\": \"bar\"\n * \"dataset\":\n * \"url\":\"http://maps2.dcgis.dc.gov/dcgis/rest/services/DCGIS_DATA/Education_WebMercator/MapServer/5\",\n * \"query\": {\n * \"groupByFieldsForStatistics\": \"FACUSE\",\n * \"outStatistics\": [{\n * \"statisticType\": \"sum\",\n * \"onStatisticField\": \"TOTAL_STUD\",\n * \"outStatisticFieldName\": \"TOTAL_STUD_SUM\"\n * }]\n * },\n * \"mappings\":{\n * \"sort\": \"TOTAL_STUD_SUM DESC\",\n * \"x\": {\"field\":\"FACUSE\",\"label\":\"Facility Use\"},\n * \"y\": {\"field\":\"TOTAL_STUD_SUM\",\"label\":\"Total Students\"}\n * }\n * }\n * });\n *\n * @param {Object} options\n * @param {String} options.type - Chart type as a chartType (\"bar\") or a URL to a Cedar specification\n * @param {Object} options.dataset - Dataset definition including Source and Style mappings\n * @param {String} options.dataset.url - GeoService Layer URL\n *\n * \"url\":\"http://.../rest/services/DATA/Education/MapServer/5\"\n * @param {Object} options.dataset.query - GeoServices Layer query parameters (where, bbox, outStatistics) [optional]\n *\n * \"query\": {\n * \"groupByFieldsForStatistics\": \"FACUSE\",\n * \"outStatistics\": [{\n * \"statisticType\": \"sum\",\n * \"onStatisticField\": \"TOTAL_STUD\",\n * \"outStatisticFieldName\": \"TOTAL_STUD_SUM\" }] }\n * @param {Object} options.dataset.data - Inline feature collection, alternative to data from a URL\n *\n * \"data\": {\"features\":[{\"attributes\":{\"ZIP_CODE\":20005,\"TOTAL_STUD_SUM\":327}}]}\n * @param {Object} options.dataset.mappings - Relates data items to the chart style definition\n * @param {Object} options.override - Changes to the \"options.type\" chart specification\n * @param {Object} options.tooltip - Optional on-hover tooltip. Element has class=\"cedar-tooltip\" for styling.\n * @param {String} options.tooltip.id - Optional HTML element to use for tooltip. (default: unique id created)\n * @param {String} options.tooltip.title - Templated tooltip heading. Uses \"{Variable} template format\"\n * @param {String} options.tooltip.content - Templated tooltip body text. Uses \"{Variable} template format\"\n * @return {Object} new Cedar chart object\n */\nvar Cedar = function Cedar(options){\n //close over this for use in callbacks\n var self = this;\n\n //ensure an opts object\n var opts = options || {};\n\n var spec;\n\n\n // Internals for holding state\n\n // Cedar configuration such as size\n this.width = undefined;\n this.height = undefined;\n this.autolabels = true;\n\n // Array to hold event handlers\n this._events = [];\n\n //initialize the internal definition hash\n this._definition = Cedar._defaultDefinition();\n\n //the vega view aka the chart\n this._view = undefined;\n\n //the vega view aka the chart\n this._tooltip = undefined;\n\n //queue to hold methods called while\n //xhrs are in progress\n this._methodQueue=[];\n\n // override base URL\n if (opts.baseUrl) {\n this.baseUrl = opts.baseUrl;\n }\n\n /**\n * Flag used to determine if the library is\n * waiting for an xhr to return.\n * @access private\n */\n this._pendingXhr = false;\n\n //defintion\n if(opts.definition){\n //is it an object or string(assumed to be url)\n if(typeof opts.definition === 'object'){\n //hold onto the definition\n this._definition = opts.definition;\n }else if(typeof opts.definition === 'string' ){\n //assume it's a url (relative or abs) and fetch the definition object\n this._pendingXhr = true;\n Cedar.getJson(opts.definition, function(err,data){\n self._pendingXhr = false;\n self._definition = data;\n self._purgeMethodQueue();\n });\n }else{\n throw new Error('parameter definition must be an object or string (url)');\n }\n }\n\n if(opts.override) {\n this._definition.override = opts.override;\n }\n\n // specification\n\n // first, check for pre-defined chart type passed as \"type\"\n spec = this._getSpecificationUrl(opts.type);\n\n // if url or object passed used that\n if(opts.specification){\n spec = opts.specification;\n }\n\n if (spec) {\n //is it an object or string(assumed to be url)\n if(typeof spec === 'object'){\n //hold onto the template\n this._definition.specification = spec;\n\n }else if(typeof spec === 'string' ){\n //assume it's a url (relative or abs) and fetch the template object\n this._pendingXhr = true;\n Cedar.getJson(spec, function(err,data){\n self._pendingXhr = false;\n self._definition.specification = data;\n self._purgeMethodQueue();\n });\n }else{\n throw new Error('parameter specification must be an object or string (url)');\n }\n }\n\n //allow a dataset to be passed in...\n if(opts.dataset && typeof opts.dataset === 'object'){\n opts.dataset.query = Cedar._mixin({}, Cedar._defaultQuery(), opts.dataset.query);\n //assign it\n this._definition.dataset = opts.dataset;\n }\n\n /**\n * Properties\n *\n * ES 5.1 syntax, so IE 8 & lower won't work\n *\n * If the val is a url, should we expect\n * cedar to fetch the object?\n *\n * I'd say no... as that violates the principal\n * of least suprise. Also - cedar has a .getJSON\n * helper method the dev should use.\n *\n * @access private\n */\n Object.defineProperty(this, 'dataset', {\n get: function() {\n return this._definition.dataset;\n },\n set: function(val) {\n this._definition.dataset = val;\n }\n });\n\n Object.defineProperty(this, 'specification', {\n get: function() {\n return this._definition.specification;\n },\n set: function(val) {\n this._definition.specification = val;\n }\n });\n\n Object.defineProperty(this, 'override', {\n get: function() {\n return this._definition.override;\n },\n set: function(val) {\n this._definition.override = val;\n }\n });\n\n Object.defineProperty(this, 'tooltip', {\n get: function() {\n return this._definition.tooltip;\n },\n set: function(val) {\n this._definition.tooltip = val;\n if( this._definition.tooltip.id === undefined || this._definition.tooltip.id === null ) {\n this._definition.tooltip.id = \"cedar-\" + Date.now();\n }\n }\n });\n\n //allow a tooltip to be passed in...\n if(opts.tooltip && typeof opts.tooltip === 'object'){\n this.tooltip = opts.tooltip;\n } else {\n // Build a default tooltip based on first two inputs\n var inputs = [];\n for(var input in this._definition.dataset.mappings){\n if (this._definition.dataset.mappings.hasOwnProperty(input)) {\n var field = this._definition.dataset.mappings[input].field;\n if(field !== undefined && field !== null) {\n inputs.push(field);\n }\n }\n }\n if(inputs.length >= 2) {\n this.tooltip = {\n \"title\": \"{\" + inputs[0] + \"}\",\n \"content\": \"{\" + inputs[1] + \"}\"\n };\n }\n }\n};\n\n// base URL of this library\nCedar.prototype.baseUrl = baseUrl;\n\n/**\n * Default pre-defined chart types\n *\n * ['bar', 'bar-horizontal', 'bubble', 'grouped', 'pie', 'scatter', 'sparkline', 'time'];\n */\nCedar.prototype.chartTypes = ['bar', 'bar-horizontal', 'bubble', 'grouped', 'pie', 'scatter', 'sparkline', 'time', 'time-trendline'];\n\n/**\n * Inspect the current state of the object\n * and determine if we have sufficient information\n * to render the chart\n * @return {object} Hash of the draw state + any missing requirements\n */\nCedar.prototype.canDraw = function(){\n\n //dataset?\n //dataset.url || dataset.data?\n //dataset.mappings?\n //specification?\n //specification.template?\n //specification.inputs?\n //specification.inputs ~ dataset.mappings?\n\n return {drawable:true, errs:[]};\n\n};\n\n/**\n * Draw the chart into the DOM element\n *\n * @example\n *\n * var chart = new Cedar({\n * \"type\": \"scatter\",\n * \"dataset\":{\n * \"url\":\"http://maps2.dcgis.dc.gov/dcgis/rest/services/DCGIS_DATA/Education_WebMercator/MapServer/5\",\n * \"query\":{},\n * \"mappings\":{\n * \"x\": {\"field\":\"POPULATION_ENROLLED_2008\",\"label\":\"Enrolment 2008\"},\n * \"y\": {\"field\":\"SQUARE_FOOTAGE\",\"label\":\"Square Footage\"},\n * \"color\":{\"field\":\"FACUSE\",\"label\":\"Facility Type\"}\n * }\n * }\n * });\n *\n * chart.show({\n * elementId: \"#chart\"\n * });\n *\n * @param {object} options\n * @param {String} options.elementId [required] Id of the Dom element into which the chart will be rendered\n * @param {String} options.renderer \"canvas\" or \"svg\" (default: `svg`)\n * @param {Boolean} options.autolabels place axis labels outside any tick labels (default: false)\n * @param {String} options.token Token to be used if the data or spec are on a secured server\n */\nCedar.prototype.show = function(options){\n if(this._pendingXhr){\n\n this._addToMethodQueue('show', [options]);\n\n }else{\n\n var err;\n //ensure we got an elementId\n if( !options.elementId ){\n err= \"Cedar.show requires options.elementId\";\n }\n //check if element exists in the page\n if(d3.select(options.elementId)[0][0] === null){\n err = \"Element \" + options.elementId + \" is not present in the DOM\";\n }\n\n //hold onto the id\n this._elementId = options.elementId;\n this._renderer = options.renderer || \"svg\"; //default to svg\n this.width = options.width || undefined; // if not set in API, always base on current div size\n this.height = options.height || undefined;\n if(options.autolabels !== undefined && options.autolabels !== null){\n this.autolabels = options.autolabels;\n }\n //hold onto the token\n if(options.token){\n this._token = options.token;\n }\n\n if( err ){\n throw new Error( err );\n }\n var chk = this.canDraw();\n if(chk.drawable){\n //update centralizes the spec compilation & drawing\n this.update();\n }else{\n //report the issues\n var errs = chk.issues.join(',');\n throw new Error('Chart can not be drawn because: ' + errs);\n }\n\n }\n};\n\n/**\n * Draw the chart based on any changes to data or specifications\n * Should be called after a user modifies\n * the dataset, query, mappings, chart specification or element size\n *\n * @example\n * dataset = {\"url\": \"...\", \"mappings\": {\"x\": {\"field\": \"STATE\"}, \"y\": {\"field\": \"POPULATION\"}}};\n * chart = new Cedar({ \"type\": \"bar\", \"dataset\": dataset });\n * chart.show({elementId: \"#chart\"});\n * chart.dataset.query.where = \"POPULATION>30000\";\n * chart.update();\n */\nCedar.prototype.update = function(){\n var self = this;\n\n if ( this._view ) {\n this.emit('update-start');\n }\n\n if(this._pendingXhr){\n\n this._addToMethodQueue('update');\n\n }else{\n\n if(this._view){\n //remove handlers\n //TODO Remove existing handlers\n this._remove(this._view);\n }\n try{\n\n // Creates the HTML Div and styling if not already created\n if(self._definition.tooltip !== undefined && self._definition.tooltip !== null) {\n self._createTooltip(self._definition.tooltip.id);\n }\n\n //ensure we have required inputs or defaults\n var compiledMappings = Cedar._applyDefaultsToMappings(this._definition.dataset.mappings, this._definition.specification.inputs); //Cedar._compileMappings(this._definition.dataset, this._definition.specification.inputs);\n\n var queryFromSpec = Cedar._mixin({}, this._definition.specification.query, this._definition.dataset.query);\n queryFromSpec = JSON.parse(Cedar._supplant(JSON.stringify(queryFromSpec), compiledMappings));\n\n //allow binding to query properties\n compiledMappings.query = queryFromSpec;\n\n //compile the template + mappings --> vega spec\n var spec = JSON.parse(Cedar._supplant(JSON.stringify(this._definition.specification.template), compiledMappings));\n\n // merge in user specified style overrides\n spec = Cedar._mergeRecursive(spec, this._definition.override);\n\n //if the spec has a url in the data node, delete it\n if(spec.data[0].url){\n delete spec.data[0].url;\n }\n\n if(this._definition.dataset.data){\n\n //create the data node using the passed in data\n spec.data[0].values = this._definition.dataset.data;\n\n //send to vega\n this._renderSpec(spec);\n\n }else{\n\n //we need to fetch the data so\n var url = Cedar._createFeatureServiceRequest(this._definition.dataset, queryFromSpec);\n\n //create a callback closure to carry the spec\n var cb = function(err,data){\n\n if (err) {\n throw new Error('Error fetching data, ', err);\n } else if ( data.error ) {\n var xhrErr = data.error.message || data.error.details[0];\n throw new Error(xhrErr);\n }\n //todo add error handlers for xhr and ags errors\n spec.data[0].values = data;\n console.dir(spec);\n //send to vega\n self._renderSpec(spec);\n\n };\n\n //fetch the data from the service\n Cedar.getJson(url, cb);\n }\n }\n catch(ex){\n throw(ex);\n }\n }\n};\n\n/**\n * Render a compiled Vega specification using Vega Runtime\n * @access private\n */\nCedar.prototype._renderSpec = function(spec){\n var self = this;\n // try{\n if(self.autolabels === true) {\n spec = self._placeLabels(spec);\n spec = self._placeaAxisTicks(spec);\n }\n //use vega to parse the spec\n //it will handle the spec as an object or url\n vg.parse.spec(spec, function(chartCtor) {\n\n //create the view\n self._view = chartCtor({\n el: self._elementId,\n renderer: self._renderer\n });\n\n\n var width = self.width || parseInt(d3.select(self._elementId).style('width'), 10) || 500;\n var height = self.height || parseInt(d3.select(self._elementId).style('height'), 10) || 500;\n\n //render into the element\n self._view.width(width).height(height).update();\n\n //attach event proxies\n self._attach(self._view);\n\n if ( self._view ) {\n self.emit('update-end');\n }\n\n });\n // }\n // catch(ex){\n // throw(ex);\n // }\n};\n\n/**\n * Automatically determines axis title placement\n *\n * Calculates the maximum length of a tick label and adds padding\n * @todo remove expectation that there are both x,y axes\n *\n * @access private\n */\nCedar.prototype._placeLabels = function(spec) {\n var self = this;\n try{\n var fields = {};\n var lengths = {};\n var inputs = [];\n // Get all inputs that may be axes\n for(var input in self._definition.dataset.mappings){\n // check also if property is not inherited from prototype\n if (self._definition.dataset.mappings.hasOwnProperty(input)) {\n var field = self._definition.dataset.mappings[input].field;\n if(field !== undefined && field !== null) {\n inputs.push(input);\n fields[input] = field;\n lengths[input] = 0;\n }\n }\n }\n var length = 0;\n\n // Find the max length value for each axis\n spec.data[0].values.features.forEach(function(feature) {\n inputs.forEach(function(axis) {\n length = (feature.attributes[fields[axis]] || \"\").toString().length;\n if( length > lengths[axis]) {\n lengths[axis] = length;\n }\n });\n });\n\n // Change each axis title offset based on longest value\n inputs.forEach(function(axis, index) {\n var angle = 0;\n if(spec.axes !== undefined && spec.axes[index] !== undefined) {\n\n if (spec.axes[index].properties.labels.angle !== undefined) {\n angle = spec.axes[index].properties.labels.angle.value;\n }\n if(spec.axes[index].type == 'y' ) {\n angle = 100 - angle;\n }\n spec.axes[index].titleOffset = Math.abs(lengths[axis] * angle/100 * 8) + 35;\n //chart._view.model().defs().marks.axes[index].titleOffset = lengths[axis]*4+20\n }\n });\n return spec;\n\n } catch(ex) {\n throw(ex);\n }\n};\n\n/**\n * Automatically determines number of axis tick marks\n *\n * Calculates the maximum length of a tick label and adds padding\n * @todo remove expectation that there are both x,y axes\n *\n * @access private\n */\nCedar.prototype._placeaAxisTicks = function(spec) {\n var self = this;\n if(spec.axes !== undefined) {\n try{\n var width = self.width || parseInt(d3.select(self._elementId).style('width'), 10) || 500;\n var height = self.height || parseInt(d3.select(self._elementId).style('height'), 10) || 500;\n\n spec.axes[0].ticks = width / 100;\n if(spec.axes[1] !== undefined) {\n spec.axes[1].ticks = height / 30;\n }\n } catch(ex) {\n throw(ex);\n }\n }\n\n return spec;\n};\n\n/**\n * Highlight marker based on attribute value\n *\n * @example\n * chart = new Cedar({...});\n * chart.select({key: \"ZIP_CODE\", value: \"20002\"});\n *\n * @param {Object} options - Object(key, value) to match. Calls hover on mark\n * @returns {Array} items - array of chart objects that match the criteria\n */\nCedar.prototype.select = function( options ) {\n var self = this;\n var view = this._view;\n var items = view.model().scene().items[0].items[0].items;\n\n items.forEach(function(item) {\n if ( item.datum.attributes[options.key] === options.value ) {\n if ( item.hasPropertySet(\"hover\") ) {\n self._view.update({props:\"hover\", items:item});\n }\n }\n });\n\n return items;\n\n};\n\n\n/**\n * Removes highlighted chart items\n *\n * If \"options\" are used, only clear specific items, otherwise clears all highlights.\n * @param {Object} options - Object(key, value) to match. Calls hover on mark\n * @returns {Array} items - array of chart objects that match the criteria, or null if all items.\n */\nCedar.prototype.clearSelection = function( options ) {\n var self = this;\n var view = this._view;\n\n if ( options && options.key ) {\n var items = view.model().scene().items[0].items[0].items;\n items.forEach(function(item) {\n if ( item.datum.attributes[options.key] === options.value ) {\n self._view.update({props:\"update\", items:item});\n }\n });\n return items;\n } else {\n //clear all\n self._view.update();\n return null;\n }\n};\n\n\n/**\n * Trigger a callback\n * @param {Strint} eventName - [\"mouseover\",\"mouseout\",\"click\",\"update-start\",\"update-end\"]\n */\nCedar.prototype.emit = function(eventName) {\n if (this._view._handler._handlers[ eventName ] && this._view._handler._handlers[ eventName ][0] !== undefined){\n this._view._handler._handlers[ eventName ][0].handler();\n }\n};\n\n/**\n * Attach the generic proxy handlers to the chart view\n * @access private\n */\nCedar.prototype._attach = function(view){\n\n view.on('mouseover', this._handler('mouseover'));\n view.on('mouseout', this._handler('mouseout'));\n view.on('mousemove', this._handler('mousemove'));\n view.on('click', this._handler(\"click\"));\n view.on('update-start', this._handler('update-start'));\n view.on('update-end', this._handler('update-end'));\n\n};\n\n/**\n * Remove all event handlers from the view\n * @access private\n */\nCedar.prototype._remove = function(view){\n\n view.off('mouseover');\n view.off('mouseout');\n view.off('mousemove');\n view.off('click');\n view.off('update-start');\n view.off('update-end');\n\n};\n\n/**\n * Helper function that validates that the\n * mappings hash contains values for all\n * the inputs\n * @param {array} inputs Array of inputs\n * @param {object} mappings Hash of mappings\n * @return {array} Missing mappings\n * @access private\n */\nCedar._validateMappings = function(inputs, mappings){\n var missingInputs = [], input;\n for(var i=0;i 0){\n\n for(var i=0;i\" + this._definition.tooltip.title + \"
\";\n content += \"

\" + this._definition.tooltip.content + \"

\";\n\n cedartip.innerHTML = content.replace( /\\{(\\w+)\\}/g, function replacer(match, $1){\n return data[$1];\n } );\n\n};\n\n\n/**\n* @access private\n*/\nCedar._mixin = function(source) {\n /*jshint loopfunc: true*/\n // TODO: prob should replace w/ forEach()\n for (var i = 1; i < arguments.length; i++) {\n d3.entries(arguments[i]).forEach(function(p) {\n source[p.key] = p.value;\n });\n }\n return source;\n};\n\n/**\n * Helper function to request JSON from a URL\n * @param {String} url URL to json file\n * @param {Function} callback node-style callback function (error, data)\n */\nCedar.getJson = function( url, callback ){\n var cb = function(err,data) {\n if(err){\n callback('Error loading ' + url + ' ' + err.message);\n }\n callback(null, JSON.parse(data.responseText));\n };\n if(url.length > 2000) {\n var uri = url.split(\"?\");\n d3.xhr(uri[0])\n .header(\"Content-Type\", \"application/x-www-form-urlencoded\")\n .post(uri[1], cb);\n } else {\n d3.xhr(url).get(cb);\n }\n};\n/**\n * Given a dataset hash, create the feature service\n * query string\n * @access private\n */\nCedar._createFeatureServiceRequest = function( dataset, queryFromSpec ) {\n var mergedQuery = Cedar._mixin({}, Cedar._defaultQuery(), queryFromSpec);\n\n //Handle bbox\n if(mergedQuery.bbox){\n //make sure a geometry was not also passed in\n if(mergedQuery.geometry){\n throw new Error('Dataset.query can not have both a geometry and a bbox specified');\n }\n //get the bbox (W,S,E,N)\n var bboxArr = mergedQuery.bbox.split(',');\n\n //remove it so it's not serialized as-is\n delete mergedQuery.bbox;\n\n //cook it into a json string\n mergedQuery.geometry = JSON.stringify({\"xmin\": bboxArr[0], \"ymin\": bboxArr[2],\"xmax\": bboxArr[1], \"ymax\": bboxArr[3] });\n //set the spatial ref as geographic\n mergedQuery.inSR = '4326';\n }\n if(!mergedQuery.groupByFieldsForStatistics && dataset.mappings.group) {\n mergedQuery.groupByFieldsForStatistics = dataset.mappings.group.field;\n }\n if(!mergedQuery.outStatistics && dataset.mappings.count) {\n // Why are we explicitly statting _SUM as stats type?\n mergedQuery.orderByFields = dataset.mappings.count.field + \"_SUM\";\n mergedQuery.outStatistics = JSON.stringify([{\"statisticType\": \"sum\", \"onStatisticField\": dataset.mappings.count.field, \"outStatisticFieldName\": dataset.mappings.count.field + \"_SUM\"}]);\n }\n\n\n\n //iterate the mappings keys to check for sort\n //-----------------------------------------------------------------\n //This approach would seem 'clean' but if there are multiple fields\n //to sort by, the order would be determined by how javascript decides to\n //iterate the mappings property hash.\n //Thus, using mappings.sort gives the developer explicit control\n //-----------------------------------------------------------------\n // var sort = [];\n // for (var property in dataset.mappings) {\n // if (dataset.mappings.hasOwnProperty(property)) {\n // if(dataset.mappings[property].sort){\n // //ok - build up the sort\n // sort.push(dataset.mappings[property].field + ' ' + dataset.mappings[property].sort);\n // }\n // }\n // }\n // if(sort.length > 0){\n // mergedQuery.orderByFields = sort.join(',');\n // }\n //-----------------------------------------------------------------\n //check for a sort passed directly in\n if(dataset.mappings.sort){\n mergedQuery.orderByFields = dataset.mappings.sort;\n }\n\n var url = dataset.url + \"/query?\" + this._serializeQueryParams(mergedQuery);\n\n if(dataset.token){\n url = url + '&token=' + dataset.token;\n }\n\n return url;\n};\n\n/**\n* @access private\n*/\nCedar._applyDefaultsToMappings = function(mappings, inputs){\n var errs = [];\n //loop over the inputs\n for(var i =0; i < inputs.length; i++){\n //get the input\n var input = inputs[i];\n\n //if it's required and not in the mappings, add an exception\n if(input.required && !mappings[input.name] ){\n errs.push(input.name);\n }\n\n //if it's not required, has a default and not in the mappings\n if(!input.required && !mappings[input.name] && input['default']){\n //add the default\n mappings[input.name] = input['default'];\n }\n }\n\n if(errs.length > 0){\n throw new Error('Required Mappings Missing: ' + errs.join(','));\n }else{\n return mappings;\n }\n};\n\n\n/**\n * Token Replacement on a string\n * @param {string} template string template\n * @param {object} params object hash that maps to the tokens to be replaced\n * @return {string} string with values replaced\n * @access private\n */\nCedar._supplant = function( tmpl, params ){\n var t = tmpl.replace(/{([^{}]*)}/g,\n function (a, b) {\n var r = Cedar._getTokenValue(params, b);\n\n return typeof r === 'string' || typeof r === 'number' ? r : a;\n }\n );\n return t.replace(/\"{([^{}]*)}\"/g,\n function(a, b) {\n var r = Cedar._getTokenValue(params, b);\n return r.constructor === Array ? r = JSON.stringify(r) : a;\n }\n );\n};\n\n/*\n * Recursively merge properties of two objects\n * @access private\n */\nCedar._mergeRecursive = function(obj1, obj2) {\n for (var p in obj2) {\n if (obj2.hasOwnProperty(p)) {\n try {\n // Property in destination object set; update its value.\n if ( obj2[p].constructor===Object || obj2[p].constructor===Array) {\n obj1[p] = Cedar._mergeRecursive(obj1[p], obj2[p]);\n\n } else {\n obj1[p] = obj2[p];\n\n }\n\n } catch(e) {\n // Property in destination object not set; create it and set its value.\n obj1[p] = obj2[p];\n\n }\n }\n }\n\n return obj1;\n};\n\n/**\n * Get the value of a token from a hash\n * @param {[type]} tokens [description]\n * @param {[type]} tokenName [description]\n * @return {[type]} [description]\n * Pulled from gulp-token-replace (MIT license)\n * https://github.com/Pictela/gulp-token-replace/blob/master/index.js\n *\n * @access private\n */\nCedar._getTokenValue = function(tokens, tokenName) {\n var tmpTokens = tokens;\n var tokenNameParts = tokenName.split('.');\n for (var i = 0; i < tokenNameParts.length; i++) {\n if (tmpTokens.hasOwnProperty(tokenNameParts[i])) {\n tmpTokens = tmpTokens[tokenNameParts[i]];\n } else {\n return null;\n }\n }\n return tmpTokens;\n};\n\n/**\n * Serilize an object into a query string\n *\n * @param {object} params Params for the query string\n * @return {string} query string\n * @access private\n */\nCedar._serializeQueryParams = function(params) {\n var str = [];\n for(var p in params){\n if (params.hasOwnProperty(p)) {\n var val = params[p];\n if (typeof val !== \"string\") {\n val = JSON.stringify(val);\n }\n str.push(encodeURIComponent(p) + \"=\" + encodeURIComponent(val));\n }\n }\n var queryString = str.join(\"&\");\n return queryString;\n};\n\n return Cedar;\n}));\n"]} \ No newline at end of file diff --git a/dist/cedar.min.js b/dist/cedar.min.js new file mode 100644 index 00000000..19a779a3 --- /dev/null +++ b/dist/cedar.min.js @@ -0,0 +1,2 @@ +!function(a){"use strict";"function"==typeof define&&define.amd?define(["vega","d3"],function(b,c){return a(b,c)}):"object"==typeof module&&"object"==typeof module.exports&&(module.exports=a(require("vega"),require("d3"))),"undefined"!=typeof window&&window.vg&&window.d3&&(window.Cedar=a(window.vg,window.d3))}(function(a,b){"use strict";var c=function(){var a,b="http:",c="//esri.github.io/cedar/js";return window&&window.document?(a=window.document.currentScript&&window.document.currentScript.src,a?a.substr(0,a.lastIndexOf("/")):(window.document.location?window.document.location.protocol:b)+c):b+c}(),d=function a(b){var c,d=this,e=b||{};if(this.width=void 0,this.height=void 0,this.autolabels=!0,this._events=[],this._definition=a._defaultDefinition(),this._view=void 0,this._tooltip=void 0,this._methodQueue=[],e.baseUrl&&(this.baseUrl=e.baseUrl),this._pendingXhr=!1,e.definition)if("object"==typeof e.definition)this._definition=e.definition;else{if("string"!=typeof e.definition)throw new Error("parameter definition must be an object or string (url)");this._pendingXhr=!0,a.getJson(e.definition,function(a,b){d._pendingXhr=!1,d._definition=b,d._purgeMethodQueue()})}if(e.override&&(this._definition.override=e.override),c=this._getSpecificationUrl(e.type),e.specification&&(c=e.specification),c)if("object"==typeof c)this._definition.specification=c;else{if("string"!=typeof c)throw new Error("parameter specification must be an object or string (url)");this._pendingXhr=!0,a.getJson(c,function(a,b){d._pendingXhr=!1,d._definition.specification=b,d._purgeMethodQueue()})}if(e.dataset&&"object"==typeof e.dataset&&(e.dataset.query=a._mixin({},a._defaultQuery(),e.dataset.query),this._definition.dataset=e.dataset),Object.defineProperty(this,"dataset",{get:function(){return this._definition.dataset},set:function(a){this._definition.dataset=a}}),Object.defineProperty(this,"specification",{get:function(){return this._definition.specification},set:function(a){this._definition.specification=a}}),Object.defineProperty(this,"override",{get:function(){return this._definition.override},set:function(a){this._definition.override=a}}),Object.defineProperty(this,"tooltip",{get:function(){return this._definition.tooltip},set:function(a){this._definition.tooltip=a,void 0!==this._definition.tooltip.id&&null!==this._definition.tooltip.id||(this._definition.tooltip.id="cedar-"+Date.now())}}),e.tooltip&&"object"==typeof e.tooltip)this.tooltip=e.tooltip;else{var f=[];for(var g in this._definition.dataset.mappings)if(this._definition.dataset.mappings.hasOwnProperty(g)){var h=this._definition.dataset.mappings[g].field;void 0!==h&&null!==h&&f.push(h)}f.length>=2&&(this.tooltip={title:"{"+f[0]+"}",content:"{"+f[1]+"}"})}};return d.prototype.baseUrl=c,d.prototype.chartTypes=["bar","bar-horizontal","bubble","grouped","pie","scatter","sparkline","time","time-trendline"],d.prototype.canDraw=function(){return{drawable:!0,errs:[]}},d.prototype.show=function(a){if(this._pendingXhr)this._addToMethodQueue("show",[a]);else{var c;if(a.elementId||(c="Cedar.show requires options.elementId"),null===b.select(a.elementId)[0][0]&&(c="Element "+a.elementId+" is not present in the DOM"),this._elementId=a.elementId,this._renderer=a.renderer||"svg",this.width=a.width||void 0,this.height=a.height||void 0,void 0!==a.autolabels&&null!==a.autolabels&&(this.autolabels=a.autolabels),a.token&&(this._token=a.token),c)throw new Error(c);var d=this.canDraw();if(!d.drawable){var e=d.issues.join(",");throw new Error("Chart can not be drawn because: "+e)}this.update()}},d.prototype.update=function(){var a=this;if(this._view&&this.emit("update-start"),this._pendingXhr)this._addToMethodQueue("update");else{this._view&&this._remove(this._view);try{void 0!==a._definition.tooltip&&null!==a._definition.tooltip&&a._createTooltip(a._definition.tooltip.id);var b=d._applyDefaultsToMappings(this._definition.dataset.mappings,this._definition.specification.inputs),c=d._mixin({},this._definition.specification.query,this._definition.dataset.query);c=JSON.parse(d._supplant(JSON.stringify(c),b)),b.query=c;var e=JSON.parse(d._supplant(JSON.stringify(this._definition.specification.template),b));if(e=d._mergeRecursive(e,this._definition.override),e.data[0].url&&delete e.data[0].url,this._definition.dataset.data)e.data[0].values=this._definition.dataset.data,this._renderSpec(e);else{var f=d._createFeatureServiceRequest(this._definition.dataset,c),g=function(b,c){if(b)throw new Error("Error fetching data, ",b);if(c.error){var d=c.error.message||c.error.details[0];throw new Error(d)}e.data[0].values=c,console.dir(e),a._renderSpec(e)};d.getJson(f,g)}}catch(a){throw a}}},d.prototype._renderSpec=function(c){var d=this;d.autolabels===!0&&(c=d._placeLabels(c),c=d._placeaAxisTicks(c)),a.parse.spec(c,function(a){d._view=a({el:d._elementId,renderer:d._renderer});var c=d.width||parseInt(b.select(d._elementId).style("width"),10)||500,e=d.height||parseInt(b.select(d._elementId).style("height"),10)||500;d._view.width(c).height(e).update(),d._attach(d._view),d._view&&d.emit("update-end")})},d.prototype._placeLabels=function(a){var b=this;try{var c={},d={},e=[];for(var f in b._definition.dataset.mappings)if(b._definition.dataset.mappings.hasOwnProperty(f)){var g=b._definition.dataset.mappings[f].field;void 0!==g&&null!==g&&(e.push(f),c[f]=g,d[f]=0)}var h=0;return a.data[0].values.features.forEach(function(a){e.forEach(function(b){h=(a.attributes[c[b]]||"").toString().length,h>d[b]&&(d[b]=h)})}),e.forEach(function(b,c){var e=0;void 0!==a.axes&&void 0!==a.axes[c]&&(void 0!==a.axes[c].properties.labels.angle&&(e=a.axes[c].properties.labels.angle.value),"y"==a.axes[c].type&&(e=100-e),a.axes[c].titleOffset=Math.abs(d[b]*e/100*8)+35)}),a}catch(a){throw a}},d.prototype._placeaAxisTicks=function(a){var c=this;if(void 0!==a.axes)try{var d=c.width||parseInt(b.select(c._elementId).style("width"),10)||500,e=c.height||parseInt(b.select(c._elementId).style("height"),10)||500;a.axes[0].ticks=d/100,void 0!==a.axes[1]&&(a.axes[1].ticks=e/30)}catch(a){throw a}return a},d.prototype.select=function(a){var b=this,c=this._view,d=c.model().scene().items[0].items[0].items;return d.forEach(function(c){c.datum.attributes[a.key]===a.value&&c.hasPropertySet("hover")&&b._view.update({props:"hover",items:c})}),d},d.prototype.clearSelection=function(a){var b=this,c=this._view;if(a&&a.key){var d=c.model().scene().items[0].items[0].items;return d.forEach(function(c){c.datum.attributes[a.key]===a.value&&b._view.update({props:"update",items:c})}),d}return b._view.update(),null},d.prototype.emit=function(a){this._view._handler._handlers[a]&&void 0!==this._view._handler._handlers[a][0]&&this._view._handler._handlers[a][0].handler()},d.prototype._attach=function(a){a.on("mouseover",this._handler("mouseover")),a.on("mouseout",this._handler("mouseout")),a.on("mousemove",this._handler("mousemove")),a.on("click",this._handler("click")),a.on("update-start",this._handler("update-start")),a.on("update-end",this._handler("update-end"))},d.prototype._remove=function(a){a.off("mouseover"),a.off("mouseout"),a.off("mousemove"),a.off("click"),a.off("update-start"),a.off("update-end")},d._validateMappings=function(a,b){for(var c,d=[],e=0;e0)for(var b=0;b
";d+="

"+this._definition.tooltip.content+"

",c.innerHTML=d.replace(/\{(\w+)\}/g,function(a,c){return b[c]})},d._mixin=function(a){for(var c=1;c2e3){var e=a.split("?");b.xhr(e[0]).header("Content-Type","application/x-www-form-urlencoded").post(e[1],d)}else b.xhr(a).get(d)},d._createFeatureServiceRequest=function(a,b){var c=d._mixin({},d._defaultQuery(),b);if(c.bbox){if(c.geometry)throw new Error("Dataset.query can not have both a geometry and a bbox specified");var e=c.bbox.split(",");delete c.bbox,c.geometry=JSON.stringify({xmin:e[0],ymin:e[2],xmax:e[1],ymax:e[3]}),c.inSR="4326"}!c.groupByFieldsForStatistics&&a.mappings.group&&(c.groupByFieldsForStatistics=a.mappings.group.field),!c.outStatistics&&a.mappings.count&&(c.orderByFields=a.mappings.count.field+"_SUM",c.outStatistics=JSON.stringify([{statisticType:"sum",onStatisticField:a.mappings.count.field,outStatisticFieldName:a.mappings.count.field+"_SUM"}])),a.mappings.sort&&(c.orderByFields=a.mappings.sort);var f=a.url+"/query?"+this._serializeQueryParams(c);return a.token&&(f=f+"&token="+a.token),f},d._applyDefaultsToMappings=function(a,b){for(var c=[],d=0;d0)throw new Error("Required Mappings Missing: "+c.join(","));return a},d._supplant=function(a,b){var c=a.replace(/{([^{}]*)}/g,function(a,c){var e=d._getTokenValue(b,c);return"string"==typeof e||"number"==typeof e?e:a});return c.replace(/"{([^{}]*)}"/g,function(a,c){var e=d._getTokenValue(b,c);return e.constructor===Array?e=JSON.stringify(e):a})},d._mergeRecursive=function(a,b){for(var c in b)if(b.hasOwnProperty(c))try{b[c].constructor===Object||b[c].constructor===Array?a[c]=d._mergeRecursive(a[c],b[c]):a[c]=b[c]}catch(d){a[c]=b[c]}return a},d._getTokenValue=function(a,b){for(var c=a,d=b.split("."),e=0;e= 2) {\n this.tooltip = {\n \"title\": \"{\" + inputs[0] + \"}\",\n \"content\": \"{\" + inputs[1] + \"}\"\n };\n }\n }\n};\n\n// base URL of this library\nCedar.prototype.baseUrl = baseUrl;\n\n/**\n * Default pre-defined chart types\n *\n * ['bar', 'bar-horizontal', 'bubble', 'grouped', 'pie', 'scatter', 'sparkline', 'time'];\n */\nCedar.prototype.chartTypes = ['bar', 'bar-horizontal', 'bubble', 'grouped', 'pie', 'scatter', 'sparkline', 'time', 'time-trendline'];\n\n/**\n * Inspect the current state of the object\n * and determine if we have sufficient information\n * to render the chart\n * @return {object} Hash of the draw state + any missing requirements\n */\nCedar.prototype.canDraw = function(){\n\n //dataset?\n //dataset.url || dataset.data?\n //dataset.mappings?\n //specification?\n //specification.template?\n //specification.inputs?\n //specification.inputs ~ dataset.mappings?\n\n return {drawable:true, errs:[]};\n\n};\n\n/**\n * Draw the chart into the DOM element\n *\n * @example\n *\n * var chart = new Cedar({\n * \"type\": \"scatter\",\n * \"dataset\":{\n * \"url\":\"http://maps2.dcgis.dc.gov/dcgis/rest/services/DCGIS_DATA/Education_WebMercator/MapServer/5\",\n * \"query\":{},\n * \"mappings\":{\n * \"x\": {\"field\":\"POPULATION_ENROLLED_2008\",\"label\":\"Enrolment 2008\"},\n * \"y\": {\"field\":\"SQUARE_FOOTAGE\",\"label\":\"Square Footage\"},\n * \"color\":{\"field\":\"FACUSE\",\"label\":\"Facility Type\"}\n * }\n * }\n * });\n *\n * chart.show({\n * elementId: \"#chart\"\n * });\n *\n * @param {object} options\n * @param {String} options.elementId [required] Id of the Dom element into which the chart will be rendered\n * @param {String} options.renderer \"canvas\" or \"svg\" (default: `svg`)\n * @param {Boolean} options.autolabels place axis labels outside any tick labels (default: false)\n * @param {String} options.token Token to be used if the data or spec are on a secured server\n */\nCedar.prototype.show = function(options){\n if(this._pendingXhr){\n\n this._addToMethodQueue('show', [options]);\n\n }else{\n\n var err;\n //ensure we got an elementId\n if( !options.elementId ){\n err= \"Cedar.show requires options.elementId\";\n }\n //check if element exists in the page\n if(d3.select(options.elementId)[0][0] === null){\n err = \"Element \" + options.elementId + \" is not present in the DOM\";\n }\n\n //hold onto the id\n this._elementId = options.elementId;\n this._renderer = options.renderer || \"svg\"; //default to svg\n this.width = options.width || undefined; // if not set in API, always base on current div size\n this.height = options.height || undefined;\n if(options.autolabels !== undefined && options.autolabels !== null){\n this.autolabels = options.autolabels;\n }\n //hold onto the token\n if(options.token){\n this._token = options.token;\n }\n\n if( err ){\n throw new Error( err );\n }\n var chk = this.canDraw();\n if(chk.drawable){\n //update centralizes the spec compilation & drawing\n this.update();\n }else{\n //report the issues\n var errs = chk.issues.join(',');\n throw new Error('Chart can not be drawn because: ' + errs);\n }\n\n }\n};\n\n/**\n * Draw the chart based on any changes to data or specifications\n * Should be called after a user modifies\n * the dataset, query, mappings, chart specification or element size\n *\n * @example\n * dataset = {\"url\": \"...\", \"mappings\": {\"x\": {\"field\": \"STATE\"}, \"y\": {\"field\": \"POPULATION\"}}};\n * chart = new Cedar({ \"type\": \"bar\", \"dataset\": dataset });\n * chart.show({elementId: \"#chart\"});\n * chart.dataset.query.where = \"POPULATION>30000\";\n * chart.update();\n */\nCedar.prototype.update = function(){\n var self = this;\n\n if ( this._view ) {\n this.emit('update-start');\n }\n\n if(this._pendingXhr){\n\n this._addToMethodQueue('update');\n\n }else{\n\n if(this._view){\n //remove handlers\n //TODO Remove existing handlers\n this._remove(this._view);\n }\n try{\n\n // Creates the HTML Div and styling if not already created\n if(self._definition.tooltip !== undefined && self._definition.tooltip !== null) {\n self._createTooltip(self._definition.tooltip.id);\n }\n\n //ensure we have required inputs or defaults\n var compiledMappings = Cedar._applyDefaultsToMappings(this._definition.dataset.mappings, this._definition.specification.inputs); //Cedar._compileMappings(this._definition.dataset, this._definition.specification.inputs);\n\n var queryFromSpec = Cedar._mixin({}, this._definition.specification.query, this._definition.dataset.query);\n queryFromSpec = JSON.parse(Cedar._supplant(JSON.stringify(queryFromSpec), compiledMappings));\n\n //allow binding to query properties\n compiledMappings.query = queryFromSpec;\n\n //compile the template + mappings --> vega spec\n var spec = JSON.parse(Cedar._supplant(JSON.stringify(this._definition.specification.template), compiledMappings));\n\n // merge in user specified style overrides\n spec = Cedar._mergeRecursive(spec, this._definition.override);\n\n //if the spec has a url in the data node, delete it\n if(spec.data[0].url){\n delete spec.data[0].url;\n }\n\n if(this._definition.dataset.data){\n\n //create the data node using the passed in data\n spec.data[0].values = this._definition.dataset.data;\n\n //send to vega\n this._renderSpec(spec);\n\n }else{\n\n //we need to fetch the data so\n var url = Cedar._createFeatureServiceRequest(this._definition.dataset, queryFromSpec);\n\n //create a callback closure to carry the spec\n var cb = function(err,data){\n\n if (err) {\n throw new Error('Error fetching data, ', err);\n } else if ( data.error ) {\n var xhrErr = data.error.message || data.error.details[0];\n throw new Error(xhrErr);\n }\n //todo add error handlers for xhr and ags errors\n spec.data[0].values = data;\n console.dir(spec);\n //send to vega\n self._renderSpec(spec);\n\n };\n\n //fetch the data from the service\n Cedar.getJson(url, cb);\n }\n }\n catch(ex){\n throw(ex);\n }\n }\n};\n\n/**\n * Render a compiled Vega specification using Vega Runtime\n * @access private\n */\nCedar.prototype._renderSpec = function(spec){\n var self = this;\n // try{\n if(self.autolabels === true) {\n spec = self._placeLabels(spec);\n spec = self._placeaAxisTicks(spec);\n }\n //use vega to parse the spec\n //it will handle the spec as an object or url\n vg.parse.spec(spec, function(chartCtor) {\n\n //create the view\n self._view = chartCtor({\n el: self._elementId,\n renderer: self._renderer\n });\n\n\n var width = self.width || parseInt(d3.select(self._elementId).style('width'), 10) || 500;\n var height = self.height || parseInt(d3.select(self._elementId).style('height'), 10) || 500;\n\n //render into the element\n self._view.width(width).height(height).update();\n\n //attach event proxies\n self._attach(self._view);\n\n if ( self._view ) {\n self.emit('update-end');\n }\n\n });\n // }\n // catch(ex){\n // throw(ex);\n // }\n};\n\n/**\n * Automatically determines axis title placement\n *\n * Calculates the maximum length of a tick label and adds padding\n * @todo remove expectation that there are both x,y axes\n *\n * @access private\n */\nCedar.prototype._placeLabels = function(spec) {\n var self = this;\n try{\n var fields = {};\n var lengths = {};\n var inputs = [];\n // Get all inputs that may be axes\n for(var input in self._definition.dataset.mappings){\n // check also if property is not inherited from prototype\n if (self._definition.dataset.mappings.hasOwnProperty(input)) {\n var field = self._definition.dataset.mappings[input].field;\n if(field !== undefined && field !== null) {\n inputs.push(input);\n fields[input] = field;\n lengths[input] = 0;\n }\n }\n }\n var length = 0;\n\n // Find the max length value for each axis\n spec.data[0].values.features.forEach(function(feature) {\n inputs.forEach(function(axis) {\n length = (feature.attributes[fields[axis]] || \"\").toString().length;\n if( length > lengths[axis]) {\n lengths[axis] = length;\n }\n });\n });\n\n // Change each axis title offset based on longest value\n inputs.forEach(function(axis, index) {\n var angle = 0;\n if(spec.axes !== undefined && spec.axes[index] !== undefined) {\n\n if (spec.axes[index].properties.labels.angle !== undefined) {\n angle = spec.axes[index].properties.labels.angle.value;\n }\n if(spec.axes[index].type == 'y' ) {\n angle = 100 - angle;\n }\n spec.axes[index].titleOffset = Math.abs(lengths[axis] * angle/100 * 8) + 35;\n //chart._view.model().defs().marks.axes[index].titleOffset = lengths[axis]*4+20\n }\n });\n return spec;\n\n } catch(ex) {\n throw(ex);\n }\n};\n\n/**\n * Automatically determines number of axis tick marks\n *\n * Calculates the maximum length of a tick label and adds padding\n * @todo remove expectation that there are both x,y axes\n *\n * @access private\n */\nCedar.prototype._placeaAxisTicks = function(spec) {\n var self = this;\n if(spec.axes !== undefined) {\n try{\n var width = self.width || parseInt(d3.select(self._elementId).style('width'), 10) || 500;\n var height = self.height || parseInt(d3.select(self._elementId).style('height'), 10) || 500;\n\n spec.axes[0].ticks = width / 100;\n if(spec.axes[1] !== undefined) {\n spec.axes[1].ticks = height / 30;\n }\n } catch(ex) {\n throw(ex);\n }\n }\n\n return spec;\n};\n\n/**\n * Highlight marker based on attribute value\n *\n * @example\n * chart = new Cedar({...});\n * chart.select({key: \"ZIP_CODE\", value: \"20002\"});\n *\n * @param {Object} options - Object(key, value) to match. Calls hover on mark\n * @returns {Array} items - array of chart objects that match the criteria\n */\nCedar.prototype.select = function( options ) {\n var self = this;\n var view = this._view;\n var items = view.model().scene().items[0].items[0].items;\n\n items.forEach(function(item) {\n if ( item.datum.attributes[options.key] === options.value ) {\n if ( item.hasPropertySet(\"hover\") ) {\n self._view.update({props:\"hover\", items:item});\n }\n }\n });\n\n return items;\n\n};\n\n\n/**\n * Removes highlighted chart items\n *\n * If \"options\" are used, only clear specific items, otherwise clears all highlights.\n * @param {Object} options - Object(key, value) to match. Calls hover on mark\n * @returns {Array} items - array of chart objects that match the criteria, or null if all items.\n */\nCedar.prototype.clearSelection = function( options ) {\n var self = this;\n var view = this._view;\n\n if ( options && options.key ) {\n var items = view.model().scene().items[0].items[0].items;\n items.forEach(function(item) {\n if ( item.datum.attributes[options.key] === options.value ) {\n self._view.update({props:\"update\", items:item});\n }\n });\n return items;\n } else {\n //clear all\n self._view.update();\n return null;\n }\n};\n\n\n/**\n * Trigger a callback\n * @param {Strint} eventName - [\"mouseover\",\"mouseout\",\"click\",\"update-start\",\"update-end\"]\n */\nCedar.prototype.emit = function(eventName) {\n if (this._view._handler._handlers[ eventName ] && this._view._handler._handlers[ eventName ][0] !== undefined){\n this._view._handler._handlers[ eventName ][0].handler();\n }\n};\n\n/**\n * Attach the generic proxy handlers to the chart view\n * @access private\n */\nCedar.prototype._attach = function(view){\n\n view.on('mouseover', this._handler('mouseover'));\n view.on('mouseout', this._handler('mouseout'));\n view.on('mousemove', this._handler('mousemove'));\n view.on('click', this._handler(\"click\"));\n view.on('update-start', this._handler('update-start'));\n view.on('update-end', this._handler('update-end'));\n\n};\n\n/**\n * Remove all event handlers from the view\n * @access private\n */\nCedar.prototype._remove = function(view){\n\n view.off('mouseover');\n view.off('mouseout');\n view.off('mousemove');\n view.off('click');\n view.off('update-start');\n view.off('update-end');\n\n};\n\n/**\n * Helper function that validates that the\n * mappings hash contains values for all\n * the inputs\n * @param {array} inputs Array of inputs\n * @param {object} mappings Hash of mappings\n * @return {array} Missing mappings\n * @access private\n */\nCedar._validateMappings = function(inputs, mappings){\n var missingInputs = [], input;\n for(var i=0;i 0){\n\n for(var i=0;i\" + this._definition.tooltip.title + \"
\";\n content += \"

\" + this._definition.tooltip.content + \"

\";\n\n cedartip.innerHTML = content.replace( /\\{(\\w+)\\}/g, function replacer(match, $1){\n return data[$1];\n } );\n\n};\n\n\n/**\n* @access private\n*/\nCedar._mixin = function(source) {\n /*jshint loopfunc: true*/\n // TODO: prob should replace w/ forEach()\n for (var i = 1; i < arguments.length; i++) {\n d3.entries(arguments[i]).forEach(function(p) {\n source[p.key] = p.value;\n });\n }\n return source;\n};\n\n/**\n * Helper function to request JSON from a URL\n * @param {String} url URL to json file\n * @param {Function} callback node-style callback function (error, data)\n */\nCedar.getJson = function( url, callback ){\n var cb = function(err,data) {\n if(err){\n callback('Error loading ' + url + ' ' + err.message);\n }\n callback(null, JSON.parse(data.responseText));\n };\n if(url.length > 2000) {\n var uri = url.split(\"?\");\n d3.xhr(uri[0])\n .header(\"Content-Type\", \"application/x-www-form-urlencoded\")\n .post(uri[1], cb);\n } else {\n d3.xhr(url).get(cb);\n }\n};\n/**\n * Given a dataset hash, create the feature service\n * query string\n * @access private\n */\nCedar._createFeatureServiceRequest = function( dataset, queryFromSpec ) {\n var mergedQuery = Cedar._mixin({}, Cedar._defaultQuery(), queryFromSpec);\n\n //Handle bbox\n if(mergedQuery.bbox){\n //make sure a geometry was not also passed in\n if(mergedQuery.geometry){\n throw new Error('Dataset.query can not have both a geometry and a bbox specified');\n }\n //get the bbox (W,S,E,N)\n var bboxArr = mergedQuery.bbox.split(',');\n\n //remove it so it's not serialized as-is\n delete mergedQuery.bbox;\n\n //cook it into a json string\n mergedQuery.geometry = JSON.stringify({\"xmin\": bboxArr[0], \"ymin\": bboxArr[2],\"xmax\": bboxArr[1], \"ymax\": bboxArr[3] });\n //set the spatial ref as geographic\n mergedQuery.inSR = '4326';\n }\n if(!mergedQuery.groupByFieldsForStatistics && dataset.mappings.group) {\n mergedQuery.groupByFieldsForStatistics = dataset.mappings.group.field;\n }\n if(!mergedQuery.outStatistics && dataset.mappings.count) {\n // Why are we explicitly statting _SUM as stats type?\n mergedQuery.orderByFields = dataset.mappings.count.field + \"_SUM\";\n mergedQuery.outStatistics = JSON.stringify([{\"statisticType\": \"sum\", \"onStatisticField\": dataset.mappings.count.field, \"outStatisticFieldName\": dataset.mappings.count.field + \"_SUM\"}]);\n }\n\n\n\n //iterate the mappings keys to check for sort\n //-----------------------------------------------------------------\n //This approach would seem 'clean' but if there are multiple fields\n //to sort by, the order would be determined by how javascript decides to\n //iterate the mappings property hash.\n //Thus, using mappings.sort gives the developer explicit control\n //-----------------------------------------------------------------\n // var sort = [];\n // for (var property in dataset.mappings) {\n // if (dataset.mappings.hasOwnProperty(property)) {\n // if(dataset.mappings[property].sort){\n // //ok - build up the sort\n // sort.push(dataset.mappings[property].field + ' ' + dataset.mappings[property].sort);\n // }\n // }\n // }\n // if(sort.length > 0){\n // mergedQuery.orderByFields = sort.join(',');\n // }\n //-----------------------------------------------------------------\n //check for a sort passed directly in\n if(dataset.mappings.sort){\n mergedQuery.orderByFields = dataset.mappings.sort;\n }\n\n var url = dataset.url + \"/query?\" + this._serializeQueryParams(mergedQuery);\n\n if(dataset.token){\n url = url + '&token=' + dataset.token;\n }\n\n return url;\n};\n\n/**\n* @access private\n*/\nCedar._applyDefaultsToMappings = function(mappings, inputs){\n var errs = [];\n //loop over the inputs\n for(var i =0; i < inputs.length; i++){\n //get the input\n var input = inputs[i];\n\n //if it's required and not in the mappings, add an exception\n if(input.required && !mappings[input.name] ){\n errs.push(input.name);\n }\n\n //if it's not required, has a default and not in the mappings\n if(!input.required && !mappings[input.name] && input['default']){\n //add the default\n mappings[input.name] = input['default'];\n }\n }\n\n if(errs.length > 0){\n throw new Error('Required Mappings Missing: ' + errs.join(','));\n }else{\n return mappings;\n }\n};\n\n\n/**\n * Token Replacement on a string\n * @param {string} template string template\n * @param {object} params object hash that maps to the tokens to be replaced\n * @return {string} string with values replaced\n * @access private\n */\nCedar._supplant = function( tmpl, params ){\n var t = tmpl.replace(/{([^{}]*)}/g,\n function (a, b) {\n var r = Cedar._getTokenValue(params, b);\n\n return typeof r === 'string' || typeof r === 'number' ? r : a;\n }\n );\n return t.replace(/\"{([^{}]*)}\"/g,\n function(a, b) {\n var r = Cedar._getTokenValue(params, b);\n return r.constructor === Array ? r = JSON.stringify(r) : a;\n }\n );\n};\n\n/*\n * Recursively merge properties of two objects\n * @access private\n */\nCedar._mergeRecursive = function(obj1, obj2) {\n for (var p in obj2) {\n if (obj2.hasOwnProperty(p)) {\n try {\n // Property in destination object set; update its value.\n if ( obj2[p].constructor===Object || obj2[p].constructor===Array) {\n obj1[p] = Cedar._mergeRecursive(obj1[p], obj2[p]);\n\n } else {\n obj1[p] = obj2[p];\n\n }\n\n } catch(e) {\n // Property in destination object not set; create it and set its value.\n obj1[p] = obj2[p];\n\n }\n }\n }\n\n return obj1;\n};\n\n/**\n * Get the value of a token from a hash\n * @param {[type]} tokens [description]\n * @param {[type]} tokenName [description]\n * @return {[type]} [description]\n * Pulled from gulp-token-replace (MIT license)\n * https://github.com/Pictela/gulp-token-replace/blob/master/index.js\n *\n * @access private\n */\nCedar._getTokenValue = function(tokens, tokenName) {\n var tmpTokens = tokens;\n var tokenNameParts = tokenName.split('.');\n for (var i = 0; i < tokenNameParts.length; i++) {\n if (tmpTokens.hasOwnProperty(tokenNameParts[i])) {\n tmpTokens = tmpTokens[tokenNameParts[i]];\n } else {\n return null;\n }\n }\n return tmpTokens;\n};\n\n/**\n * Serilize an object into a query string\n *\n * @param {object} params Params for the query string\n * @return {string} query string\n * @access private\n */\nCedar._serializeQueryParams = function(params) {\n var str = [];\n for(var p in params){\n if (params.hasOwnProperty(p)) {\n var val = params[p];\n if (typeof val !== \"string\") {\n val = JSON.stringify(val);\n }\n str.push(encodeURIComponent(p) + \"=\" + encodeURIComponent(val));\n }\n }\n var queryString = str.join(\"&\");\n return queryString;\n};\n\n return Cedar;\n}));\n"]} \ No newline at end of file diff --git a/dist/charts/bar-horizontal.json b/dist/charts/bar-horizontal.json new file mode 100644 index 00000000..44ad9cf3 --- /dev/null +++ b/dist/charts/bar-horizontal.json @@ -0,0 +1,119 @@ +{ + "inputs": [ + { "name": "x", "type": [ "numeric", "string" ], "required": true }, + { "name": "y", "type": [ "string" ], "required": true } + ], + "query": { + "orderByFields": "{x.field} DESC", + "groupByFieldsForStatistics": "{y.field}", + "outStatistics": [{ + "statisticType": "sum", + "onStatisticField": "{x.field}", + "outStatisticFieldName": "{x.field}" + }] + }, + "template":{ + "padding": "strict", + "axes": [ + { + "type": "x", + "scale": "x", + "titleOffset": 45, + "title": "{x.label}", + "tickPadding": 10, + "properties": { + "title": { + "fontSize": {"value": 15}, + "fill": {"value": "#999"}, + "fontWeight": {"value": "normal"} + }, + "axis": { + "stroke": {"value": "#dbdad9"}, + "strokeWidth": {"value": 1.5} + }, + "ticks": { + "stroke": {"value": "#dbdad9"} + }, + "labels": { + "fill": {"value": "#999"}, + "angle": {"value": 0}, + "baseline": {"value": "middle"} + } + } + }, + { + "type": "y", + "scale": "y", + "titleOffset": 25, + "title": "{y.label}", + "padding": 0.25, + "properties": { + "title": { + "fontSize": {"value": 15}, + "fill": {"value": "#999"}, + "fontWeight": {"value": "normal"} + }, + "axis": { + "stroke": {"value": "#dbdad9"}, + "strokeWidth": {"value": 1.5} + }, + "ticks": { + "stroke": {"value": "#dbdad9"} + }, + "labels": { + "fill": {"value": "#999"}, + "angle": {"value": 0}, + "baseline": {"value": "middle"} + } + } + } + ], + "data": [ + { + "name": "table", + "format": {"property": "features"} + } + ], + "marks": [ + { + "from": {"data": "table"}, + "properties": { + "enter": { + "height": {"band": true, "offset": -1, "scale": "y"}, + "y": {"scale": "y", "field": "attributes.{y.field}"}, + "x2": {"scale": "x", "field": "attributes.{x.field}"}, + "x": {"scale": "x", "value": 0 } + }, + "hover": { + "fill": {"value": "#29b6ea"} + }, + "update": { + "fill": {"value": "#0079c1"} + } + }, + "type": "rect" + } + ], + "scales": [ + { + "domain": { + "data": "table", + "field": "attributes.{y.field}" + }, + "name": "y", + "range": "height", + "type": "ordinal", + "padding": 0.25 + }, + { + "domain": { + "data": "table", + "field": "attributes.{x.field}" + }, + "name": "x", + "nice": true, + "range": "width" + } + ] + } +} \ No newline at end of file diff --git a/dist/charts/bar.json b/dist/charts/bar.json new file mode 100644 index 00000000..e977dcd2 --- /dev/null +++ b/dist/charts/bar.json @@ -0,0 +1,108 @@ +{ + "inputs": [ + { "name": "x", "type": [ "string" ], "required": true }, + { "name": "y", "type": [ "numeric" ], "required": true } + ], + "query": {}, + "template":{ + "padding": "strict", + "axes": [ + { + "type": "x", + "scale": "x", + "titleOffset": 45, + "title": "{x.label}", + "properties": { + "title": { + "fontSize": {"value": 15}, + "fill": {"value": "#999"}, + "fontWeight": {"value": "normal"} + }, + "axis": { + "stroke": {"value": "#dbdad9"}, + "strokeWidth": {"value": 1.5} + }, + "ticks": { + "stroke": {"value": "#dbdad9"} + }, + "labels": { + "fill": {"value": "#999"}, + "angle": {"value": -50}, + "align": {"value": "right"}, + "baseline": {"value": "middle"} + } + } + }, + { + "type": "y", + "scale": "y", + "titleOffset": 45, + "title": "{y.label}", + "properties": { + "title": { + "fontSize": {"value": 15}, + "fill": {"value": "#999"}, + "fontWeight": {"value": "normal"} + }, + "axis": { + "stroke": {"value": "#dbdad9"}, + "strokeWidth": {"value": 1.5} + }, + "ticks": { + "stroke": {"value": "#dbdad9"} + }, + "labels": { + "fill": {"value": "#999"} + } + } + } + ], + "data": [ + { + "name": "table", + "format": {"property": "features"} + } + ], + "marks": [ + { + "from": {"data": "table"}, + "properties": { + "enter": { + }, + "update": { + "width": {"band": true, "offset": -1, "scale": "x"}, + "x": {"field": "attributes.{x.field}", "scale": "x"}, + "y": {"field": "attributes.{y.field}", "scale": "y"}, + "y2": {"scale": "y", "value": 0 }, + "fill": {"value": "#0079c1"} + }, + "hover": { + "fill": {"value": "#29b6ea"} + } + }, + "type": "rect" + } + ], + "scales": [ + { + "domain": { + "data": "table", + "field": "attributes.{x.field}" + }, + "name": "x", + "range": "width", + "type": "ordinal", + "padding": 0.25 + }, + { + "domain": { + "data": "table", + "field": "attributes.{y.field}" + }, + "name": "y", + "nice": true, + "range": "height" + } + ] + } +} \ No newline at end of file diff --git a/dist/charts/bubble.json b/dist/charts/bubble.json new file mode 100644 index 00000000..f799086d --- /dev/null +++ b/dist/charts/bubble.json @@ -0,0 +1,161 @@ +{ + "inputs": [ + {"name":"x","type":["numeric"], "required":true}, + {"name":"y","type":["numeric"], "required":true}, + {"name":"size","type":["numeric"], "default": 100, "required":false} + ], + "template":{ + "padding": "strict", + "data": [ + { + "name": "table", + "format": { + "property": "features" + } + } + ], + "scales": [ + { + "name": "x", + "nice": true, + "range": "width", + "domain": { + "data": "table", + "field": "attributes.{x.field}" + } + }, + { + "name": "y", + "nice": true, + "range": "height", + "domain": { + "data": "table", + "field": "attributes.{y.field}" + } + }, + { + "name": "size", + "type": "sqrt", + "domain": { + "data": "table", + "field": "attributes.{size.field}" + }, + "range": [0,2000] + } + ], + "axes": [ + { + "type": "x", + "scale": "x", + "offset": 5, + "ticks": 5, + "title": "{x.label}", + "properties": { + "title": { + "fontSize": {"value": 15}, + "fill": {"value": "#999"}, + "fontWeight": {"value": "normal"} + }, + "ticks": { + "stroke": {"value": "#dbdad9"} + }, + "labels": { + "fill": {"value": "#999"}, + "angle": {"value": 0}, + "fontSize": {"value": 14}, + "align": {"value": "left"}, + "baseline": {"value": "middle"}, + "dx": {"value": 3} + }, + "axis": { + "stroke": {"value": "#dbdad9"}, + "strokeWidth": {"value": 1.5} + } + } + }, + { + "type": "y", + "scale": "y", + "offset": 5, + "ticks": 5, + "title": "{y.label}", + "titleOffset": 50, + "properties": { + "title": { + "fontSize": {"value": 15}, + "fill": {"value": "#999"}, + "fontWeight": {"value": "normal"} + }, + "ticks": { + "stroke": {"value": "#dbdad9"} + }, + "labels": { + "fill": {"value": "#999"}, + "angle": {"value": 0}, + "fontSize": {"value": 14}, + "align": {"value": "right"} + }, + "axis": { + "stroke": {"value": "#dbdad9"}, + "strokeWidth": {"value": 1.5} + } + } + } + ], + "legends": [ + { + "title": "{size.label}", + "offset": 0, + "size": "size", + "properties": { + "title": { + "fontSize": {"value": 15}, + "fill": {"value": "#999"}, + "fontWeight": {"value": "bold"} + }, + "symbols": { + "strokeWidth": {"value": 2}, + "stroke": {"value": "#0079c1"}, + "fill": { "value": "#fff" }, + "fillOpacity": {"value": 0.4 } + } + } + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "table" + }, + "properties": { + "enter": { + "x": { + "scale": "x", + "field": "attributes.{x.field}" + }, + "y": { + "scale": "y", + "field": "attributes.{y.field}" + }, + "strokeWidth": {"value": 2}, + "fillOpacity": {"value": 0.4 }, + "size": { + "scale": "size", + "field": "attributes.{size.field}" + } + }, + "update": { + "fill": { "value": "#fff" }, + "stroke": {"value": "#0079c1"} + }, + "hover": { + "fill": {"value": "#0079c1"}, + "fillOpacity": {"value": 0.6 }, + "stroke": {"value": "#0079c1"} + } + } + } + ] + } +} \ No newline at end of file diff --git a/dist/charts/grouped.json b/dist/charts/grouped.json new file mode 100644 index 00000000..4b37059f --- /dev/null +++ b/dist/charts/grouped.json @@ -0,0 +1,232 @@ +{ + "inputs": [ + { + "name": "x", + "required": true, + "type": [ + "numeric", + "string" + ] + }, + { + "name": "group", + "required": true, + "type": [ + "string" + ] + } + ], + "query": {}, + "template": { + "axes": [ + { + "properties": { + "axis": { + "stroke": { + "value": "#dbdad9" + }, + "strokeWidth": { + "value": 1.5 + } + }, + "labels": { + "align": { + "value": "right" + }, + "angle": { + "value": -50 + }, + "baseline": { + "value": "middle" + }, + "fill": { + "value": "#999" + } + }, + "ticks": { + "stroke": { + "value": "#dbdad9" + } + }, + "title": { + "fill": { + "value": "#999" + }, + "fontSize": { + "value": 15 + }, + "fontWeight": { + "value": "normal" + } + } + }, + "scale": "cat", + "tickPadding": 8, + "tickSize": 0, + "type": "x" + }, + { + "grid": true, + "layer": "back", + "properties": { + "axis": { + "stroke": { + "value": "#dbdad9" + }, + "strokeWidth": { + "value": 1.5 + } + }, + "labels": { + "fill": { + "value": "#999" + } + }, + "ticks": { + "stroke": { + "value": "#dbdad9" + } + }, + "title": { + "fill": { + "value": "#999" + }, + "fontSize": { + "value": 15 + }, + "fontWeight": { + "value": "normal" + } + } + }, + "scale": "val", + "type": "y" + } + ], + "data": [ + { + "format": { + "property": "features" + }, + "name": "table", + "transform": [ + { + "fields": "{x.field}", + "output": { + "key": "group", + "value": "count" + }, + "type": "fold" + } + ] + } + ], + "legends": [ + { + "fill": "color", + "title": "{x.label}" + } + ], + "marks": [ + { + "from": { + "data": "table", + "transform": [ + { + "groupby": [ + "attributes.{group.field}" + ], + "type": "facet" + } + ] + }, + "marks": [ + { + "name": "bars", + "properties": { + "enter": { + "fill": { + "field": "group", + "scale": "color" + }, + "width": { + "band": true, + "scale": "pos" + }, + "x": { + "field": "group", + "scale": "pos" + }, + "y": { + "field": "count", + "scale": "val" + }, + "y2": { + "scale": "val", + "value": 0 + } + } + }, + "type": "rect" + } + ], + "properties": { + "enter": { + "height": { + "band": true, + "scale": "cat" + }, + "x": { + "field": "key", + "scale": "cat" + } + } + }, + "scales": [ + { + "domain": { + "field": "group" + }, + "name": "pos", + "range": "height", + "type": "ordinal" + } + ], + "type": "group" + } + ], + "padding": "strict", + "scales": [ + { + "domain": { + "data": "table", + "field": "attributes.{group.field}" + }, + "name": "cat", + "padding": 0.2, + "range": "width", + "type": "ordinal" + }, + { + "domain": { + "data": "table", + "field": "count" + }, + "name": "val", + "nice": true, + "range": "height", + "round": true, + "type": "linear" + }, + { + "domain": { + "data": "table", + "field": "group" + }, + "name": "color", + "range": "category20", + "type": "ordinal" + } + ] + } +} diff --git a/dist/charts/pie.json b/dist/charts/pie.json new file mode 100644 index 00000000..7c9c4c54 --- /dev/null +++ b/dist/charts/pie.json @@ -0,0 +1,79 @@ +{ + "inputs": [ + {"name": "y", "type": ["numeric","string"], "required": true}, + {"name": "label", "type": ["string"], "required": false}, + {"name": "radius", "type": ["numeric"], "default": 200, "required": false} + ], + "template":{ + "padding": "strict", + "data": [ + { + "name": "table", + "format": { + "property": "features" + }, + "transform": [ + {"type": "pie", "field": "attributes.{y.field}"}, + {"type": "formula", "field": "hyp", "expr": "{radius}"}, + {"type": "formula", "field": "theta", "expr": "datum.layout_start + 0.5 *(datum.layout_end - datum.layout_start) - 1.57079633"}, + {"type": "formula", "field": "x", "expr": "datum.hyp * cos(datum.theta)"}, + {"type": "formula", "field": "y", "expr": "datum.hyp * sin(datum.theta)"} + ] + } + ], + "scales": [ + { + "name": "r", + "type": "sqrt", + "domain": {"data": "table", "field": "attributes.{y.field}"} + }, + { + "name": "color", + "type": "ordinal", + "domain": { + "data": "table", + "field": "attributes.{y.field}" + }, + "range": "category10" + } + ], + "marks": [ + { + "type": "arc", + "from": {"data": "table"}, + "properties": { + "enter": { + "x": {"group": "width"}, + "y": {"group": "height"}, + "startAngle": {"field": "layout_start"}, + "endAngle": {"field": "layout_end"}, + "outerRadius": {"value": "{radius}"}, + "stroke": {"value": "#fff"} + }, + "update": { + "fill": {"value": "#0079c1"} + }, + "hover": { + "fill": {"value": "#29b6ea"} + } + } + }, + { + "type": "text", + "from": {"data": "table"}, + "properties": { + "enter": { + "fill": {"value": "#fff"}, + "y": {"field": "y", "mult": 0.6}, + "x": {"field": "x", "mult": 0.6}, + "fill": {"value": "#fff"}, + "align": {"value": "center"}, + "baseline": {"value": "middle"}, + "text": {"field": "attributes.{label.field}"} + } + } + } + ] + } + +} \ No newline at end of file diff --git a/dist/charts/scatter.json b/dist/charts/scatter.json new file mode 100644 index 00000000..9942207c --- /dev/null +++ b/dist/charts/scatter.json @@ -0,0 +1,165 @@ +{ + "inputs":[ + {"name":"x","type":["numeric"], "required":true}, + {"name":"y","type":["numeric"], "required":true}, + {"name":"color","type":["string"], "default": "#0079c1", "required":false} + ], + "template":{ + "padding": "strict", + "data": [ + { + "name": "table", + "format": { + "property": "features" + } + } + ], + "scales": [ + { + "name": "x", + "nice": true, + "range": "width", + "domain": { + "data": "table", + "field": "attributes.{x.field}" + } + }, + { + "name": "y", + "nice": true, + "range": "height", + "domain": { + "data": "table", + "field": "attributes.{y.field}" + } + }, + { + "name": "c", + "type": "ordinal", + "domain": { + "data": "table", + "field": "attributes.{color.field}" + }, + "range": "category10" + } + ], + "axes": [ + { + "type": "x", + "scale": "x", + "title": "{x.label}", + "tickPadding": 10, + "properties": { + "title": { + "fontSize": {"value": 15}, + "fill": {"value": "#999"}, + "fontWeight": {"value": "normal"} + }, + "axis": { + "stroke": {"value": "#dbdad9"}, + "strokeWidth": {"value": 1.5} + }, + "ticks": { + "stroke": {"value": "#dbdad9"} + }, + "labels": { + "fill": {"value": "#999"}, + "angle": {"value": 0}, + "fontSize": {"value": 14}, + "align": {"value": "center"}, + "baseline": {"value": "middle"} + } + } + }, + { + "type": "y", + "scale": "y", + "offset": 5, + "ticks": 5, + "title": "{y.label}", + "titleOffset": 50, + "properties": { + "title": { + "fontSize": {"value": 15}, + "fill": {"value": "#999"}, + "fontWeight": {"value": "normal"} + }, + "ticks": { + "stroke": {"value": "#dbdad9"} + }, + "labels": { + "fill": {"value": "#999"}, + "angle": {"value": 0}, + "fontSize": {"value": 14}, + "align": {"value": "right"} + }, + "axis": { + "stroke": {"value": "#dbdad9"}, + "strokeWidth": {"value": 1.5} + } + } + } + ], + "legends": [ + { + "fill": "c", + "title": "{color.label} ", + "offset": 0, + "properties": { + "symbols": { + "fillOpacity": { + "value": 0.5 + }, + "stroke": { + "value": "transparent" + } + } + } + } + ], + "marks": [ + { + "type": "symbol", + "from": { + "data": "table" + }, + "properties": { + "enter": { + "x": { + "scale": "x", + "field": "attributes.{x.field}" + }, + "y": { + "scale": "y", + "field": "attributes.{y.field}" + }, + "fill": { + "scale": "c", + "field": "attributes.{color.field}" + }, + "fillOpacity": { + "value": 0.5 + } + }, + "update": { + "size": { + "value": 100 + }, + "stroke": { + "value": "transparent" + } + }, + "hover": { + "size": { + "value": 300 + }, + "stroke": { + "value": "white" + } + } + } + } + ] + } + +} \ No newline at end of file diff --git a/dist/charts/sparkline.json b/dist/charts/sparkline.json new file mode 100644 index 00000000..cda11e2c --- /dev/null +++ b/dist/charts/sparkline.json @@ -0,0 +1,41 @@ +{ + "inputs": [ + { "name": "x", "type": [ "datetime" ], "required": true }, + { "name": "y", "type": [ "number" ], "required": true } + ], + "template":{ + "data": [{ + "name": "table", + "format": {"type": "json", "parse": {"attributes.{x.field}":"date"}} + }], + "padding": {"top": 0, "left": 0, "bottom": 0, "right": 0}, + "scales": [ + { + "name": "x", + "type": "time", + "range": "width", + "zero": false, + "domain": {"data": "table", "field": "attributes.{x.field}"} + }, + { + "name": "y", + "type": "linear", + "range": "height", + "zero": false, + "domain": {"data": "table", "field": "attributes.{y.field}"} + } + ], + "marks": [{ + "type": "line", + "from": {"data": "table"}, + "properties": { + "enter": { + "x": {"scale": "x", "field": "attributes.{x.field}"}, + "y": {"scale": "y", "field": "attributes.{y.field}"}, + "stroke": {"value": "#f00"}, + "strokeWidth": {"value": 1} + } + } + }] + } +} \ No newline at end of file diff --git a/dist/charts/time-trendline.json b/dist/charts/time-trendline.json new file mode 100644 index 00000000..2f67b981 --- /dev/null +++ b/dist/charts/time-trendline.json @@ -0,0 +1,116 @@ +{ + "inputs":[ + {"name":"time","type":["time"], "required":true}, + {"name":"value","type":["numeric"], "required":true}, + {"name":"trendline","type":["numeric"], "required":true} + ], + "template":{ + "padding": "strict", + "data": [ + { + "name": "table", + "url":"{data}&orderByFields={time.field}", + "format": {"type": "json", "property": "features", "parse": {"attributes.{time.field}":"date"}} + }, + { + "name": "exports", + "source": "table", + "transform": [ + {"type": "formula", "field": "export", "expr": "datum"} + ] + } + ], + "scales": [ + { + "name": "x", + "type": "time", + "range": "width", + "nice": "month", + "zero": false, + "domain": {"data": "table", "field": "attributes.{time.field}"} + }, + { + "name": "y", + "type": "linear", + "range": "height", + "nice": true, + "domain": {"data": "table", "field": "attributes.{value.field}"} + } + ], + "axes": [ + { + "type": "x", + "scale": "x", + "properties": { + "title": { + "fontSize": {"value": 15}, + "fill": {"value": "#999"}, + "fontWeight": {"value": "normal"} + }, + "ticks": { + "strokeWidth" : {"value" :0} + }, + "labels": { + "fill": {"value": "#999"}, + "fontSize": {"value": 13} + }, + "axis": { + "stroke": {"value": "#dbdad9"}, + "strokeWidth": {"value": 0} + } + } + }, + { + "type": "y", + "scale": "y", + "ticks": 5, + "properties": { + "title": { + "fontSize": {"value": 15}, + "fill": {"value": "#999"}, + "fontWeight": {"value": "normal"} + }, + "ticks": { + "strokeWidth" : {"value" :0} + }, + "labels": { + "fill": {"value": "#999"}, + "fontSize": {"value": 13} + }, + "axis": { + "stroke": {"value": "#dbdad9"}, + "strokeWidth": {"value": 0} + } + } + } + ], + "marks": [ + { + "type": "line", + "from": {"data": "table"}, + "properties": { + "enter": { + "x": {"scale": "x", "field": "attributes.{time.field}"}, + "y": {"scale": "y", "field": "attributes.{value.field}"}, + "stroke": {"value": "#0079c1"}, + "strokeWidth" : { "value" : 3} + } + } + }, + { + "type": "line", + "from": {"data": "table"}, + "properties": { + "enter": { + "x": {"scale": "x", "field": "attributes.{time.field}"}, + "y": {"scale": "y", "field": "attributes.{trendline.field}"}, + "stroke": {"value": "#000000"}, + "strokeWidth" : { "value" : 3}, + "strokeDash" : { "value" : [7, 2]} + } + } + } + + ] + } +} \ No newline at end of file diff --git a/dist/charts/time.json b/dist/charts/time.json new file mode 100644 index 00000000..818e7f5b --- /dev/null +++ b/dist/charts/time.json @@ -0,0 +1,122 @@ +{ + "inputs":[ + {"name":"time","type":["time"], "required":true}, + {"name":"value","type":["numeric"], "required":true} + ], + "template":{ + "padding": "strict", + "data": [ + { + "name": "table", + "url":"{data}&orderByFields={time.field}", + "format": {"type": "json", "property": "features", "parse": {"attributes.{time.field}":"date"}} + }, + { + "name": "exports", + "source": "table", + "transform": [ + {"type": "formula", "field": "export", "expr": "datum"} + ] + } + ], + "scales": [ + { + "name": "x", + "type": "time", + "range": "width", + "zero": false, + "domain": {"data": "table", "field": "attributes.{time.field}"} + }, + { + "name": "y", + "type": "linear", + "range": "height", + "nice": true, + "domain": {"data": "table", "field": "attributes.{value.field}"} + } + ], + "axes": [ + { + "type": "x", + "scale": "x", + "properties": { + "title": { + "fontSize": {"value": 15}, + "fill": {"value": "#999"}, + "fontWeight": {"value": "normal"} + }, + "ticks": { + "stroke": {"value": "#dbdad9"} + }, + "labels": { + "fill": {"value": "#999"}, + "fontSize": {"value": 13} + }, + "axis": { + "stroke": {"value": "#dbdad9"}, + "strokeWidth": {"value": 1} + } + } + }, + { + "type": "y", + "scale": "y", + "ticks": 5, + "properties": { + "title": { + "fontSize": {"value": 15}, + "fill": {"value": "#999"}, + "fontWeight": {"value": "normal"} + }, + "ticks": { + "stroke": {"value": "#dbdad9"} + }, + "labels": { + "fill": {"value": "#999"}, + "fontSize": {"value": 13} + }, + "axis": { + "stroke": {"value": "#dbdad9"} + } + } + } + ], + "marks": [ + { + "type": "symbol", + "from": {"data": "table"}, + "properties": { + "enter": { + "x": {"scale": "x", "field": "attributes.{time.field}"}, + "y": {"scale": "y", "field": "attributes.{value.field}"}, + "stroke": {"value": "#0079c1"}, + "fill": {"value": "#0079c1"}, + "size": {"value": 20}, + "fillOpacity": { + "value": 0.8 + }, + "hover": { + "fill": {"value": "#0079c1"}, + "size": {"value": 25} + }, + "update": { + "fill": {"value": "#f00"} + } + } + } + }, + { + "type": "line", + "from": {"data": "table"}, + "properties": { + "enter": { + "x": {"scale": "x", "field": "attributes.{time.field}"}, + "y": {"scale": "y", "field": "attributes.{value.field}"}, + "y2": {"scale": "y", "value": 0}, + "stroke": {"value": "#0079c1"} + } + } + } + ] + } +} \ No newline at end of file