new JenksSymbolizer(options)
Class for managing SQL views on layers
Parameters:
Name | Type | Description |
---|---|---|
options |
nyc.carto.JenksSymbolizer.Options | Constructor options |
- Source:
Fires:
Extends
Methods
replace(str, values) → {string}
Replace tokens in a string with values from a provided object
Parameters:
Name | Type | Description |
---|---|---|
str |
string | String with tokens to be replaced |
values |
Object.<string, string> | Values token for replacement |
- Inherited From:
- Source:
Returns:
String with replacement value substitution
- Type
- string
sql(template, values, filtersopt) → {string}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
template |
string | The SQL template with optional replacement tokens | |
values |
Object.<string, Object.<string, string>> | The replacement values | |
filters |
Object.<string, string> |
<optional> |
The filters to append to the WHERE clause (i.e. ) |
- Inherited From:
- Source:
Returns:
The SQL statement
- Type
- string
Example
var template = "SELECT * FROM bike WHERE ${where}";
var values = {
color: {value: "red"},
gear: {low: 10, high: 18}
};
var filters = {
color: "color = '${value}'",
gear: "gear BETWEEN ${low} AND ${high}"
};
var sqlTmpl = nyc.carto.SqlTemplate();
sqlTmpl.sql(template, values, filters);
//Returns "SELECT * FROM bike WHERE color = 'red' AND gear BETWEEN 10 AND 18"
symbolize(layer)
Parameters:
Name | Type | Description |
---|---|---|
layer |
cartodb.CartoDBLayer.SubLayer | The layer to symbolize |
- Overrides:
- Source:
Type Definitions
Options
Object type to hold constructor options for nyc.carto.SqlJenksSymbolizer
Type:
- Object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
cartoSql |
cartodb.SQL | The object used to query CartoDB data | |
jenksColumn |
string | The data column for calculating Jenks natural breaks in the data | |
cssRules |
Array.<string> | An array of CartoCSS with the token ${value} to be replaced by the Jenks calculated values | |
baseCss |
string |
<optional> |
CartoCSS that remains unchanged regardless of changing data |
outlierFilter |
string |
<optional> |
An SQL condition used to restrict the data used in the Jenks calculation |
- Source:
Events
symbolized
The Jenks breaks applied to the CartoCS of the layer
Type:
- Array.<number>
- Overrides:
- Source: